Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,398 @@
package androidx.core.app;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.SharedElementCallback;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.Display;
import android.view.DragEvent;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.app.ActivityCompat;
import androidx.core.app.SharedElementCallback;
import androidx.core.content.ContextCompat;
import androidx.core.content.LocusIdCompat;
import androidx.core.view.DragAndDropPermissionsCompat;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class ActivityCompat extends ContextCompat {
private static PermissionCompatDelegate sDelegate;
public interface OnRequestPermissionsResultCallback {
void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr);
}
public interface PermissionCompatDelegate {
boolean onActivityResult(@NonNull Activity activity, @IntRange(from = 0) int i, int i2, @Nullable Intent intent);
boolean requestPermissions(@NonNull Activity activity, @NonNull String[] strArr, @IntRange(from = 0) int i);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public interface RequestPermissionsRequestCodeValidator {
void validateRequestPermissionsRequestCode(int i);
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static PermissionCompatDelegate getPermissionCompatDelegate() {
return sDelegate;
}
public static void setPermissionCompatDelegate(@Nullable PermissionCompatDelegate permissionCompatDelegate) {
sDelegate = permissionCompatDelegate;
}
@Deprecated
public static boolean invalidateOptionsMenu(Activity activity) {
activity.invalidateOptionsMenu();
return true;
}
public static void startActivityForResult(@NonNull Activity activity, @NonNull Intent intent, int i, @Nullable Bundle bundle) {
activity.startActivityForResult(intent, i, bundle);
}
public static void startIntentSenderForResult(@NonNull Activity activity, @NonNull IntentSender intentSender, int i, @Nullable Intent intent, int i2, int i3, int i4, @Nullable Bundle bundle) throws IntentSender.SendIntentException {
activity.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle);
}
public static void finishAffinity(@NonNull Activity activity) {
activity.finishAffinity();
}
public static void finishAfterTransition(@NonNull Activity activity) {
Api21Impl.finishAfterTransition(activity);
}
@Nullable
public static Uri getReferrer(@NonNull Activity activity) {
return Api22Impl.getReferrer(activity);
}
@NonNull
public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int i) {
if (Build.VERSION.SDK_INT >= 28) {
return (T) Api28Impl.requireViewById(activity, i);
}
T t = (T) activity.findViewById(i);
if (t != null) {
return t;
}
throw new IllegalArgumentException("ID does not reference a View inside this Activity");
}
public static void setEnterSharedElementCallback(@NonNull Activity activity, @Nullable SharedElementCallback sharedElementCallback) {
Api21Impl.setEnterSharedElementCallback(activity, sharedElementCallback != null ? new SharedElementCallback21Impl(sharedElementCallback) : null);
}
public static void setExitSharedElementCallback(@NonNull Activity activity, @Nullable SharedElementCallback sharedElementCallback) {
Api21Impl.setExitSharedElementCallback(activity, sharedElementCallback != null ? new SharedElementCallback21Impl(sharedElementCallback) : null);
}
public static void postponeEnterTransition(@NonNull Activity activity) {
Api21Impl.postponeEnterTransition(activity);
}
public static void startPostponedEnterTransition(@NonNull Activity activity) {
Api21Impl.startPostponedEnterTransition(activity);
}
/* JADX WARN: Multi-variable type inference failed */
public static void requestPermissions(@NonNull Activity activity, @NonNull String[] strArr, @IntRange(from = 0) int i) {
PermissionCompatDelegate permissionCompatDelegate = sDelegate;
if (permissionCompatDelegate == null || !permissionCompatDelegate.requestPermissions(activity, strArr, i)) {
HashSet hashSet = new HashSet();
for (int i2 = 0; i2 < strArr.length; i2++) {
if (TextUtils.isEmpty(strArr[i2])) {
throw new IllegalArgumentException("Permission request for permissions " + Arrays.toString(strArr) + " must not contain null or empty values");
}
if (Build.VERSION.SDK_INT < 33 && TextUtils.equals(strArr[i2], "android.permission.POST_NOTIFICATIONS")) {
hashSet.add(Integer.valueOf(i2));
}
}
int size = hashSet.size();
String[] strArr2 = size > 0 ? new String[strArr.length - size] : strArr;
if (size > 0) {
if (size == strArr.length) {
return;
}
int i3 = 0;
for (int i4 = 0; i4 < strArr.length; i4++) {
if (!hashSet.contains(Integer.valueOf(i4))) {
strArr2[i3] = strArr[i4];
i3++;
}
}
}
if (activity instanceof RequestPermissionsRequestCodeValidator) {
((RequestPermissionsRequestCodeValidator) activity).validateRequestPermissionsRequestCode(i);
}
Api23Impl.requestPermissions(activity, strArr, i);
}
}
/* renamed from: androidx.core.app.ActivityCompat$1, reason: invalid class name */
public class AnonymousClass1 implements Runnable {
final /* synthetic */ Activity val$activity;
final /* synthetic */ String[] val$permissionsArray;
final /* synthetic */ int val$requestCode;
public AnonymousClass1(String[] strArr, Activity activity, int i) {
this.val$permissionsArray = strArr;
this.val$activity = activity;
this.val$requestCode = i;
}
@Override // java.lang.Runnable
public void run() {
int[] iArr = new int[this.val$permissionsArray.length];
PackageManager packageManager = this.val$activity.getPackageManager();
String packageName = this.val$activity.getPackageName();
int length = this.val$permissionsArray.length;
for (int i = 0; i < length; i++) {
iArr[i] = packageManager.checkPermission(this.val$permissionsArray[i], packageName);
}
((OnRequestPermissionsResultCallback) this.val$activity).onRequestPermissionsResult(this.val$requestCode, this.val$permissionsArray, iArr);
}
}
public static boolean shouldShowRequestPermissionRationale(@NonNull Activity activity, @NonNull String str) {
int i = Build.VERSION.SDK_INT;
if (i < 33 && TextUtils.equals("android.permission.POST_NOTIFICATIONS", str)) {
return false;
}
if (i >= 32) {
return Api32Impl.shouldShowRequestPermissionRationale(activity, str);
}
if (i == 31) {
return Api31Impl.shouldShowRequestPermissionRationale(activity, str);
}
return Api23Impl.shouldShowRequestPermissionRationale(activity, str);
}
public static boolean isLaunchedFromBubble(@NonNull Activity activity) {
int i = Build.VERSION.SDK_INT;
if (i >= 31) {
return Api31Impl.isLaunchedFromBubble(activity);
}
if (i == 30) {
return (Api30Impl.getDisplay(activity) == null || Api30Impl.getDisplay(activity).getDisplayId() == 0) ? false : true;
}
if (i == 29) {
return (activity.getWindowManager().getDefaultDisplay() == null || activity.getWindowManager().getDefaultDisplay().getDisplayId() == 0) ? false : true;
}
return false;
}
@Nullable
public static DragAndDropPermissionsCompat requestDragAndDropPermissions(@NonNull Activity activity, @NonNull DragEvent dragEvent) {
return DragAndDropPermissionsCompat.request(activity, dragEvent);
}
public static void recreate(@NonNull final Activity activity) {
if (Build.VERSION.SDK_INT >= 28) {
activity.recreate();
} else {
new Handler(activity.getMainLooper()).post(new Runnable() { // from class: androidx.core.app.ActivityCompat$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ActivityCompat.lambda$recreate$0(activity);
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$recreate$0(Activity activity) {
if (activity.isFinishing() || ActivityRecreator.recreate(activity)) {
return;
}
activity.recreate();
}
public static void setLocusContext(@NonNull Activity activity, @Nullable LocusIdCompat locusIdCompat, @Nullable Bundle bundle) {
if (Build.VERSION.SDK_INT >= 30) {
Api30Impl.setLocusContext(activity, locusIdCompat, bundle);
}
}
@RequiresApi(21)
public static class SharedElementCallback21Impl extends android.app.SharedElementCallback {
private final SharedElementCallback mCallback;
public SharedElementCallback21Impl(SharedElementCallback sharedElementCallback) {
this.mCallback = sharedElementCallback;
}
@Override // android.app.SharedElementCallback
public void onSharedElementStart(List<String> list, List<View> list2, List<View> list3) {
this.mCallback.onSharedElementStart(list, list2, list3);
}
@Override // android.app.SharedElementCallback
public void onSharedElementEnd(List<String> list, List<View> list2, List<View> list3) {
this.mCallback.onSharedElementEnd(list, list2, list3);
}
@Override // android.app.SharedElementCallback
public void onRejectSharedElements(List<View> list) {
this.mCallback.onRejectSharedElements(list);
}
@Override // android.app.SharedElementCallback
public void onMapSharedElements(List<String> list, Map<String, View> map) {
this.mCallback.onMapSharedElements(list, map);
}
@Override // android.app.SharedElementCallback
public Parcelable onCaptureSharedElementSnapshot(View view, Matrix matrix, RectF rectF) {
return this.mCallback.onCaptureSharedElementSnapshot(view, matrix, rectF);
}
@Override // android.app.SharedElementCallback
public View onCreateSnapshotView(Context context, Parcelable parcelable) {
return this.mCallback.onCreateSnapshotView(context, parcelable);
}
@Override // android.app.SharedElementCallback
@RequiresApi(23)
public void onSharedElementsArrived(List<String> list, List<View> list2, final SharedElementCallback.OnSharedElementsReadyListener onSharedElementsReadyListener) {
this.mCallback.onSharedElementsArrived(list, list2, new SharedElementCallback.OnSharedElementsReadyListener() { // from class: androidx.core.app.ActivityCompat$SharedElementCallback21Impl$$ExternalSyntheticLambda0
@Override // androidx.core.app.SharedElementCallback.OnSharedElementsReadyListener
public final void onSharedElementsReady() {
ActivityCompat.Api23Impl.onSharedElementsReady(onSharedElementsReadyListener);
}
});
}
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static void setLocusContext(@NonNull Activity activity, @Nullable LocusIdCompat locusIdCompat, @Nullable Bundle bundle) {
activity.setLocusContext(locusIdCompat == null ? null : locusIdCompat.toLocusId(), bundle);
}
public static Display getDisplay(ContextWrapper contextWrapper) {
return contextWrapper.getDisplay();
}
}
@RequiresApi(31)
public static class Api31Impl {
private Api31Impl() {
}
public static boolean isLaunchedFromBubble(@NonNull Activity activity) {
return activity.isLaunchedFromBubble();
}
@SuppressLint({"BanUncheckedReflection"})
public static boolean shouldShowRequestPermissionRationale(Activity activity, String str) {
try {
return ((Boolean) PackageManager.class.getMethod("shouldShowRequestPermissionRationale", String.class).invoke(activity.getApplication().getPackageManager(), str)).booleanValue();
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
return activity.shouldShowRequestPermissionRationale(str);
}
}
}
@RequiresApi(32)
public static class Api32Impl {
private Api32Impl() {
}
public static boolean shouldShowRequestPermissionRationale(Activity activity, String str) {
return activity.shouldShowRequestPermissionRationale(str);
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static void finishAfterTransition(Activity activity) {
activity.finishAfterTransition();
}
public static void setEnterSharedElementCallback(Activity activity, android.app.SharedElementCallback sharedElementCallback) {
activity.setEnterSharedElementCallback(sharedElementCallback);
}
public static void setExitSharedElementCallback(Activity activity, android.app.SharedElementCallback sharedElementCallback) {
activity.setExitSharedElementCallback(sharedElementCallback);
}
public static void postponeEnterTransition(Activity activity) {
activity.postponeEnterTransition();
}
public static void startPostponedEnterTransition(Activity activity) {
activity.startPostponedEnterTransition();
}
}
@RequiresApi(22)
public static class Api22Impl {
private Api22Impl() {
}
public static Uri getReferrer(Activity activity) {
return activity.getReferrer();
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static <T> T requireViewById(Activity activity, int i) {
return (T) activity.requireViewById(i);
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static void requestPermissions(Activity activity, String[] strArr, int i) {
activity.requestPermissions(strArr, i);
}
public static boolean shouldShowRequestPermissionRationale(Activity activity, String str) {
return activity.shouldShowRequestPermissionRationale(str);
}
public static void onSharedElementsReady(Object obj) {
((SharedElementCallback.OnSharedElementsReadyListener) obj).onSharedElementsReady();
}
}
}

View File

@@ -0,0 +1,17 @@
package androidx.core.app;
import android.app.ActivityManager;
import androidx.annotation.NonNull;
import androidx.annotation.ReplaceWith;
/* loaded from: classes.dex */
public final class ActivityManagerCompat {
private ActivityManagerCompat() {
}
@ReplaceWith(expression = "activityManager.isLowRamDevice()")
@Deprecated
public static boolean isLowRamDevice(@NonNull ActivityManager activityManager) {
return activityManager.isLowRamDevice();
}
}

View File

@@ -0,0 +1,239 @@
package androidx.core.app;
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.util.Pair;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public class ActivityOptionsCompat {
public static final String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface BackgroundActivityStartMode {
}
@Nullable
public Rect getLaunchBounds() {
return null;
}
public void requestUsageTimeReport(@NonNull PendingIntent pendingIntent) {
}
@NonNull
public ActivityOptionsCompat setLaunchBounds(@Nullable Rect rect) {
return this;
}
@NonNull
public ActivityOptionsCompat setPendingIntentBackgroundActivityStartMode(int i) {
return this;
}
@NonNull
public ActivityOptionsCompat setShareIdentityEnabled(boolean z) {
return this;
}
@Nullable
public Bundle toBundle() {
return null;
}
public void update(@NonNull ActivityOptionsCompat activityOptionsCompat) {
}
@NonNull
public static ActivityOptionsCompat makeCustomAnimation(@NonNull Context context, int i, int i2) {
return new ActivityOptionsCompatImpl(ActivityOptions.makeCustomAnimation(context, i, i2));
}
@NonNull
public static ActivityOptionsCompat makeScaleUpAnimation(@NonNull View view, int i, int i2, int i3, int i4) {
return new ActivityOptionsCompatImpl(ActivityOptions.makeScaleUpAnimation(view, i, i2, i3, i4));
}
@NonNull
public static ActivityOptionsCompat makeClipRevealAnimation(@NonNull View view, int i, int i2, int i3, int i4) {
return new ActivityOptionsCompatImpl(Api23Impl.makeClipRevealAnimation(view, i, i2, i3, i4));
}
@NonNull
public static ActivityOptionsCompat makeThumbnailScaleUpAnimation(@NonNull View view, @NonNull Bitmap bitmap, int i, int i2) {
return new ActivityOptionsCompatImpl(ActivityOptions.makeThumbnailScaleUpAnimation(view, bitmap, i, i2));
}
@NonNull
public static ActivityOptionsCompat makeSceneTransitionAnimation(@NonNull Activity activity, @NonNull View view, @NonNull String str) {
return new ActivityOptionsCompatImpl(Api21Impl.makeSceneTransitionAnimation(activity, view, str));
}
@NonNull
public static ActivityOptionsCompat makeSceneTransitionAnimation(@NonNull Activity activity, @Nullable Pair<View, String>... pairArr) {
android.util.Pair[] pairArr2;
if (pairArr != null) {
pairArr2 = new android.util.Pair[pairArr.length];
for (int i = 0; i < pairArr.length; i++) {
Pair<View, String> pair = pairArr[i];
pairArr2[i] = android.util.Pair.create(pair.first, pair.second);
}
} else {
pairArr2 = null;
}
return new ActivityOptionsCompatImpl(Api21Impl.makeSceneTransitionAnimation(activity, pairArr2));
}
@NonNull
public static ActivityOptionsCompat makeTaskLaunchBehind() {
return new ActivityOptionsCompatImpl(Api21Impl.makeTaskLaunchBehind());
}
@NonNull
public static ActivityOptionsCompat makeBasic() {
return new ActivityOptionsCompatImpl(Api23Impl.makeBasic());
}
public static class ActivityOptionsCompatImpl extends ActivityOptionsCompat {
private final ActivityOptions mActivityOptions;
public ActivityOptionsCompatImpl(ActivityOptions activityOptions) {
this.mActivityOptions = activityOptions;
}
@Override // androidx.core.app.ActivityOptionsCompat
public Bundle toBundle() {
return this.mActivityOptions.toBundle();
}
@Override // androidx.core.app.ActivityOptionsCompat
public void update(@NonNull ActivityOptionsCompat activityOptionsCompat) {
if (activityOptionsCompat instanceof ActivityOptionsCompatImpl) {
this.mActivityOptions.update(((ActivityOptionsCompatImpl) activityOptionsCompat).mActivityOptions);
}
}
@Override // androidx.core.app.ActivityOptionsCompat
public void requestUsageTimeReport(@NonNull PendingIntent pendingIntent) {
Api23Impl.requestUsageTimeReport(this.mActivityOptions, pendingIntent);
}
@Override // androidx.core.app.ActivityOptionsCompat
@NonNull
public ActivityOptionsCompat setLaunchBounds(@Nullable Rect rect) {
return new ActivityOptionsCompatImpl(Api24Impl.setLaunchBounds(this.mActivityOptions, rect));
}
@Override // androidx.core.app.ActivityOptionsCompat
public Rect getLaunchBounds() {
return Api24Impl.getLaunchBounds(this.mActivityOptions);
}
@Override // androidx.core.app.ActivityOptionsCompat
@NonNull
public ActivityOptionsCompat setShareIdentityEnabled(boolean z) {
return Build.VERSION.SDK_INT < 34 ? this : new ActivityOptionsCompatImpl(Api34Impl.setShareIdentityEnabled(this.mActivityOptions, z));
}
@Override // androidx.core.app.ActivityOptionsCompat
@NonNull
public ActivityOptionsCompat setPendingIntentBackgroundActivityStartMode(int i) {
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 34) {
Api34Impl.setPendingIntentBackgroundActivityStartMode(this.mActivityOptions, i);
} else if (i2 >= 33) {
Api33Impl.setPendingIntentBackgroundActivityLaunchAllowed(this.mActivityOptions, i != 2);
}
return this;
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static ActivityOptions makeClipRevealAnimation(View view, int i, int i2, int i3, int i4) {
return ActivityOptions.makeClipRevealAnimation(view, i, i2, i3, i4);
}
public static ActivityOptions makeBasic() {
return ActivityOptions.makeBasic();
}
public static void requestUsageTimeReport(ActivityOptions activityOptions, PendingIntent pendingIntent) {
activityOptions.requestUsageTimeReport(pendingIntent);
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static ActivityOptions makeSceneTransitionAnimation(Activity activity, View view, String str) {
return ActivityOptions.makeSceneTransitionAnimation(activity, view, str);
}
@SafeVarargs
public static ActivityOptions makeSceneTransitionAnimation(Activity activity, android.util.Pair<View, String>... pairArr) {
return ActivityOptions.makeSceneTransitionAnimation(activity, pairArr);
}
public static ActivityOptions makeTaskLaunchBehind() {
return ActivityOptions.makeTaskLaunchBehind();
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static ActivityOptions setLaunchBounds(ActivityOptions activityOptions, Rect rect) {
return activityOptions.setLaunchBounds(rect);
}
public static Rect getLaunchBounds(ActivityOptions activityOptions) {
return activityOptions.getLaunchBounds();
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static void setPendingIntentBackgroundActivityLaunchAllowed(ActivityOptions activityOptions, boolean z) {
activityOptions.setPendingIntentBackgroundActivityLaunchAllowed(z);
}
}
@RequiresApi(34)
public static class Api34Impl {
private Api34Impl() {
}
public static ActivityOptions setShareIdentityEnabled(ActivityOptions activityOptions, boolean z) {
return activityOptions.setShareIdentityEnabled(z);
}
public static ActivityOptions setPendingIntentBackgroundActivityStartMode(ActivityOptions activityOptions, int i) {
return activityOptions.setPendingIntentBackgroundActivityStartMode(i);
}
}
}

View File

@@ -0,0 +1,257 @@
package androidx.core.app;
import android.app.Activity;
import android.app.Application;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
final class ActivityRecreator {
private static final String LOG_TAG = "ActivityRecreator";
protected static final Class<?> activityThreadClass;
private static final Handler mainHandler = new Handler(Looper.getMainLooper());
protected static final Field mainThreadField;
protected static final Method performStopActivity2ParamsMethod;
protected static final Method performStopActivity3ParamsMethod;
protected static final Method requestRelaunchActivityMethod;
protected static final Field tokenField;
private static boolean needsRelaunchCall() {
int i = Build.VERSION.SDK_INT;
return i == 26 || i == 27;
}
private ActivityRecreator() {
}
static {
Class<?> activityThreadClass2 = getActivityThreadClass();
activityThreadClass = activityThreadClass2;
mainThreadField = getMainThreadField();
tokenField = getTokenField();
performStopActivity3ParamsMethod = getPerformStopActivity3Params(activityThreadClass2);
performStopActivity2ParamsMethod = getPerformStopActivity2Params(activityThreadClass2);
requestRelaunchActivityMethod = getRequestRelaunchActivityMethod(activityThreadClass2);
}
public static boolean recreate(@NonNull Activity activity) {
Object obj;
if (Build.VERSION.SDK_INT >= 28) {
activity.recreate();
return true;
}
if (needsRelaunchCall() && requestRelaunchActivityMethod == null) {
return false;
}
if (performStopActivity2ParamsMethod == null && performStopActivity3ParamsMethod == null) {
return false;
}
try {
final Object obj2 = tokenField.get(activity);
if (obj2 == null || (obj = mainThreadField.get(activity)) == null) {
return false;
}
final Application application = activity.getApplication();
final LifecycleCheckCallbacks lifecycleCheckCallbacks = new LifecycleCheckCallbacks(activity);
application.registerActivityLifecycleCallbacks(lifecycleCheckCallbacks);
Handler handler = mainHandler;
handler.post(new Runnable() { // from class: androidx.core.app.ActivityRecreator.1
@Override // java.lang.Runnable
public void run() {
LifecycleCheckCallbacks.this.currentlyRecreatingToken = obj2;
}
});
try {
if (needsRelaunchCall()) {
Method method = requestRelaunchActivityMethod;
Boolean bool = Boolean.FALSE;
method.invoke(obj, obj2, null, null, 0, bool, null, null, bool, bool);
} else {
activity.recreate();
}
handler.post(new Runnable() { // from class: androidx.core.app.ActivityRecreator.2
@Override // java.lang.Runnable
public void run() {
application.unregisterActivityLifecycleCallbacks(lifecycleCheckCallbacks);
}
});
return true;
} catch (Throwable th) {
mainHandler.post(new Runnable() { // from class: androidx.core.app.ActivityRecreator.2
@Override // java.lang.Runnable
public void run() {
application.unregisterActivityLifecycleCallbacks(lifecycleCheckCallbacks);
}
});
throw th;
}
} catch (Throwable unused) {
return false;
}
}
public static final class LifecycleCheckCallbacks implements Application.ActivityLifecycleCallbacks {
Object currentlyRecreatingToken;
private Activity mActivity;
private final int mRecreatingHashCode;
private boolean mStarted = false;
private boolean mDestroyed = false;
private boolean mStopQueued = false;
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
if (this.mActivity == activity) {
this.mActivity = null;
this.mDestroyed = true;
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
if (this.mActivity == activity) {
this.mStarted = true;
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
}
public LifecycleCheckCallbacks(@NonNull Activity activity) {
this.mActivity = activity;
this.mRecreatingHashCode = activity.hashCode();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
if (!this.mDestroyed || this.mStopQueued || this.mStarted || !ActivityRecreator.queueOnStopIfNecessary(this.currentlyRecreatingToken, this.mRecreatingHashCode, activity)) {
return;
}
this.mStopQueued = true;
this.currentlyRecreatingToken = null;
}
}
public static boolean queueOnStopIfNecessary(Object obj, int i, Activity activity) {
try {
final Object obj2 = tokenField.get(activity);
if (obj2 == obj && activity.hashCode() == i) {
final Object obj3 = mainThreadField.get(activity);
mainHandler.postAtFrontOfQueue(new Runnable() { // from class: androidx.core.app.ActivityRecreator.3
@Override // java.lang.Runnable
public void run() {
try {
Method method = ActivityRecreator.performStopActivity3ParamsMethod;
if (method != null) {
method.invoke(obj3, obj2, Boolean.FALSE, "AppCompat recreation");
} else {
ActivityRecreator.performStopActivity2ParamsMethod.invoke(obj3, obj2, Boolean.FALSE);
}
} catch (RuntimeException e) {
if (e.getClass() == RuntimeException.class && e.getMessage() != null && e.getMessage().startsWith("Unable to stop")) {
throw e;
}
} catch (Throwable th) {
Log.e(ActivityRecreator.LOG_TAG, "Exception while invoking performStopActivity", th);
}
}
});
return true;
}
return false;
} catch (Throwable th) {
Log.e(LOG_TAG, "Exception while fetching field values", th);
return false;
}
}
private static Method getPerformStopActivity3Params(Class<?> cls) {
if (cls == null) {
return null;
}
try {
Method declaredMethod = cls.getDeclaredMethod("performStopActivity", IBinder.class, Boolean.TYPE, String.class);
declaredMethod.setAccessible(true);
return declaredMethod;
} catch (Throwable unused) {
return null;
}
}
private static Method getPerformStopActivity2Params(Class<?> cls) {
if (cls == null) {
return null;
}
try {
Method declaredMethod = cls.getDeclaredMethod("performStopActivity", IBinder.class, Boolean.TYPE);
declaredMethod.setAccessible(true);
return declaredMethod;
} catch (Throwable unused) {
return null;
}
}
private static Method getRequestRelaunchActivityMethod(Class<?> cls) {
if (needsRelaunchCall() && cls != null) {
try {
Class<?> cls2 = Boolean.TYPE;
Method declaredMethod = cls.getDeclaredMethod("requestRelaunchActivity", IBinder.class, List.class, List.class, Integer.TYPE, cls2, Configuration.class, Configuration.class, cls2, cls2);
declaredMethod.setAccessible(true);
return declaredMethod;
} catch (Throwable unused) {
}
}
return null;
}
private static Field getMainThreadField() {
try {
Field declaredField = Activity.class.getDeclaredField("mMainThread");
declaredField.setAccessible(true);
return declaredField;
} catch (Throwable unused) {
return null;
}
}
private static Field getTokenField() {
try {
Field declaredField = Activity.class.getDeclaredField("mToken");
declaredField.setAccessible(true);
return declaredField;
} catch (Throwable unused) {
return null;
}
}
private static Class<?> getActivityThreadClass() {
try {
return Class.forName("android.app.ActivityThread");
} catch (Throwable unused) {
return null;
}
}
}

View File

@@ -0,0 +1,79 @@
package androidx.core.app;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.ReplaceWith;
import androidx.annotation.RequiresApi;
/* loaded from: classes.dex */
public final class AlarmManagerCompat {
@SuppressLint({"MissingPermission"})
public static void setAlarmClock(@NonNull AlarmManager alarmManager, long j, @NonNull PendingIntent pendingIntent, @NonNull PendingIntent pendingIntent2) {
Api21Impl.setAlarmClock(alarmManager, Api21Impl.createAlarmClockInfo(j, pendingIntent), pendingIntent2);
}
public static void setAndAllowWhileIdle(@NonNull AlarmManager alarmManager, int i, long j, @NonNull PendingIntent pendingIntent) {
Api23Impl.setAndAllowWhileIdle(alarmManager, i, j, pendingIntent);
}
@ReplaceWith(expression = "alarmManager.setExact(type, triggerAtMillis, operation)")
@Deprecated
public static void setExact(@NonNull AlarmManager alarmManager, int i, long j, @NonNull PendingIntent pendingIntent) {
alarmManager.setExact(i, j, pendingIntent);
}
public static void setExactAndAllowWhileIdle(@NonNull AlarmManager alarmManager, int i, long j, @NonNull PendingIntent pendingIntent) {
Api23Impl.setExactAndAllowWhileIdle(alarmManager, i, j, pendingIntent);
}
public static boolean canScheduleExactAlarms(@NonNull AlarmManager alarmManager) {
if (Build.VERSION.SDK_INT >= 31) {
return Api31Impl.canScheduleExactAlarms(alarmManager);
}
return true;
}
private AlarmManagerCompat() {
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static void setAlarmClock(AlarmManager alarmManager, Object obj, PendingIntent pendingIntent) {
alarmManager.setAlarmClock((AlarmManager.AlarmClockInfo) obj, pendingIntent);
}
public static AlarmManager.AlarmClockInfo createAlarmClockInfo(long j, PendingIntent pendingIntent) {
return new AlarmManager.AlarmClockInfo(j, pendingIntent);
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static void setAndAllowWhileIdle(AlarmManager alarmManager, int i, long j, PendingIntent pendingIntent) {
alarmManager.setAndAllowWhileIdle(i, j, pendingIntent);
}
public static void setExactAndAllowWhileIdle(AlarmManager alarmManager, int i, long j, PendingIntent pendingIntent) {
alarmManager.setExactAndAllowWhileIdle(i, j, pendingIntent);
}
}
@RequiresApi(31)
public static class Api31Impl {
private Api31Impl() {
}
public static boolean canScheduleExactAlarms(AlarmManager alarmManager) {
return alarmManager.canScheduleExactAlarms();
}
}
}

View File

@@ -0,0 +1,86 @@
package androidx.core.app;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import java.lang.reflect.InvocationTargetException;
@RequiresApi(28)
/* loaded from: classes.dex */
public class AppComponentFactory extends android.app.AppComponentFactory {
@NonNull
public final Activity instantiateActivity(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Activity) CoreComponentFactory.checkCompatWrapper(instantiateActivityCompat(classLoader, str, intent));
}
@NonNull
public final Application instantiateApplication(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Application) CoreComponentFactory.checkCompatWrapper(instantiateApplicationCompat(classLoader, str));
}
@NonNull
public final BroadcastReceiver instantiateReceiver(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (BroadcastReceiver) CoreComponentFactory.checkCompatWrapper(instantiateReceiverCompat(classLoader, str, intent));
}
@NonNull
public final ContentProvider instantiateProvider(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (ContentProvider) CoreComponentFactory.checkCompatWrapper(instantiateProviderCompat(classLoader, str));
}
@NonNull
public final Service instantiateService(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Service) CoreComponentFactory.checkCompatWrapper(instantiateServiceCompat(classLoader, str, intent));
}
@NonNull
public Application instantiateApplicationCompat(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
try {
return (Application) Class.forName(str, false, classLoader).asSubclass(Application.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Couldn't call constructor", e);
}
}
@NonNull
public Activity instantiateActivityCompat(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
try {
return (Activity) Class.forName(str, false, classLoader).asSubclass(Activity.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Couldn't call constructor", e);
}
}
@NonNull
public BroadcastReceiver instantiateReceiverCompat(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
try {
return (BroadcastReceiver) Class.forName(str, false, classLoader).asSubclass(BroadcastReceiver.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Couldn't call constructor", e);
}
}
@NonNull
public Service instantiateServiceCompat(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
try {
return (Service) Class.forName(str, false, classLoader).asSubclass(Service.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Couldn't call constructor", e);
}
}
@NonNull
public ContentProvider instantiateProviderCompat(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
try {
return (ContentProvider) Class.forName(str, false, classLoader).asSubclass(ContentProvider.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw new RuntimeException("Couldn't call constructor", e);
}
}
}

View File

@@ -0,0 +1,35 @@
package androidx.core.app;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.core.content.IntentCompat;
@SuppressLint({"PrivateConstructorForUtilityClass"})
/* loaded from: classes.dex */
public class AppLaunchChecker {
private static final String KEY_STARTED_FROM_LAUNCHER = "startedFromLauncher";
private static final String SHARED_PREFS_NAME = "android.support.AppLaunchChecker";
public static boolean hasStartedFromLauncher(@NonNull Context context) {
return context.getSharedPreferences(SHARED_PREFS_NAME, 0).getBoolean(KEY_STARTED_FROM_LAUNCHER, false);
}
public static void onActivityCreate(@NonNull Activity activity) {
Intent intent;
SharedPreferences sharedPreferences = activity.getSharedPreferences(SHARED_PREFS_NAME, 0);
if (sharedPreferences.getBoolean(KEY_STARTED_FROM_LAUNCHER, false) || (intent = activity.getIntent()) == null || !"android.intent.action.MAIN".equals(intent.getAction())) {
return;
}
if (intent.hasCategory("android.intent.category.LAUNCHER") || intent.hasCategory(IntentCompat.CATEGORY_LEANBACK_LAUNCHER)) {
sharedPreferences.edit().putBoolean(KEY_STARTED_FROM_LAUNCHER, true).apply();
}
}
@Deprecated
public AppLaunchChecker() {
}
}

View File

@@ -0,0 +1,208 @@
package androidx.core.app;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class AppLocalesStorageHelper {
static final String APPLICATION_LOCALES_RECORD_FILE = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file";
static final boolean DEBUG = false;
static final String LOCALE_RECORD_ATTRIBUTE_TAG = "application_locales";
static final String LOCALE_RECORD_FILE_TAG = "locales";
static final String TAG = "AppLocalesStorageHelper";
private static final Object sAppLocaleStorageSync = new Object();
private AppLocalesStorageHelper() {
}
/* JADX WARN: Code restructure failed: missing block: B:16:0x0044, code lost:
if (r2 != null) goto L48;
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x0046, code lost:
r2.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:31:0x002e, code lost:
if (r5 != 4) goto L57;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x003b, code lost:
if (r3.getName().equals(androidx.core.app.AppLocalesStorageHelper.LOCALE_RECORD_FILE_TAG) == false) goto L62;
*/
/* JADX WARN: Code restructure failed: missing block: B:36:0x003d, code lost:
r1 = r3.getAttributeValue(null, androidx.core.app.AppLocalesStorageHelper.LOCALE_RECORD_ATTRIBUTE_TAG);
*/
/* JADX WARN: Code restructure failed: missing block: B:54:0x0053, code lost:
if (r2 == null) goto L31;
*/
@androidx.annotation.NonNull
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.lang.String readLocales(@androidx.annotation.NonNull android.content.Context r8) {
/*
java.lang.Object r0 = androidx.core.app.AppLocalesStorageHelper.sAppLocaleStorageSync
monitor-enter(r0)
java.lang.String r1 = ""
java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
java.io.FileInputStream r2 = r8.openFileInput(r2) // Catch: java.lang.Throwable -> L4a java.io.FileNotFoundException -> L6a
org.xmlpull.v1.XmlPullParser r3 = android.util.Xml.newPullParser() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
java.lang.String r4 = "UTF-8"
r3.setInput(r2, r4) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
int r4 = r3.getDepth() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
L18:
int r5 = r3.next() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
r6 = 1
if (r5 == r6) goto L44
r6 = 3
if (r5 != r6) goto L2b
int r7 = r3.getDepth() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
if (r7 <= r4) goto L44
goto L2b
L29:
r8 = move-exception
goto L64
L2b:
if (r5 == r6) goto L18
r6 = 4
if (r5 != r6) goto L31
goto L18
L31:
java.lang.String r5 = r3.getName() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
java.lang.String r6 = "locales"
boolean r5 = r5.equals(r6) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
if (r5 == 0) goto L18
java.lang.String r4 = "application_locales"
r5 = 0
java.lang.String r1 = r3.getAttributeValue(r5, r4) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c
L44:
if (r2 == 0) goto L56
L46:
r2.close() // Catch: java.lang.Throwable -> L4a java.io.IOException -> L56
goto L56
L4a:
r8 = move-exception
goto L6c
L4c:
java.lang.String r3 = "AppLocalesStorageHelper"
java.lang.String r4 = "Reading app Locales : Unable to parse through file :androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
android.util.Log.w(r3, r4) // Catch: java.lang.Throwable -> L29
if (r2 == 0) goto L56
goto L46
L56:
boolean r2 = r1.isEmpty() // Catch: java.lang.Throwable -> L4a
if (r2 != 0) goto L5d
goto L62
L5d:
java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
r8.deleteFile(r2) // Catch: java.lang.Throwable -> L4a
L62:
monitor-exit(r0) // Catch: java.lang.Throwable -> L4a
return r1
L64:
if (r2 == 0) goto L69
r2.close() // Catch: java.lang.Throwable -> L4a java.io.IOException -> L69
L69:
throw r8 // Catch: java.lang.Throwable -> L4a
L6a:
monitor-exit(r0) // Catch: java.lang.Throwable -> L4a
return r1
L6c:
monitor-exit(r0) // Catch: java.lang.Throwable -> L4a
throw r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.app.AppLocalesStorageHelper.readLocales(android.content.Context):java.lang.String");
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x003c, code lost:
if (r5 != null) goto L41;
*/
/* JADX WARN: Code restructure failed: missing block: B:21:0x003e, code lost:
r5.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x004c, code lost:
if (r5 == null) goto L25;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void persistLocales(@androidx.annotation.NonNull android.content.Context r5, @androidx.annotation.NonNull java.lang.String r6) {
/*
java.lang.Object r0 = androidx.core.app.AppLocalesStorageHelper.sAppLocaleStorageSync
monitor-enter(r0)
java.lang.String r1 = ""
boolean r1 = r6.equals(r1) // Catch: java.lang.Throwable -> L12
if (r1 == 0) goto L14
java.lang.String r6 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
r5.deleteFile(r6) // Catch: java.lang.Throwable -> L12
monitor-exit(r0) // Catch: java.lang.Throwable -> L12
return
L12:
r5 = move-exception
goto L6b
L14:
r1 = 0
java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
java.io.FileOutputStream r5 = r5.openFileOutput(r2, r1) // Catch: java.lang.Throwable -> L12 java.io.FileNotFoundException -> L57
org.xmlpull.v1.XmlSerializer r1 = android.util.Xml.newSerializer() // Catch: java.lang.Throwable -> L12
r2 = 0
r1.setOutput(r5, r2) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
java.lang.String r3 = "UTF-8"
java.lang.Boolean r4 = java.lang.Boolean.TRUE // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
r1.startDocument(r3, r4) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
java.lang.String r3 = "locales"
r1.startTag(r2, r3) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
java.lang.String r3 = "application_locales"
r1.attribute(r2, r3, r6) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
java.lang.String r6 = "locales"
r1.endTag(r2, r6) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
r1.endDocument() // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44
if (r5 == 0) goto L4f
L3e:
r5.close() // Catch: java.lang.Throwable -> L12 java.io.IOException -> L4f
goto L4f
L42:
r6 = move-exception
goto L51
L44:
r6 = move-exception
java.lang.String r1 = "AppLocalesStorageHelper"
java.lang.String r2 = "Storing App Locales : Failed to persist app-locales in storage "
android.util.Log.w(r1, r2, r6) // Catch: java.lang.Throwable -> L42
if (r5 == 0) goto L4f
goto L3e
L4f:
monitor-exit(r0) // Catch: java.lang.Throwable -> L12
return
L51:
if (r5 == 0) goto L56
r5.close() // Catch: java.lang.Throwable -> L12 java.io.IOException -> L56
L56:
throw r6 // Catch: java.lang.Throwable -> L12
L57:
java.lang.String r5 = "AppLocalesStorageHelper"
java.lang.String r6 = "Storing App Locales : FileNotFoundException: Cannot open file %s for writing "
r2 = 1
java.lang.Object[] r2 = new java.lang.Object[r2] // Catch: java.lang.Throwable -> L12
java.lang.String r3 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"
r2[r1] = r3 // Catch: java.lang.Throwable -> L12
java.lang.String r6 = java.lang.String.format(r6, r2) // Catch: java.lang.Throwable -> L12
android.util.Log.w(r5, r6) // Catch: java.lang.Throwable -> L12
monitor-exit(r0) // Catch: java.lang.Throwable -> L12
return
L6b:
monitor-exit(r0) // Catch: java.lang.Throwable -> L12
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.app.AppLocalesStorageHelper.persistLocales(android.content.Context, java.lang.String):void");
}
}

View File

@@ -0,0 +1,95 @@
package androidx.core.app;
import android.app.AppOpsManager;
import android.content.Context;
import android.os.Binder;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
/* loaded from: classes.dex */
public final class AppOpsManagerCompat {
public static final int MODE_ALLOWED = 0;
public static final int MODE_DEFAULT = 3;
public static final int MODE_ERRORED = 2;
public static final int MODE_IGNORED = 1;
private AppOpsManagerCompat() {
}
@Nullable
public static String permissionToOp(@NonNull String str) {
return Api23Impl.permissionToOp(str);
}
public static int noteOp(@NonNull Context context, @NonNull String str, int i, @NonNull String str2) {
return ((AppOpsManager) context.getSystemService("appops")).noteOp(str, i, str2);
}
public static int noteOpNoThrow(@NonNull Context context, @NonNull String str, int i, @NonNull String str2) {
return ((AppOpsManager) context.getSystemService("appops")).noteOpNoThrow(str, i, str2);
}
public static int noteProxyOp(@NonNull Context context, @NonNull String str, @NonNull String str2) {
return Api23Impl.noteProxyOp((AppOpsManager) Api23Impl.getSystemService(context, AppOpsManager.class), str, str2);
}
public static int noteProxyOpNoThrow(@NonNull Context context, @NonNull String str, @NonNull String str2) {
return Api23Impl.noteProxyOpNoThrow((AppOpsManager) Api23Impl.getSystemService(context, AppOpsManager.class), str, str2);
}
public static int checkOrNoteProxyOp(@NonNull Context context, int i, @NonNull String str, @NonNull String str2) {
if (Build.VERSION.SDK_INT >= 29) {
AppOpsManager systemService = Api29Impl.getSystemService(context);
int checkOpNoThrow = Api29Impl.checkOpNoThrow(systemService, str, Binder.getCallingUid(), str2);
return checkOpNoThrow != 0 ? checkOpNoThrow : Api29Impl.checkOpNoThrow(systemService, str, i, Api29Impl.getOpPackageName(context));
}
return noteProxyOpNoThrow(context, str, str2);
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@Nullable
public static AppOpsManager getSystemService(@NonNull Context context) {
return (AppOpsManager) context.getSystemService(AppOpsManager.class);
}
public static int checkOpNoThrow(@Nullable AppOpsManager appOpsManager, @NonNull String str, int i, @NonNull String str2) {
if (appOpsManager == null) {
return 1;
}
return appOpsManager.checkOpNoThrow(str, i, str2);
}
@NonNull
public static String getOpPackageName(@NonNull Context context) {
return context.getOpPackageName();
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static String permissionToOp(String str) {
return AppOpsManager.permissionToOp(str);
}
public static <T> T getSystemService(Context context, Class<T> cls) {
return (T) context.getSystemService(cls);
}
public static int noteProxyOp(AppOpsManager appOpsManager, String str, String str2) {
return appOpsManager.noteProxyOp(str, str2);
}
public static int noteProxyOpNoThrow(AppOpsManager appOpsManager, String str, String str2) {
return appOpsManager.noteProxyOpNoThrow(str, str2);
}
}
}

View File

@@ -0,0 +1,27 @@
package androidx.core.app;
import android.os.Bundle;
import android.os.IBinder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.ReplaceWith;
@Deprecated
/* loaded from: classes.dex */
public final class BundleCompat {
private BundleCompat() {
}
@Nullable
@ReplaceWith(expression = "bundle.getBinder(key)")
@Deprecated
public static IBinder getBinder(@NonNull Bundle bundle, @Nullable String str) {
return bundle.getBinder(str);
}
@ReplaceWith(expression = "bundle.putBinder(key, binder)")
@Deprecated
public static void putBinder(@NonNull Bundle bundle, @Nullable String str, @Nullable IBinder iBinder) {
bundle.putBinder(str, iBinder);
}
}

View File

@@ -0,0 +1,125 @@
package androidx.core.app;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import androidx.annotation.CallSuper;
import androidx.annotation.RestrictTo;
import androidx.collection.SimpleArrayMap;
import androidx.core.view.KeyEventDispatcher;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleRegistry;
import androidx.lifecycle.ReportFragment;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class ComponentActivity extends Activity implements LifecycleOwner, KeyEventDispatcher.Component {
private final SimpleArrayMap<Class<? extends ExtraData>, ExtraData> extraDataMap = new SimpleArrayMap<>(0, 1, null);
private final LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static class ExtraData {
}
private static /* synthetic */ void getExtraDataMap$annotations() {
}
private static /* synthetic */ void getLifecycleRegistry$annotations() {
}
public Lifecycle getLifecycle() {
return this.lifecycleRegistry;
}
/* JADX WARN: Multi-variable type inference failed */
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void putExtraData(ExtraData extraData) {
Intrinsics.checkNotNullParameter(extraData, "extraData");
this.extraDataMap.put(extraData.getClass(), extraData);
}
@Override // android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
ReportFragment.Companion.injectIfNeededIn(this);
}
@Override // android.app.Activity
@CallSuper
public void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
this.lifecycleRegistry.setCurrentState(Lifecycle.State.CREATED);
super.onSaveInstanceState(outState);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public <T extends ExtraData> T getExtraData(Class<T> extraDataClass) {
Intrinsics.checkNotNullParameter(extraDataClass, "extraDataClass");
return (T) this.extraDataMap.get(extraDataClass);
}
@Override // androidx.core.view.KeyEventDispatcher.Component
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean superDispatchKeyEvent(KeyEvent event) {
Intrinsics.checkNotNullParameter(event, "event");
return super.dispatchKeyEvent(event);
}
@Override // android.app.Activity, android.view.Window.Callback
public boolean dispatchKeyShortcutEvent(KeyEvent event) {
Intrinsics.checkNotNullParameter(event, "event");
View decorView = getWindow().getDecorView();
Intrinsics.checkNotNullExpressionValue(decorView, "window.decorView");
if (KeyEventDispatcher.dispatchBeforeHierarchy(decorView, event)) {
return true;
}
return super.dispatchKeyShortcutEvent(event);
}
@Override // android.app.Activity, android.view.Window.Callback
public boolean dispatchKeyEvent(KeyEvent event) {
Intrinsics.checkNotNullParameter(event, "event");
View decorView = getWindow().getDecorView();
Intrinsics.checkNotNullExpressionValue(decorView, "window.decorView");
if (KeyEventDispatcher.dispatchBeforeHierarchy(decorView, event)) {
return true;
}
return KeyEventDispatcher.dispatchKeyEvent(this, decorView, this, event);
}
public final boolean shouldDumpInternalState(String[] strArr) {
return !shouldSkipDump(strArr);
}
private final boolean shouldSkipDump(String[] strArr) {
if (strArr == null || strArr.length == 0) {
return false;
}
String str = strArr[0];
switch (str.hashCode()) {
case -645125871:
return str.equals("--translation") && Build.VERSION.SDK_INT >= 31;
case 100470631:
if (!str.equals("--dump-dumpable")) {
return false;
}
break;
case 472614934:
if (!str.equals("--list-dumpables")) {
return false;
}
break;
case 1159329357:
return str.equals("--contentcapture") && Build.VERSION.SDK_INT >= 29;
case 1455016274:
return str.equals("--autofill");
default:
return false;
}
return Build.VERSION.SDK_INT >= 33;
}
}

View File

@@ -0,0 +1,53 @@
package androidx.core.app;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
@RequiresApi(api = 28)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class CoreComponentFactory extends android.app.AppComponentFactory {
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public interface CompatWrapped {
Object getWrapper();
}
@NonNull
public Activity instantiateActivity(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Activity) checkCompatWrapper(super.instantiateActivity(classLoader, str, intent));
}
@NonNull
public Application instantiateApplication(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Application) checkCompatWrapper(super.instantiateApplication(classLoader, str));
}
@NonNull
public BroadcastReceiver instantiateReceiver(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (BroadcastReceiver) checkCompatWrapper(super.instantiateReceiver(classLoader, str, intent));
}
@NonNull
public ContentProvider instantiateProvider(@NonNull ClassLoader classLoader, @NonNull String str) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (ContentProvider) checkCompatWrapper(super.instantiateProvider(classLoader, str));
}
@NonNull
public Service instantiateService(@NonNull ClassLoader classLoader, @NonNull String str, @Nullable Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return (Service) checkCompatWrapper(super.instantiateService(classLoader, str, intent));
}
public static <T> T checkCompatWrapper(T t) {
T t2;
return (!(t instanceof CompatWrapped) || (t2 = (T) ((CompatWrapped) t).getWrapper()) == null) ? t : t2;
}
}

View File

@@ -0,0 +1,35 @@
package androidx.core.app;
import android.app.Dialog;
import android.os.Build;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
/* loaded from: classes.dex */
public class DialogCompat {
private DialogCompat() {
}
@NonNull
public static View requireViewById(@NonNull Dialog dialog, int i) {
if (Build.VERSION.SDK_INT >= 28) {
return (View) Api28Impl.requireViewById(dialog, i);
}
View findViewById = dialog.findViewById(i);
if (findViewById != null) {
return findViewById;
}
throw new IllegalArgumentException("ID does not reference a View inside this Dialog");
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static <T> T requireViewById(Dialog dialog, int i) {
return (T) dialog.requireViewById(i);
}
}
}

View File

@@ -0,0 +1,225 @@
package androidx.core.app;
import android.app.Activity;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.SparseIntArray;
import android.view.FrameMetrics;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public class FrameMetricsAggregator {
public static final int ANIMATION_DURATION = 256;
public static final int ANIMATION_INDEX = 8;
public static final int COMMAND_DURATION = 32;
public static final int COMMAND_INDEX = 5;
public static final int DELAY_DURATION = 128;
public static final int DELAY_INDEX = 7;
public static final int DRAW_DURATION = 8;
public static final int DRAW_INDEX = 3;
public static final int EVERY_DURATION = 511;
public static final int INPUT_DURATION = 2;
public static final int INPUT_INDEX = 1;
private static final int LAST_INDEX = 8;
public static final int LAYOUT_MEASURE_DURATION = 4;
public static final int LAYOUT_MEASURE_INDEX = 2;
public static final int SWAP_DURATION = 64;
public static final int SWAP_INDEX = 6;
public static final int SYNC_DURATION = 16;
public static final int SYNC_INDEX = 4;
public static final int TOTAL_DURATION = 1;
public static final int TOTAL_INDEX = 0;
private final FrameMetricsBaseImpl mInstance;
public static class FrameMetricsBaseImpl {
public void add(Activity activity) {
}
public SparseIntArray[] getMetrics() {
return null;
}
public SparseIntArray[] remove(Activity activity) {
return null;
}
public SparseIntArray[] reset() {
return null;
}
public SparseIntArray[] stop() {
return null;
}
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface MetricType {
}
public FrameMetricsAggregator() {
this(1);
}
public FrameMetricsAggregator(int i) {
this.mInstance = new FrameMetricsApi24Impl(i);
}
public void add(@NonNull Activity activity) {
this.mInstance.add(activity);
}
@Nullable
public SparseIntArray[] remove(@NonNull Activity activity) {
return this.mInstance.remove(activity);
}
@Nullable
public SparseIntArray[] stop() {
return this.mInstance.stop();
}
@Nullable
public SparseIntArray[] reset() {
return this.mInstance.reset();
}
@Nullable
public SparseIntArray[] getMetrics() {
return this.mInstance.getMetrics();
}
@RequiresApi(24)
public static class FrameMetricsApi24Impl extends FrameMetricsBaseImpl {
private static final int NANOS_PER_MS = 1000000;
private static final int NANOS_ROUNDING_VALUE = 500000;
private static Handler sHandler;
private static HandlerThread sHandlerThread;
int mTrackingFlags;
SparseIntArray[] mMetrics = new SparseIntArray[9];
private final ArrayList<WeakReference<Activity>> mActivities = new ArrayList<>();
Window.OnFrameMetricsAvailableListener mListener = new Window.OnFrameMetricsAvailableListener() { // from class: androidx.core.app.FrameMetricsAggregator.FrameMetricsApi24Impl.1
@Override // android.view.Window.OnFrameMetricsAvailableListener
public void onFrameMetricsAvailable(Window window, FrameMetrics frameMetrics, int i) {
FrameMetricsApi24Impl frameMetricsApi24Impl = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl.mTrackingFlags & 1) != 0) {
frameMetricsApi24Impl.addDurationItem(frameMetricsApi24Impl.mMetrics[0], frameMetrics.getMetric(8));
}
FrameMetricsApi24Impl frameMetricsApi24Impl2 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl2.mTrackingFlags & 2) != 0) {
frameMetricsApi24Impl2.addDurationItem(frameMetricsApi24Impl2.mMetrics[1], frameMetrics.getMetric(1));
}
FrameMetricsApi24Impl frameMetricsApi24Impl3 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl3.mTrackingFlags & 4) != 0) {
frameMetricsApi24Impl3.addDurationItem(frameMetricsApi24Impl3.mMetrics[2], frameMetrics.getMetric(3));
}
FrameMetricsApi24Impl frameMetricsApi24Impl4 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl4.mTrackingFlags & 8) != 0) {
frameMetricsApi24Impl4.addDurationItem(frameMetricsApi24Impl4.mMetrics[3], frameMetrics.getMetric(4));
}
FrameMetricsApi24Impl frameMetricsApi24Impl5 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl5.mTrackingFlags & 16) != 0) {
frameMetricsApi24Impl5.addDurationItem(frameMetricsApi24Impl5.mMetrics[4], frameMetrics.getMetric(5));
}
FrameMetricsApi24Impl frameMetricsApi24Impl6 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl6.mTrackingFlags & 64) != 0) {
frameMetricsApi24Impl6.addDurationItem(frameMetricsApi24Impl6.mMetrics[6], frameMetrics.getMetric(7));
}
FrameMetricsApi24Impl frameMetricsApi24Impl7 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl7.mTrackingFlags & 32) != 0) {
frameMetricsApi24Impl7.addDurationItem(frameMetricsApi24Impl7.mMetrics[5], frameMetrics.getMetric(6));
}
FrameMetricsApi24Impl frameMetricsApi24Impl8 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl8.mTrackingFlags & 128) != 0) {
frameMetricsApi24Impl8.addDurationItem(frameMetricsApi24Impl8.mMetrics[7], frameMetrics.getMetric(0));
}
FrameMetricsApi24Impl frameMetricsApi24Impl9 = FrameMetricsApi24Impl.this;
if ((frameMetricsApi24Impl9.mTrackingFlags & 256) != 0) {
frameMetricsApi24Impl9.addDurationItem(frameMetricsApi24Impl9.mMetrics[8], frameMetrics.getMetric(2));
}
}
};
@Override // androidx.core.app.FrameMetricsAggregator.FrameMetricsBaseImpl
public SparseIntArray[] getMetrics() {
return this.mMetrics;
}
@Override // androidx.core.app.FrameMetricsAggregator.FrameMetricsBaseImpl
public SparseIntArray[] reset() {
SparseIntArray[] sparseIntArrayArr = this.mMetrics;
this.mMetrics = new SparseIntArray[9];
return sparseIntArrayArr;
}
public FrameMetricsApi24Impl(int i) {
this.mTrackingFlags = i;
}
public void addDurationItem(SparseIntArray sparseIntArray, long j) {
if (sparseIntArray != null) {
int i = (int) ((500000 + j) / 1000000);
if (j >= 0) {
sparseIntArray.put(i, sparseIntArray.get(i) + 1);
}
}
}
@Override // androidx.core.app.FrameMetricsAggregator.FrameMetricsBaseImpl
public void add(Activity activity) {
if (sHandlerThread == null) {
HandlerThread handlerThread = new HandlerThread("FrameMetricsAggregator");
sHandlerThread = handlerThread;
handlerThread.start();
sHandler = new Handler(sHandlerThread.getLooper());
}
for (int i = 0; i <= 8; i++) {
SparseIntArray[] sparseIntArrayArr = this.mMetrics;
if (sparseIntArrayArr[i] == null && (this.mTrackingFlags & (1 << i)) != 0) {
sparseIntArrayArr[i] = new SparseIntArray();
}
}
activity.getWindow().addOnFrameMetricsAvailableListener(this.mListener, sHandler);
this.mActivities.add(new WeakReference<>(activity));
}
@Override // androidx.core.app.FrameMetricsAggregator.FrameMetricsBaseImpl
public SparseIntArray[] remove(Activity activity) {
Iterator<WeakReference<Activity>> it = this.mActivities.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
WeakReference<Activity> next = it.next();
if (next.get() == activity) {
this.mActivities.remove(next);
break;
}
}
activity.getWindow().removeOnFrameMetricsAvailableListener(this.mListener);
return this.mMetrics;
}
@Override // androidx.core.app.FrameMetricsAggregator.FrameMetricsBaseImpl
public SparseIntArray[] stop() {
for (int size = this.mActivities.size() - 1; size >= 0; size--) {
WeakReference<Activity> weakReference = this.mActivities.get(size);
Activity activity = weakReference.get();
if (weakReference.get() != null) {
activity.getWindow().removeOnFrameMetricsAvailableListener(this.mListener);
this.mActivities.remove(size);
}
}
return this.mMetrics;
}
}
}

View File

@@ -0,0 +1,64 @@
package androidx.core.app;
import android.app.GrammaticalInflectionManager;
import android.content.Context;
import android.os.Build;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.os.BuildCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public final class GrammaticalInflectionManagerCompat {
public static final int GRAMMATICAL_GENDER_FEMININE = 2;
public static final int GRAMMATICAL_GENDER_MASCULINE = 3;
public static final int GRAMMATICAL_GENDER_NEUTRAL = 1;
public static final int GRAMMATICAL_GENDER_NOT_SPECIFIED = 0;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface GrammaticalGender {
}
private GrammaticalInflectionManagerCompat() {
}
@AnyThread
@OptIn(markerClass = {BuildCompat.PrereleaseSdkCheck.class})
public static int getApplicationGrammaticalGender(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 34) {
return Api34Impl.getApplicationGrammaticalGender(context);
}
return 0;
}
@AnyThread
@OptIn(markerClass = {BuildCompat.PrereleaseSdkCheck.class})
public static void setRequestedApplicationGrammaticalGender(@NonNull Context context, int i) {
if (Build.VERSION.SDK_INT >= 34) {
Api34Impl.setRequestedApplicationGrammaticalGender(context, i);
}
}
@RequiresApi(34)
public static class Api34Impl {
private Api34Impl() {
}
public static int getApplicationGrammaticalGender(Context context) {
return getGrammaticalInflectionManager(context).getApplicationGrammaticalGender();
}
public static void setRequestedApplicationGrammaticalGender(Context context, int i) {
getGrammaticalInflectionManager(context).setRequestedApplicationGrammaticalGender(i);
}
private static GrammaticalInflectionManager getGrammaticalInflectionManager(Context context) {
return (GrammaticalInflectionManager) context.getSystemService(GrammaticalInflectionManager.class);
}
}
}

View File

@@ -0,0 +1,451 @@
package androidx.core.app;
import android.app.Service;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobServiceEngine;
import android.app.job.JobWorkItem;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.IBinder;
import android.os.PowerManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.facebook.AuthenticationTokenClaims;
import com.mbridge.msdk.playercommon.exoplayer2.source.chunk.ChunkedTrackBlacklistUtil;
import java.util.ArrayList;
import java.util.HashMap;
@Deprecated
/* loaded from: classes.dex */
public abstract class JobIntentService extends Service {
static final boolean DEBUG = false;
static final String TAG = "JobIntentService";
WorkEnqueuer mCompatWorkEnqueuer;
CommandProcessor mCurProcessor;
CompatJobEngine mJobImpl;
static final Object sLock = new Object();
static final HashMap<ComponentName, WorkEnqueuer> sClassWorkEnqueuer = new HashMap<>();
boolean mInterruptIfStopped = false;
boolean mStopped = false;
boolean mDestroyed = false;
final ArrayList<CompatWorkItem> mCompatQueue = null;
public interface CompatJobEngine {
IBinder compatGetBinder();
GenericWorkItem dequeueWork();
}
public interface GenericWorkItem {
void complete();
Intent getIntent();
}
public boolean isStopped() {
return this.mStopped;
}
public abstract void onHandleWork(@NonNull Intent intent);
public boolean onStopCurrentWork() {
return true;
}
public void setInterruptIfStopped(boolean z) {
this.mInterruptIfStopped = z;
}
public static abstract class WorkEnqueuer {
final ComponentName mComponentName;
boolean mHasJobId;
int mJobId;
public abstract void enqueueWork(Intent intent);
public void serviceProcessingFinished() {
}
public void serviceProcessingStarted() {
}
public void serviceStartReceived() {
}
public WorkEnqueuer(ComponentName componentName) {
this.mComponentName = componentName;
}
public void ensureJobId(int i) {
if (!this.mHasJobId) {
this.mHasJobId = true;
this.mJobId = i;
} else {
if (this.mJobId == i) {
return;
}
throw new IllegalArgumentException("Given job ID " + i + " is different than previous " + this.mJobId);
}
}
}
public static final class CompatWorkEnqueuer extends WorkEnqueuer {
private final Context mContext;
private final PowerManager.WakeLock mLaunchWakeLock;
boolean mLaunchingService;
private final PowerManager.WakeLock mRunWakeLock;
boolean mServiceProcessing;
public CompatWorkEnqueuer(Context context, ComponentName componentName) {
super(componentName);
this.mContext = context.getApplicationContext();
PowerManager powerManager = (PowerManager) context.getSystemService("power");
PowerManager.WakeLock newWakeLock = powerManager.newWakeLock(1, componentName.getClassName() + ":launch");
this.mLaunchWakeLock = newWakeLock;
newWakeLock.setReferenceCounted(false);
PowerManager.WakeLock newWakeLock2 = powerManager.newWakeLock(1, componentName.getClassName() + ":run");
this.mRunWakeLock = newWakeLock2;
newWakeLock2.setReferenceCounted(false);
}
@Override // androidx.core.app.JobIntentService.WorkEnqueuer
public void enqueueWork(Intent intent) {
Intent intent2 = new Intent(intent);
intent2.setComponent(this.mComponentName);
if (this.mContext.startService(intent2) != null) {
synchronized (this) {
try {
if (!this.mLaunchingService) {
this.mLaunchingService = true;
if (!this.mServiceProcessing) {
this.mLaunchWakeLock.acquire(ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS);
}
}
} finally {
}
}
}
}
@Override // androidx.core.app.JobIntentService.WorkEnqueuer
public void serviceStartReceived() {
synchronized (this) {
this.mLaunchingService = false;
}
}
@Override // androidx.core.app.JobIntentService.WorkEnqueuer
public void serviceProcessingStarted() {
synchronized (this) {
try {
if (!this.mServiceProcessing) {
this.mServiceProcessing = true;
this.mRunWakeLock.acquire(AuthenticationTokenClaims.MAX_TIME_SINCE_TOKEN_ISSUED);
this.mLaunchWakeLock.release();
}
} catch (Throwable th) {
throw th;
}
}
}
@Override // androidx.core.app.JobIntentService.WorkEnqueuer
public void serviceProcessingFinished() {
synchronized (this) {
try {
if (this.mServiceProcessing) {
if (this.mLaunchingService) {
this.mLaunchWakeLock.acquire(ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS);
}
this.mServiceProcessing = false;
this.mRunWakeLock.release();
}
} catch (Throwable th) {
throw th;
}
}
}
}
@RequiresApi(26)
public static final class JobServiceEngineImpl extends JobServiceEngine implements CompatJobEngine {
static final boolean DEBUG = false;
static final String TAG = "JobServiceEngineImpl";
final Object mLock;
JobParameters mParams;
final JobIntentService mService;
public final class WrapperWorkItem implements GenericWorkItem {
final JobWorkItem mJobWork;
public WrapperWorkItem(JobWorkItem jobWorkItem) {
this.mJobWork = jobWorkItem;
}
@Override // androidx.core.app.JobIntentService.GenericWorkItem
public Intent getIntent() {
return this.mJobWork.getIntent();
}
@Override // androidx.core.app.JobIntentService.GenericWorkItem
public void complete() {
synchronized (JobServiceEngineImpl.this.mLock) {
try {
JobParameters jobParameters = JobServiceEngineImpl.this.mParams;
if (jobParameters != null) {
jobParameters.completeWork(this.mJobWork);
}
} catch (Throwable th) {
throw th;
}
}
}
}
public JobServiceEngineImpl(JobIntentService jobIntentService) {
super(jobIntentService);
this.mLock = new Object();
this.mService = jobIntentService;
}
@Override // androidx.core.app.JobIntentService.CompatJobEngine
public IBinder compatGetBinder() {
return getBinder();
}
@Override // android.app.job.JobServiceEngine
public boolean onStartJob(JobParameters jobParameters) {
this.mParams = jobParameters;
this.mService.ensureProcessorRunningLocked(false);
return true;
}
@Override // android.app.job.JobServiceEngine
public boolean onStopJob(JobParameters jobParameters) {
boolean doStopCurrentWork = this.mService.doStopCurrentWork();
synchronized (this.mLock) {
this.mParams = null;
}
return doStopCurrentWork;
}
@Override // androidx.core.app.JobIntentService.CompatJobEngine
public GenericWorkItem dequeueWork() {
synchronized (this.mLock) {
try {
JobParameters jobParameters = this.mParams;
if (jobParameters == null) {
return null;
}
JobWorkItem dequeueWork = jobParameters.dequeueWork();
if (dequeueWork == null) {
return null;
}
dequeueWork.getIntent().setExtrasClassLoader(this.mService.getClassLoader());
return new WrapperWorkItem(dequeueWork);
} catch (Throwable th) {
throw th;
}
}
}
}
@RequiresApi(26)
public static final class JobWorkEnqueuer extends WorkEnqueuer {
private final JobInfo mJobInfo;
private final JobScheduler mJobScheduler;
public JobWorkEnqueuer(Context context, ComponentName componentName, int i) {
super(componentName);
ensureJobId(i);
this.mJobInfo = new JobInfo.Builder(i, this.mComponentName).setOverrideDeadline(0L).build();
this.mJobScheduler = (JobScheduler) context.getApplicationContext().getSystemService("jobscheduler");
}
@Override // androidx.core.app.JobIntentService.WorkEnqueuer
public void enqueueWork(Intent intent) {
this.mJobScheduler.enqueue(this.mJobInfo, new JobWorkItem(intent));
}
}
public final class CompatWorkItem implements GenericWorkItem {
final Intent mIntent;
final int mStartId;
@Override // androidx.core.app.JobIntentService.GenericWorkItem
public Intent getIntent() {
return this.mIntent;
}
public CompatWorkItem(Intent intent, int i) {
this.mIntent = intent;
this.mStartId = i;
}
@Override // androidx.core.app.JobIntentService.GenericWorkItem
public void complete() {
JobIntentService.this.stopSelf(this.mStartId);
}
}
public final class CommandProcessor extends AsyncTask<Void, Void, Void> {
public CommandProcessor() {
}
@Override // android.os.AsyncTask
public Void doInBackground(Void... voidArr) {
while (true) {
GenericWorkItem dequeueWork = JobIntentService.this.dequeueWork();
if (dequeueWork == null) {
return null;
}
JobIntentService.this.onHandleWork(dequeueWork.getIntent());
dequeueWork.complete();
}
}
@Override // android.os.AsyncTask
public void onCancelled(Void r1) {
JobIntentService.this.processorFinished();
}
@Override // android.os.AsyncTask
public void onPostExecute(Void r1) {
JobIntentService.this.processorFinished();
}
}
@Override // android.app.Service
public void onCreate() {
super.onCreate();
this.mJobImpl = new JobServiceEngineImpl(this);
this.mCompatWorkEnqueuer = null;
}
@Override // android.app.Service
public int onStartCommand(@Nullable Intent intent, int i, int i2) {
if (this.mCompatQueue == null) {
return 2;
}
this.mCompatWorkEnqueuer.serviceStartReceived();
synchronized (this.mCompatQueue) {
ArrayList<CompatWorkItem> arrayList = this.mCompatQueue;
if (intent == null) {
intent = new Intent();
}
arrayList.add(new CompatWorkItem(intent, i2));
ensureProcessorRunningLocked(true);
}
return 3;
}
@Override // android.app.Service
public IBinder onBind(@NonNull Intent intent) {
CompatJobEngine compatJobEngine = this.mJobImpl;
if (compatJobEngine != null) {
return compatJobEngine.compatGetBinder();
}
return null;
}
@Override // android.app.Service
public void onDestroy() {
super.onDestroy();
ArrayList<CompatWorkItem> arrayList = this.mCompatQueue;
if (arrayList != null) {
synchronized (arrayList) {
this.mDestroyed = true;
this.mCompatWorkEnqueuer.serviceProcessingFinished();
}
}
}
public static void enqueueWork(@NonNull Context context, @NonNull Class<?> cls, int i, @NonNull Intent intent) {
enqueueWork(context, new ComponentName(context, cls), i, intent);
}
public static void enqueueWork(@NonNull Context context, @NonNull ComponentName componentName, int i, @NonNull Intent intent) {
if (intent == null) {
throw new IllegalArgumentException("work must not be null");
}
synchronized (sLock) {
WorkEnqueuer workEnqueuer = getWorkEnqueuer(context, componentName, true, i);
workEnqueuer.ensureJobId(i);
workEnqueuer.enqueueWork(intent);
}
}
public static WorkEnqueuer getWorkEnqueuer(Context context, ComponentName componentName, boolean z, int i) {
HashMap<ComponentName, WorkEnqueuer> hashMap = sClassWorkEnqueuer;
WorkEnqueuer workEnqueuer = hashMap.get(componentName);
if (workEnqueuer != null) {
return workEnqueuer;
}
if (!z) {
throw new IllegalArgumentException("Can't be here without a job id");
}
JobWorkEnqueuer jobWorkEnqueuer = new JobWorkEnqueuer(context, componentName, i);
hashMap.put(componentName, jobWorkEnqueuer);
return jobWorkEnqueuer;
}
public boolean doStopCurrentWork() {
CommandProcessor commandProcessor = this.mCurProcessor;
if (commandProcessor != null) {
commandProcessor.cancel(this.mInterruptIfStopped);
}
this.mStopped = true;
return onStopCurrentWork();
}
public void ensureProcessorRunningLocked(boolean z) {
if (this.mCurProcessor == null) {
this.mCurProcessor = new CommandProcessor();
WorkEnqueuer workEnqueuer = this.mCompatWorkEnqueuer;
if (workEnqueuer != null && z) {
workEnqueuer.serviceProcessingStarted();
}
this.mCurProcessor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
}
}
public void processorFinished() {
ArrayList<CompatWorkItem> arrayList = this.mCompatQueue;
if (arrayList != null) {
synchronized (arrayList) {
try {
this.mCurProcessor = null;
ArrayList<CompatWorkItem> arrayList2 = this.mCompatQueue;
if (arrayList2 != null && arrayList2.size() > 0) {
ensureProcessorRunningLocked(false);
} else if (!this.mDestroyed) {
this.mCompatWorkEnqueuer.serviceProcessingFinished();
}
} finally {
}
}
}
}
public GenericWorkItem dequeueWork() {
CompatJobEngine compatJobEngine = this.mJobImpl;
if (compatJobEngine != null) {
return compatJobEngine.dequeueWork();
}
synchronized (this.mCompatQueue) {
try {
if (this.mCompatQueue.size() <= 0) {
return null;
}
return this.mCompatQueue.remove(0);
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,88 @@
package androidx.core.app;
import android.app.LocaleManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.LocaleList;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.core.os.LocaleListCompat;
import java.util.Locale;
/* loaded from: classes.dex */
public final class LocaleManagerCompat {
private LocaleManagerCompat() {
}
@NonNull
@AnyThread
public static LocaleListCompat getSystemLocales(@NonNull Context context) {
LocaleListCompat emptyLocaleList = LocaleListCompat.getEmptyLocaleList();
if (Build.VERSION.SDK_INT >= 33) {
Object localeManagerForApplication = getLocaleManagerForApplication(context);
return localeManagerForApplication != null ? LocaleListCompat.wrap(Api33Impl.localeManagerGetSystemLocales(localeManagerForApplication)) : emptyLocaleList;
}
return getConfigurationLocales(Resources.getSystem().getConfiguration());
}
@NonNull
@AnyThread
public static LocaleListCompat getApplicationLocales(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 33) {
Object localeManagerForApplication = getLocaleManagerForApplication(context);
if (localeManagerForApplication != null) {
return LocaleListCompat.wrap(Api33Impl.localeManagerGetApplicationLocales(localeManagerForApplication));
}
return LocaleListCompat.getEmptyLocaleList();
}
return LocaleListCompat.forLanguageTags(AppLocalesStorageHelper.readLocales(context));
}
@RequiresApi(33)
private static Object getLocaleManagerForApplication(Context context) {
return context.getSystemService("locale");
}
@VisibleForTesting
public static LocaleListCompat getConfigurationLocales(Configuration configuration) {
return Api24Impl.getLocales(configuration);
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static String toLanguageTag(Locale locale) {
return locale.toLanguageTag();
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static LocaleListCompat getLocales(Configuration configuration) {
return LocaleListCompat.forLanguageTags(configuration.getLocales().toLanguageTags());
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static LocaleList localeManagerGetSystemLocales(Object obj) {
return ((LocaleManager) obj).getSystemLocales();
}
public static LocaleList localeManagerGetApplicationLocales(Object obj) {
return ((LocaleManager) obj).getApplicationLocales();
}
}
}

View File

@@ -0,0 +1,38 @@
package androidx.core.app;
import android.content.res.Configuration;
import androidx.annotation.RequiresApi;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class MultiWindowModeChangedInfo {
private final boolean isInMultiWindowMode;
@RequiresApi(26)
private Configuration newConfiguration;
public final boolean isInMultiWindowMode() {
return this.isInMultiWindowMode;
}
public MultiWindowModeChangedInfo(boolean z) {
this.isInMultiWindowMode = z;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@RequiresApi(26)
public MultiWindowModeChangedInfo(boolean z, Configuration newConfig) {
this(z);
Intrinsics.checkNotNullParameter(newConfig, "newConfig");
this.newConfiguration = newConfig;
}
@RequiresApi(26)
public final Configuration getNewConfig() {
Configuration configuration = this.newConfiguration;
if (configuration != null) {
return configuration;
}
throw new IllegalStateException("MultiWindowModeChangedInfo must be constructed with the constructor that takes a Configuration to access the newConfig. Are you running on an API 26 or higher device that makes this information available?".toString());
}
}

View File

@@ -0,0 +1,118 @@
package androidx.core.app;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.ReplaceWith;
/* loaded from: classes.dex */
public final class NavUtils {
public static final String PARENT_ACTIVITY = "android.support.PARENT_ACTIVITY";
private static final String TAG = "NavUtils";
@ReplaceWith(expression = "sourceActivity.shouldUpRecreateTask(targetIntent)")
@Deprecated
public static boolean shouldUpRecreateTask(@NonNull Activity activity, @NonNull Intent intent) {
return activity.shouldUpRecreateTask(intent);
}
public static void navigateUpFromSameTask(@NonNull Activity activity) {
Intent parentActivityIntent = getParentActivityIntent(activity);
if (parentActivityIntent == null) {
throw new IllegalArgumentException("Activity " + activity.getClass().getSimpleName() + " does not have a parent activity name specified. (Did you forget to add the android.support.PARENT_ACTIVITY <meta-data> element in your manifest?)");
}
navigateUpTo(activity, parentActivityIntent);
}
@ReplaceWith(expression = "sourceActivity.navigateUpTo(upIntent)")
@Deprecated
public static void navigateUpTo(@NonNull Activity activity, @NonNull Intent intent) {
activity.navigateUpTo(intent);
}
@Nullable
public static Intent getParentActivityIntent(@NonNull Activity activity) {
Intent parentActivityIntent = activity.getParentActivityIntent();
if (parentActivityIntent != null) {
return parentActivityIntent;
}
String parentActivityName = getParentActivityName(activity);
if (parentActivityName == null) {
return null;
}
ComponentName componentName = new ComponentName(activity, parentActivityName);
try {
if (getParentActivityName(activity, componentName) == null) {
return Intent.makeMainActivity(componentName);
}
return new Intent().setComponent(componentName);
} catch (PackageManager.NameNotFoundException unused) {
Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentActivityName + "' in manifest");
return null;
}
}
@Nullable
public static Intent getParentActivityIntent(@NonNull Context context, @NonNull Class<?> cls) throws PackageManager.NameNotFoundException {
String parentActivityName = getParentActivityName(context, new ComponentName(context, cls));
if (parentActivityName == null) {
return null;
}
ComponentName componentName = new ComponentName(context, parentActivityName);
if (getParentActivityName(context, componentName) == null) {
return Intent.makeMainActivity(componentName);
}
return new Intent().setComponent(componentName);
}
@Nullable
public static Intent getParentActivityIntent(@NonNull Context context, @NonNull ComponentName componentName) throws PackageManager.NameNotFoundException {
String parentActivityName = getParentActivityName(context, componentName);
if (parentActivityName == null) {
return null;
}
ComponentName componentName2 = new ComponentName(componentName.getPackageName(), parentActivityName);
if (getParentActivityName(context, componentName2) == null) {
return Intent.makeMainActivity(componentName2);
}
return new Intent().setComponent(componentName2);
}
@Nullable
public static String getParentActivityName(@NonNull Activity activity) {
try {
return getParentActivityName(activity, activity.getComponentName());
} catch (PackageManager.NameNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
@Nullable
public static String getParentActivityName(@NonNull Context context, @NonNull ComponentName componentName) throws PackageManager.NameNotFoundException {
String string;
ActivityInfo activityInfo = context.getPackageManager().getActivityInfo(componentName, Build.VERSION.SDK_INT >= 29 ? 269222528 : 787072);
String str = activityInfo.parentActivityName;
if (str != null) {
return str;
}
Bundle bundle = activityInfo.metaData;
if (bundle == null || (string = bundle.getString(PARENT_ACTIVITY)) == null) {
return null;
}
if (string.charAt(0) != '.') {
return string;
}
return context.getPackageName() + string;
}
private NavUtils() {
}
}

View File

@@ -0,0 +1,10 @@
package androidx.core.app;
import android.app.Notification;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public interface NotificationBuilderWithBuilderAccessor {
Notification.Builder getBuilder();
}

View File

@@ -0,0 +1,398 @@
package androidx.core.app;
import android.app.Notification;
import android.app.NotificationChannel;
import android.media.AudioAttributes;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.util.Preconditions;
/* loaded from: classes.dex */
public class NotificationChannelCompat {
public static final String DEFAULT_CHANNEL_ID = "miscellaneous";
private static final int DEFAULT_LIGHT_COLOR = 0;
private static final boolean DEFAULT_SHOW_BADGE = true;
AudioAttributes mAudioAttributes;
private boolean mBypassDnd;
private boolean mCanBubble;
String mConversationId;
String mDescription;
String mGroupId;
@NonNull
final String mId;
int mImportance;
private boolean mImportantConversation;
int mLightColor;
boolean mLights;
private int mLockscreenVisibility;
CharSequence mName;
String mParentId;
boolean mShowBadge;
Uri mSound;
boolean mVibrationEnabled;
long[] mVibrationPattern;
public boolean canBubble() {
return this.mCanBubble;
}
public boolean canBypassDnd() {
return this.mBypassDnd;
}
public boolean canShowBadge() {
return this.mShowBadge;
}
@Nullable
public AudioAttributes getAudioAttributes() {
return this.mAudioAttributes;
}
@Nullable
public String getConversationId() {
return this.mConversationId;
}
@Nullable
public String getDescription() {
return this.mDescription;
}
@Nullable
public String getGroup() {
return this.mGroupId;
}
@NonNull
public String getId() {
return this.mId;
}
public int getImportance() {
return this.mImportance;
}
public int getLightColor() {
return this.mLightColor;
}
public int getLockscreenVisibility() {
return this.mLockscreenVisibility;
}
@Nullable
public CharSequence getName() {
return this.mName;
}
@Nullable
public String getParentChannelId() {
return this.mParentId;
}
@Nullable
public Uri getSound() {
return this.mSound;
}
@Nullable
public long[] getVibrationPattern() {
return this.mVibrationPattern;
}
public boolean isImportantConversation() {
return this.mImportantConversation;
}
public boolean shouldShowLights() {
return this.mLights;
}
public boolean shouldVibrate() {
return this.mVibrationEnabled;
}
public static class Builder {
private final NotificationChannelCompat mChannel;
@NonNull
public NotificationChannelCompat build() {
return this.mChannel;
}
public Builder(@NonNull String str, int i) {
this.mChannel = new NotificationChannelCompat(str, i);
}
@NonNull
public Builder setName(@Nullable CharSequence charSequence) {
this.mChannel.mName = charSequence;
return this;
}
@NonNull
public Builder setImportance(int i) {
this.mChannel.mImportance = i;
return this;
}
@NonNull
public Builder setDescription(@Nullable String str) {
this.mChannel.mDescription = str;
return this;
}
@NonNull
public Builder setGroup(@Nullable String str) {
this.mChannel.mGroupId = str;
return this;
}
@NonNull
public Builder setShowBadge(boolean z) {
this.mChannel.mShowBadge = z;
return this;
}
@NonNull
public Builder setSound(@Nullable Uri uri, @Nullable AudioAttributes audioAttributes) {
NotificationChannelCompat notificationChannelCompat = this.mChannel;
notificationChannelCompat.mSound = uri;
notificationChannelCompat.mAudioAttributes = audioAttributes;
return this;
}
@NonNull
public Builder setLightsEnabled(boolean z) {
this.mChannel.mLights = z;
return this;
}
@NonNull
public Builder setLightColor(int i) {
this.mChannel.mLightColor = i;
return this;
}
@NonNull
public Builder setVibrationEnabled(boolean z) {
this.mChannel.mVibrationEnabled = z;
return this;
}
@NonNull
public Builder setVibrationPattern(@Nullable long[] jArr) {
NotificationChannelCompat notificationChannelCompat = this.mChannel;
notificationChannelCompat.mVibrationEnabled = jArr != null && jArr.length > 0;
notificationChannelCompat.mVibrationPattern = jArr;
return this;
}
@NonNull
public Builder setConversationId(@NonNull String str, @NonNull String str2) {
if (Build.VERSION.SDK_INT >= 30) {
NotificationChannelCompat notificationChannelCompat = this.mChannel;
notificationChannelCompat.mParentId = str;
notificationChannelCompat.mConversationId = str2;
}
return this;
}
}
public NotificationChannelCompat(@NonNull String str, int i) {
this.mShowBadge = true;
this.mSound = Settings.System.DEFAULT_NOTIFICATION_URI;
this.mLightColor = 0;
this.mId = (String) Preconditions.checkNotNull(str);
this.mImportance = i;
this.mAudioAttributes = Notification.AUDIO_ATTRIBUTES_DEFAULT;
}
@RequiresApi(26)
public NotificationChannelCompat(@NonNull NotificationChannel notificationChannel) {
this(Api26Impl.getId(notificationChannel), Api26Impl.getImportance(notificationChannel));
this.mName = Api26Impl.getName(notificationChannel);
this.mDescription = Api26Impl.getDescription(notificationChannel);
this.mGroupId = Api26Impl.getGroup(notificationChannel);
this.mShowBadge = Api26Impl.canShowBadge(notificationChannel);
this.mSound = Api26Impl.getSound(notificationChannel);
this.mAudioAttributes = Api26Impl.getAudioAttributes(notificationChannel);
this.mLights = Api26Impl.shouldShowLights(notificationChannel);
this.mLightColor = Api26Impl.getLightColor(notificationChannel);
this.mVibrationEnabled = Api26Impl.shouldVibrate(notificationChannel);
this.mVibrationPattern = Api26Impl.getVibrationPattern(notificationChannel);
int i = Build.VERSION.SDK_INT;
if (i >= 30) {
this.mParentId = Api30Impl.getParentChannelId(notificationChannel);
this.mConversationId = Api30Impl.getConversationId(notificationChannel);
}
this.mBypassDnd = Api26Impl.canBypassDnd(notificationChannel);
this.mLockscreenVisibility = Api26Impl.getLockscreenVisibility(notificationChannel);
if (i >= 29) {
this.mCanBubble = Api29Impl.canBubble(notificationChannel);
}
if (i >= 30) {
this.mImportantConversation = Api30Impl.isImportantConversation(notificationChannel);
}
}
public NotificationChannel getNotificationChannel() {
String str;
String str2;
int i = Build.VERSION.SDK_INT;
NotificationChannel createNotificationChannel = Api26Impl.createNotificationChannel(this.mId, this.mName, this.mImportance);
Api26Impl.setDescription(createNotificationChannel, this.mDescription);
Api26Impl.setGroup(createNotificationChannel, this.mGroupId);
Api26Impl.setShowBadge(createNotificationChannel, this.mShowBadge);
Api26Impl.setSound(createNotificationChannel, this.mSound, this.mAudioAttributes);
Api26Impl.enableLights(createNotificationChannel, this.mLights);
Api26Impl.setLightColor(createNotificationChannel, this.mLightColor);
Api26Impl.setVibrationPattern(createNotificationChannel, this.mVibrationPattern);
Api26Impl.enableVibration(createNotificationChannel, this.mVibrationEnabled);
if (i >= 30 && (str = this.mParentId) != null && (str2 = this.mConversationId) != null) {
Api30Impl.setConversationId(createNotificationChannel, str, str2);
}
return createNotificationChannel;
}
@NonNull
public Builder toBuilder() {
return new Builder(this.mId, this.mImportance).setName(this.mName).setDescription(this.mDescription).setGroup(this.mGroupId).setShowBadge(this.mShowBadge).setSound(this.mSound, this.mAudioAttributes).setLightsEnabled(this.mLights).setLightColor(this.mLightColor).setVibrationEnabled(this.mVibrationEnabled).setVibrationPattern(this.mVibrationPattern).setConversationId(this.mParentId, this.mConversationId);
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static NotificationChannel createNotificationChannel(String str, CharSequence charSequence, int i) {
return new NotificationChannel(str, charSequence, i);
}
public static String getId(NotificationChannel notificationChannel) {
return notificationChannel.getId();
}
public static int getImportance(NotificationChannel notificationChannel) {
return notificationChannel.getImportance();
}
public static CharSequence getName(NotificationChannel notificationChannel) {
return notificationChannel.getName();
}
public static String getDescription(NotificationChannel notificationChannel) {
return notificationChannel.getDescription();
}
public static void setDescription(NotificationChannel notificationChannel, String str) {
notificationChannel.setDescription(str);
}
public static String getGroup(NotificationChannel notificationChannel) {
return notificationChannel.getGroup();
}
public static void setGroup(NotificationChannel notificationChannel, String str) {
notificationChannel.setGroup(str);
}
public static boolean canShowBadge(NotificationChannel notificationChannel) {
return notificationChannel.canShowBadge();
}
public static void setShowBadge(NotificationChannel notificationChannel, boolean z) {
notificationChannel.setShowBadge(z);
}
public static Uri getSound(NotificationChannel notificationChannel) {
return notificationChannel.getSound();
}
public static void setSound(NotificationChannel notificationChannel, Uri uri, AudioAttributes audioAttributes) {
notificationChannel.setSound(uri, audioAttributes);
}
public static AudioAttributes getAudioAttributes(NotificationChannel notificationChannel) {
return notificationChannel.getAudioAttributes();
}
public static boolean shouldShowLights(NotificationChannel notificationChannel) {
return notificationChannel.shouldShowLights();
}
public static void enableLights(NotificationChannel notificationChannel, boolean z) {
notificationChannel.enableLights(z);
}
public static int getLightColor(NotificationChannel notificationChannel) {
return notificationChannel.getLightColor();
}
public static void setLightColor(NotificationChannel notificationChannel, int i) {
notificationChannel.setLightColor(i);
}
public static boolean shouldVibrate(NotificationChannel notificationChannel) {
return notificationChannel.shouldVibrate();
}
public static void enableVibration(NotificationChannel notificationChannel, boolean z) {
notificationChannel.enableVibration(z);
}
public static long[] getVibrationPattern(NotificationChannel notificationChannel) {
return notificationChannel.getVibrationPattern();
}
public static void setVibrationPattern(NotificationChannel notificationChannel, long[] jArr) {
notificationChannel.setVibrationPattern(jArr);
}
public static boolean canBypassDnd(NotificationChannel notificationChannel) {
return notificationChannel.canBypassDnd();
}
public static int getLockscreenVisibility(NotificationChannel notificationChannel) {
return notificationChannel.getLockscreenVisibility();
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static boolean canBubble(NotificationChannel notificationChannel) {
return notificationChannel.canBubble();
}
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static String getParentChannelId(NotificationChannel notificationChannel) {
return notificationChannel.getParentChannelId();
}
public static String getConversationId(NotificationChannel notificationChannel) {
return notificationChannel.getConversationId();
}
public static void setConversationId(NotificationChannel notificationChannel, String str, String str2) {
notificationChannel.setConversationId(str, str2);
}
public static boolean isImportantConversation(NotificationChannel notificationChannel) {
return notificationChannel.isImportantConversation();
}
}
}

View File

@@ -0,0 +1,165 @@
package androidx.core.app;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.util.Preconditions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* loaded from: classes.dex */
public class NotificationChannelGroupCompat {
private boolean mBlocked;
private List<NotificationChannelCompat> mChannels;
String mDescription;
final String mId;
CharSequence mName;
@NonNull
public List<NotificationChannelCompat> getChannels() {
return this.mChannels;
}
@Nullable
public String getDescription() {
return this.mDescription;
}
@NonNull
public String getId() {
return this.mId;
}
@Nullable
public CharSequence getName() {
return this.mName;
}
public boolean isBlocked() {
return this.mBlocked;
}
public static class Builder {
final NotificationChannelGroupCompat mGroup;
@NonNull
public NotificationChannelGroupCompat build() {
return this.mGroup;
}
public Builder(@NonNull String str) {
this.mGroup = new NotificationChannelGroupCompat(str);
}
@NonNull
public Builder setName(@Nullable CharSequence charSequence) {
this.mGroup.mName = charSequence;
return this;
}
@NonNull
public Builder setDescription(@Nullable String str) {
this.mGroup.mDescription = str;
return this;
}
}
public NotificationChannelGroupCompat(@NonNull String str) {
this.mChannels = Collections.emptyList();
this.mId = (String) Preconditions.checkNotNull(str);
}
@RequiresApi(28)
public NotificationChannelGroupCompat(@NonNull NotificationChannelGroup notificationChannelGroup) {
this(notificationChannelGroup, Collections.emptyList());
}
@RequiresApi(26)
public NotificationChannelGroupCompat(@NonNull NotificationChannelGroup notificationChannelGroup, @NonNull List<NotificationChannel> list) {
this(Api26Impl.getId(notificationChannelGroup));
this.mName = Api26Impl.getName(notificationChannelGroup);
int i = Build.VERSION.SDK_INT;
if (i >= 28) {
this.mDescription = Api28Impl.getDescription(notificationChannelGroup);
}
if (i >= 28) {
this.mBlocked = Api28Impl.isBlocked(notificationChannelGroup);
this.mChannels = getChannelsCompat(Api26Impl.getChannels(notificationChannelGroup));
} else {
this.mChannels = getChannelsCompat(list);
}
}
@RequiresApi(26)
private List<NotificationChannelCompat> getChannelsCompat(List<NotificationChannel> list) {
ArrayList arrayList = new ArrayList();
for (NotificationChannel notificationChannel : list) {
if (this.mId.equals(Api26Impl.getGroup(notificationChannel))) {
arrayList.add(new NotificationChannelCompat(notificationChannel));
}
}
return arrayList;
}
public NotificationChannelGroup getNotificationChannelGroup() {
int i = Build.VERSION.SDK_INT;
NotificationChannelGroup createNotificationChannelGroup = Api26Impl.createNotificationChannelGroup(this.mId, this.mName);
if (i >= 28) {
Api28Impl.setDescription(createNotificationChannelGroup, this.mDescription);
}
return createNotificationChannelGroup;
}
@NonNull
public Builder toBuilder() {
return new Builder(this.mId).setName(this.mName).setDescription(this.mDescription);
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static NotificationChannelGroup createNotificationChannelGroup(String str, CharSequence charSequence) {
return new NotificationChannelGroup(str, charSequence);
}
public static String getId(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.getId();
}
public static CharSequence getName(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.getName();
}
public static List<NotificationChannel> getChannels(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.getChannels();
}
public static String getGroup(NotificationChannel notificationChannel) {
return notificationChannel.getGroup();
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static boolean isBlocked(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.isBlocked();
}
public static String getDescription(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.getDescription();
}
public static void setDescription(NotificationChannelGroup notificationChannelGroup, String str) {
notificationChannelGroup.setDescription(str);
}
}
}

View File

@@ -0,0 +1,8 @@
package androidx.core.app;
/* loaded from: classes.dex */
public abstract /* synthetic */ class NotificationCompat$$ExternalSyntheticApiModelOutline0 {
public static /* bridge */ /* synthetic */ android.app.Person m(Object obj) {
return (android.app.Person) obj;
}
}

View File

@@ -0,0 +1,5 @@
package androidx.core.app;
/* loaded from: classes.dex */
public abstract /* synthetic */ class NotificationCompat$CallStyle$$ExternalSyntheticApiModelOutline0 {
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,483 @@
package androidx.core.app;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.LocusId;
import android.graphics.drawable.Icon;
import android.media.AudioAttributes;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.RemoteViews;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.collection.ArraySet;
import androidx.core.app.NotificationCompat;
import androidx.core.content.LocusIdCompat;
import androidx.core.graphics.drawable.IconCompat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
class NotificationCompatBuilder implements NotificationBuilderWithBuilderAccessor {
private RemoteViews mBigContentView;
private final Notification.Builder mBuilder;
private final NotificationCompat.Builder mBuilderCompat;
private RemoteViews mContentView;
private final Context mContext;
private int mGroupAlertBehavior;
private RemoteViews mHeadsUpContentView;
private final List<Bundle> mActionExtrasList = new ArrayList();
private final Bundle mExtras = new Bundle();
@Override // androidx.core.app.NotificationBuilderWithBuilderAccessor
public Notification.Builder getBuilder() {
return this.mBuilder;
}
public Context getContext() {
return this.mContext;
}
public NotificationCompatBuilder(NotificationCompat.Builder builder) {
List list;
int i;
this.mBuilderCompat = builder;
Context context = builder.mContext;
this.mContext = context;
Notification.Builder createBuilder = Api26Impl.createBuilder(context, builder.mChannelId);
this.mBuilder = createBuilder;
Notification notification = builder.mNotification;
createBuilder.setWhen(notification.when).setSmallIcon(notification.icon, notification.iconLevel).setContent(notification.contentView).setTicker(notification.tickerText, builder.mTickerView).setVibrate(notification.vibrate).setLights(notification.ledARGB, notification.ledOnMS, notification.ledOffMS).setOngoing((notification.flags & 2) != 0).setOnlyAlertOnce((notification.flags & 8) != 0).setAutoCancel((notification.flags & 16) != 0).setDefaults(notification.defaults).setContentTitle(builder.mContentTitle).setContentText(builder.mContentText).setContentInfo(builder.mContentInfo).setContentIntent(builder.mContentIntent).setDeleteIntent(notification.deleteIntent).setFullScreenIntent(builder.mFullScreenIntent, (notification.flags & 128) != 0).setNumber(builder.mNumber).setProgress(builder.mProgressMax, builder.mProgress, builder.mProgressIndeterminate);
IconCompat iconCompat = builder.mLargeIcon;
Api23Impl.setLargeIcon(createBuilder, iconCompat == null ? null : iconCompat.toIcon(context));
createBuilder.setSubText(builder.mSubText).setUsesChronometer(builder.mUseChronometer).setPriority(builder.mPriority);
NotificationCompat.Style style = builder.mStyle;
if (style instanceof NotificationCompat.CallStyle) {
Iterator<NotificationCompat.Action> it = ((NotificationCompat.CallStyle) style).getActionsListWithSystemActions().iterator();
while (it.hasNext()) {
addAction(it.next());
}
} else {
Iterator<NotificationCompat.Action> it2 = builder.mActions.iterator();
while (it2.hasNext()) {
addAction(it2.next());
}
}
Bundle bundle = builder.mExtras;
if (bundle != null) {
this.mExtras.putAll(bundle);
}
int i2 = Build.VERSION.SDK_INT;
this.mContentView = builder.mContentView;
this.mBigContentView = builder.mBigContentView;
this.mBuilder.setShowWhen(builder.mShowWhen);
Api20Impl.setLocalOnly(this.mBuilder, builder.mLocalOnly);
Api20Impl.setGroup(this.mBuilder, builder.mGroupKey);
Api20Impl.setSortKey(this.mBuilder, builder.mSortKey);
Api20Impl.setGroupSummary(this.mBuilder, builder.mGroupSummary);
this.mGroupAlertBehavior = builder.mGroupAlertBehavior;
Api21Impl.setCategory(this.mBuilder, builder.mCategory);
Api21Impl.setColor(this.mBuilder, builder.mColor);
Api21Impl.setVisibility(this.mBuilder, builder.mVisibility);
Api21Impl.setPublicVersion(this.mBuilder, builder.mPublicVersion);
Api21Impl.setSound(this.mBuilder, notification.sound, notification.audioAttributes);
if (i2 < 28) {
list = combineLists(getPeople(builder.mPersonList), builder.mPeople);
} else {
list = builder.mPeople;
}
if (list != null && !list.isEmpty()) {
Iterator it3 = list.iterator();
while (it3.hasNext()) {
Api21Impl.addPerson(this.mBuilder, (String) it3.next());
}
}
this.mHeadsUpContentView = builder.mHeadsUpContentView;
if (builder.mInvisibleActions.size() > 0) {
Bundle bundle2 = builder.getExtras().getBundle("android.car.EXTENSIONS");
bundle2 = bundle2 == null ? new Bundle() : bundle2;
Bundle bundle3 = new Bundle(bundle2);
Bundle bundle4 = new Bundle();
for (int i3 = 0; i3 < builder.mInvisibleActions.size(); i3++) {
bundle4.putBundle(Integer.toString(i3), NotificationCompatJellybean.getBundleForAction(builder.mInvisibleActions.get(i3)));
}
bundle2.putBundle("invisible_actions", bundle4);
bundle3.putBundle("invisible_actions", bundle4);
builder.getExtras().putBundle("android.car.EXTENSIONS", bundle2);
this.mExtras.putBundle("android.car.EXTENSIONS", bundle3);
}
int i4 = Build.VERSION.SDK_INT;
Object obj = builder.mSmallIcon;
if (obj != null) {
Api23Impl.setSmallIcon(this.mBuilder, obj);
}
this.mBuilder.setExtras(builder.mExtras);
Api24Impl.setRemoteInputHistory(this.mBuilder, builder.mRemoteInputHistory);
RemoteViews remoteViews = builder.mContentView;
if (remoteViews != null) {
Api24Impl.setCustomContentView(this.mBuilder, remoteViews);
}
RemoteViews remoteViews2 = builder.mBigContentView;
if (remoteViews2 != null) {
Api24Impl.setCustomBigContentView(this.mBuilder, remoteViews2);
}
RemoteViews remoteViews3 = builder.mHeadsUpContentView;
if (remoteViews3 != null) {
Api24Impl.setCustomHeadsUpContentView(this.mBuilder, remoteViews3);
}
Api26Impl.setBadgeIconType(this.mBuilder, builder.mBadgeIcon);
Api26Impl.setSettingsText(this.mBuilder, builder.mSettingsText);
Api26Impl.setShortcutId(this.mBuilder, builder.mShortcutId);
Api26Impl.setTimeoutAfter(this.mBuilder, builder.mTimeout);
Api26Impl.setGroupAlertBehavior(this.mBuilder, builder.mGroupAlertBehavior);
if (builder.mColorizedSet) {
Api26Impl.setColorized(this.mBuilder, builder.mColorized);
}
if (!TextUtils.isEmpty(builder.mChannelId)) {
this.mBuilder.setSound(null).setDefaults(0).setLights(0, 0, 0).setVibrate(null);
}
if (i4 >= 28) {
Iterator<Person> it4 = builder.mPersonList.iterator();
while (it4.hasNext()) {
Api28Impl.addPerson(this.mBuilder, it4.next().toAndroidPerson());
}
}
int i5 = Build.VERSION.SDK_INT;
if (i5 >= 29) {
Api29Impl.setAllowSystemGeneratedContextualActions(this.mBuilder, builder.mAllowSystemGeneratedContextualActions);
Api29Impl.setBubbleMetadata(this.mBuilder, NotificationCompat.BubbleMetadata.toPlatform(builder.mBubbleMetadata));
LocusIdCompat locusIdCompat = builder.mLocusId;
if (locusIdCompat != null) {
Api29Impl.setLocusId(this.mBuilder, locusIdCompat.toLocusId());
}
}
if (i5 >= 31 && (i = builder.mFgsDeferBehavior) != 0) {
Api31Impl.setForegroundServiceBehavior(this.mBuilder, i);
}
if (builder.mSilent) {
if (this.mBuilderCompat.mGroupSummary) {
this.mGroupAlertBehavior = 2;
} else {
this.mGroupAlertBehavior = 1;
}
this.mBuilder.setVibrate(null);
this.mBuilder.setSound(null);
int i6 = notification.defaults & (-4);
notification.defaults = i6;
this.mBuilder.setDefaults(i6);
if (TextUtils.isEmpty(this.mBuilderCompat.mGroupKey)) {
Api20Impl.setGroup(this.mBuilder, NotificationCompat.GROUP_KEY_SILENT);
}
Api26Impl.setGroupAlertBehavior(this.mBuilder, this.mGroupAlertBehavior);
}
}
@Nullable
private static List<String> combineLists(@Nullable List<String> list, @Nullable List<String> list2) {
if (list == null) {
return list2;
}
if (list2 == null) {
return list;
}
ArraySet arraySet = new ArraySet(list.size() + list2.size());
arraySet.addAll(list);
arraySet.addAll(list2);
return new ArrayList(arraySet);
}
@Nullable
private static List<String> getPeople(@Nullable List<Person> list) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList(list.size());
Iterator<Person> it = list.iterator();
while (it.hasNext()) {
arrayList.add(it.next().resolveToLegacyUri());
}
return arrayList;
}
public Notification build() {
Bundle extras;
RemoteViews makeHeadsUpContentView;
RemoteViews makeBigContentView;
NotificationCompat.Style style = this.mBuilderCompat.mStyle;
if (style != null) {
style.apply(this);
}
RemoteViews makeContentView = style != null ? style.makeContentView(this) : null;
Notification buildInternal = buildInternal();
if (makeContentView != null) {
buildInternal.contentView = makeContentView;
} else {
RemoteViews remoteViews = this.mBuilderCompat.mContentView;
if (remoteViews != null) {
buildInternal.contentView = remoteViews;
}
}
if (style != null && (makeBigContentView = style.makeBigContentView(this)) != null) {
buildInternal.bigContentView = makeBigContentView;
}
if (style != null && (makeHeadsUpContentView = this.mBuilderCompat.mStyle.makeHeadsUpContentView(this)) != null) {
buildInternal.headsUpContentView = makeHeadsUpContentView;
}
if (style != null && (extras = NotificationCompat.getExtras(buildInternal)) != null) {
style.addCompatExtras(extras);
}
return buildInternal;
}
private void addAction(NotificationCompat.Action action) {
Bundle bundle;
IconCompat iconCompat = action.getIconCompat();
Notification.Action.Builder createBuilder = Api23Impl.createBuilder(iconCompat != null ? iconCompat.toIcon() : null, action.getTitle(), action.getActionIntent());
if (action.getRemoteInputs() != null) {
for (android.app.RemoteInput remoteInput : RemoteInput.fromCompat(action.getRemoteInputs())) {
Api20Impl.addRemoteInput(createBuilder, remoteInput);
}
}
if (action.getExtras() != null) {
bundle = new Bundle(action.getExtras());
} else {
bundle = new Bundle();
}
bundle.putBoolean("android.support.allowGeneratedReplies", action.getAllowGeneratedReplies());
int i = Build.VERSION.SDK_INT;
Api24Impl.setAllowGeneratedReplies(createBuilder, action.getAllowGeneratedReplies());
bundle.putInt("android.support.action.semanticAction", action.getSemanticAction());
if (i >= 28) {
Api28Impl.setSemanticAction(createBuilder, action.getSemanticAction());
}
if (i >= 29) {
Api29Impl.setContextual(createBuilder, action.isContextual());
}
if (i >= 31) {
Api31Impl.setAuthenticationRequired(createBuilder, action.isAuthenticationRequired());
}
bundle.putBoolean("android.support.action.showsUserInterface", action.getShowsUserInterface());
Api20Impl.addExtras(createBuilder, bundle);
Api20Impl.addAction(this.mBuilder, Api20Impl.build(createBuilder));
}
public Notification buildInternal() {
return this.mBuilder.build();
}
private void removeSoundAndVibration(Notification notification) {
notification.sound = null;
notification.vibrate = null;
notification.defaults &= -4;
}
@RequiresApi(20)
public static class Api20Impl {
private Api20Impl() {
}
public static Notification.Action.Builder createBuilder(int i, CharSequence charSequence, PendingIntent pendingIntent) {
return new Notification.Action.Builder(i, charSequence, pendingIntent);
}
public static Notification.Action.Builder addRemoteInput(Notification.Action.Builder builder, android.app.RemoteInput remoteInput) {
return builder.addRemoteInput(remoteInput);
}
public static Notification.Action.Builder addExtras(Notification.Action.Builder builder, Bundle bundle) {
return builder.addExtras(bundle);
}
public static Notification.Builder addAction(Notification.Builder builder, Notification.Action action) {
return builder.addAction(action);
}
public static Notification.Action build(Notification.Action.Builder builder) {
return builder.build();
}
public static String getGroup(Notification notification) {
return notification.getGroup();
}
public static Notification.Builder setGroup(Notification.Builder builder, String str) {
return builder.setGroup(str);
}
public static Notification.Builder setGroupSummary(Notification.Builder builder, boolean z) {
return builder.setGroupSummary(z);
}
public static Notification.Builder setLocalOnly(Notification.Builder builder, boolean z) {
return builder.setLocalOnly(z);
}
public static Notification.Builder setSortKey(Notification.Builder builder, String str) {
return builder.setSortKey(str);
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static Notification.Builder addPerson(Notification.Builder builder, String str) {
return builder.addPerson(str);
}
public static Notification.Builder setCategory(Notification.Builder builder, String str) {
return builder.setCategory(str);
}
public static Notification.Builder setColor(Notification.Builder builder, int i) {
return builder.setColor(i);
}
public static Notification.Builder setVisibility(Notification.Builder builder, int i) {
return builder.setVisibility(i);
}
public static Notification.Builder setPublicVersion(Notification.Builder builder, Notification notification) {
return builder.setPublicVersion(notification);
}
public static Notification.Builder setSound(Notification.Builder builder, Uri uri, Object obj) {
return builder.setSound(uri, (AudioAttributes) obj);
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static Notification.Action.Builder createBuilder(Icon icon, CharSequence charSequence, PendingIntent pendingIntent) {
return new Notification.Action.Builder(icon, charSequence, pendingIntent);
}
public static Notification.Builder setSmallIcon(Notification.Builder builder, Object obj) {
return builder.setSmallIcon((Icon) obj);
}
public static Notification.Builder setLargeIcon(Notification.Builder builder, Icon icon) {
return builder.setLargeIcon(icon);
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static Notification.Action.Builder setAllowGeneratedReplies(Notification.Action.Builder builder, boolean z) {
return builder.setAllowGeneratedReplies(z);
}
public static Notification.Builder setRemoteInputHistory(Notification.Builder builder, CharSequence[] charSequenceArr) {
return builder.setRemoteInputHistory(charSequenceArr);
}
public static Notification.Builder setCustomContentView(Notification.Builder builder, RemoteViews remoteViews) {
return builder.setCustomContentView(remoteViews);
}
public static Notification.Builder setCustomBigContentView(Notification.Builder builder, RemoteViews remoteViews) {
return builder.setCustomBigContentView(remoteViews);
}
public static Notification.Builder setCustomHeadsUpContentView(Notification.Builder builder, RemoteViews remoteViews) {
return builder.setCustomHeadsUpContentView(remoteViews);
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static Notification.Builder createBuilder(Context context, String str) {
return new Notification.Builder(context, str);
}
public static Notification.Builder setGroupAlertBehavior(Notification.Builder builder, int i) {
return builder.setGroupAlertBehavior(i);
}
public static Notification.Builder setColorized(Notification.Builder builder, boolean z) {
return builder.setColorized(z);
}
public static Notification.Builder setBadgeIconType(Notification.Builder builder, int i) {
return builder.setBadgeIconType(i);
}
public static Notification.Builder setSettingsText(Notification.Builder builder, CharSequence charSequence) {
return builder.setSettingsText(charSequence);
}
public static Notification.Builder setShortcutId(Notification.Builder builder, String str) {
return builder.setShortcutId(str);
}
public static Notification.Builder setTimeoutAfter(Notification.Builder builder, long j) {
return builder.setTimeoutAfter(j);
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static Notification.Action.Builder setSemanticAction(Notification.Action.Builder builder, int i) {
return builder.setSemanticAction(i);
}
public static Notification.Builder addPerson(Notification.Builder builder, android.app.Person person) {
return builder.addPerson(person);
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static Notification.Action.Builder setContextual(Notification.Action.Builder builder, boolean z) {
return builder.setContextual(z);
}
public static Notification.Builder setLocusId(Notification.Builder builder, Object obj) {
return builder.setLocusId((LocusId) obj);
}
public static Notification.Builder setBubbleMetadata(Notification.Builder builder, Notification.BubbleMetadata bubbleMetadata) {
return builder.setBubbleMetadata(bubbleMetadata);
}
public static Notification.Builder setAllowSystemGeneratedContextualActions(Notification.Builder builder, boolean z) {
return builder.setAllowSystemGeneratedContextualActions(z);
}
}
@RequiresApi(31)
public static class Api31Impl {
private Api31Impl() {
}
public static Notification.Action.Builder setAuthenticationRequired(Notification.Action.Builder builder, boolean z) {
return builder.setAuthenticationRequired(z);
}
public static Notification.Builder setForegroundServiceBehavior(Notification.Builder builder, int i) {
return builder.setForegroundServiceBehavior(i);
}
}
}

View File

@@ -0,0 +1,14 @@
package androidx.core.app;
/* loaded from: classes.dex */
public final class NotificationCompatExtras {
public static final String EXTRA_ACTION_EXTRAS = "android.support.actionExtras";
public static final String EXTRA_GROUP_KEY = "android.support.groupKey";
public static final String EXTRA_GROUP_SUMMARY = "android.support.isGroupSummary";
public static final String EXTRA_LOCAL_ONLY = "android.support.localOnly";
public static final String EXTRA_REMOTE_INPUTS = "android.support.remoteInputs";
public static final String EXTRA_SORT_KEY = "android.support.sortKey";
private NotificationCompatExtras() {
}
}

View File

@@ -0,0 +1,290 @@
package androidx.core.app;
import android.app.Notification;
import android.app.PendingIntent;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.util.SparseArray;
import androidx.core.app.NotificationCompat;
import androidx.core.graphics.drawable.IconCompat;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/* loaded from: classes.dex */
class NotificationCompatJellybean {
static final String EXTRA_ALLOW_GENERATED_REPLIES = "android.support.allowGeneratedReplies";
static final String EXTRA_DATA_ONLY_REMOTE_INPUTS = "android.support.dataRemoteInputs";
private static final String KEY_ACTION_INTENT = "actionIntent";
private static final String KEY_ALLOWED_DATA_TYPES = "allowedDataTypes";
private static final String KEY_ALLOW_FREE_FORM_INPUT = "allowFreeFormInput";
private static final String KEY_CHOICES = "choices";
private static final String KEY_DATA_ONLY_REMOTE_INPUTS = "dataOnlyRemoteInputs";
private static final String KEY_EXTRAS = "extras";
private static final String KEY_ICON = "icon";
private static final String KEY_LABEL = "label";
private static final String KEY_REMOTE_INPUTS = "remoteInputs";
private static final String KEY_RESULT_KEY = "resultKey";
private static final String KEY_SEMANTIC_ACTION = "semanticAction";
private static final String KEY_SHOWS_USER_INTERFACE = "showsUserInterface";
private static final String KEY_TITLE = "title";
public static final String TAG = "NotificationCompat";
private static Field sActionIconField;
private static Field sActionIntentField;
private static Field sActionTitleField;
private static boolean sActionsAccessFailed;
private static Field sActionsField;
private static Field sExtrasField;
private static boolean sExtrasFieldAccessFailed;
private static final Object sExtrasLock = new Object();
private static final Object sActionsLock = new Object();
public static SparseArray<Bundle> buildActionExtrasMap(List<Bundle> list) {
int size = list.size();
SparseArray<Bundle> sparseArray = null;
for (int i = 0; i < size; i++) {
Bundle bundle = list.get(i);
if (bundle != null) {
if (sparseArray == null) {
sparseArray = new SparseArray<>();
}
sparseArray.put(i, bundle);
}
}
return sparseArray;
}
public static Bundle getExtras(Notification notification) {
synchronized (sExtrasLock) {
if (sExtrasFieldAccessFailed) {
return null;
}
try {
if (sExtrasField == null) {
Field declaredField = Notification.class.getDeclaredField("extras");
if (!Bundle.class.isAssignableFrom(declaredField.getType())) {
Log.e(TAG, "Notification.extras field is not of type Bundle");
sExtrasFieldAccessFailed = true;
return null;
}
declaredField.setAccessible(true);
sExtrasField = declaredField;
}
Bundle bundle = (Bundle) sExtrasField.get(notification);
if (bundle == null) {
bundle = new Bundle();
sExtrasField.set(notification, bundle);
}
return bundle;
} catch (IllegalAccessException e) {
Log.e(TAG, "Unable to access notification extras", e);
sExtrasFieldAccessFailed = true;
return null;
} catch (NoSuchFieldException e2) {
Log.e(TAG, "Unable to access notification extras", e2);
sExtrasFieldAccessFailed = true;
return null;
}
}
}
public static NotificationCompat.Action readAction(int i, CharSequence charSequence, PendingIntent pendingIntent, Bundle bundle) {
RemoteInput[] remoteInputArr;
RemoteInput[] remoteInputArr2;
boolean z;
if (bundle != null) {
remoteInputArr = fromBundleArray(getBundleArrayFromBundle(bundle, NotificationCompatExtras.EXTRA_REMOTE_INPUTS));
remoteInputArr2 = fromBundleArray(getBundleArrayFromBundle(bundle, EXTRA_DATA_ONLY_REMOTE_INPUTS));
z = bundle.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES);
} else {
remoteInputArr = null;
remoteInputArr2 = null;
z = false;
}
return new NotificationCompat.Action(i, charSequence, pendingIntent, bundle, remoteInputArr, remoteInputArr2, z, 0, true, false, false);
}
public static Bundle writeActionAndGetExtras(Notification.Builder builder, NotificationCompat.Action action) {
IconCompat iconCompat = action.getIconCompat();
builder.addAction(iconCompat != null ? iconCompat.getResId() : 0, action.getTitle(), action.getActionIntent());
Bundle bundle = new Bundle(action.getExtras());
if (action.getRemoteInputs() != null) {
bundle.putParcelableArray(NotificationCompatExtras.EXTRA_REMOTE_INPUTS, toBundleArray(action.getRemoteInputs()));
}
if (action.getDataOnlyRemoteInputs() != null) {
bundle.putParcelableArray(EXTRA_DATA_ONLY_REMOTE_INPUTS, toBundleArray(action.getDataOnlyRemoteInputs()));
}
bundle.putBoolean(EXTRA_ALLOW_GENERATED_REPLIES, action.getAllowGeneratedReplies());
return bundle;
}
public static int getActionCount(Notification notification) {
int length;
synchronized (sActionsLock) {
try {
Object[] actionObjectsLocked = getActionObjectsLocked(notification);
length = actionObjectsLocked != null ? actionObjectsLocked.length : 0;
} catch (Throwable th) {
throw th;
}
}
return length;
}
public static NotificationCompat.Action getAction(Notification notification, int i) {
SparseArray sparseParcelableArray;
synchronized (sActionsLock) {
try {
try {
Object[] actionObjectsLocked = getActionObjectsLocked(notification);
if (actionObjectsLocked != null) {
Object obj = actionObjectsLocked[i];
Bundle extras = getExtras(notification);
return readAction(sActionIconField.getInt(obj), (CharSequence) sActionTitleField.get(obj), (PendingIntent) sActionIntentField.get(obj), (extras == null || (sparseParcelableArray = extras.getSparseParcelableArray(NotificationCompatExtras.EXTRA_ACTION_EXTRAS)) == null) ? null : (Bundle) sparseParcelableArray.get(i));
}
} catch (IllegalAccessException e) {
Log.e(TAG, "Unable to access notification actions", e);
sActionsAccessFailed = true;
}
return null;
} catch (Throwable th) {
throw th;
}
}
}
private static Object[] getActionObjectsLocked(Notification notification) {
synchronized (sActionsLock) {
if (!ensureActionReflectionReadyLocked()) {
return null;
}
try {
return (Object[]) sActionsField.get(notification);
} catch (IllegalAccessException e) {
Log.e(TAG, "Unable to access notification actions", e);
sActionsAccessFailed = true;
return null;
}
}
}
private static boolean ensureActionReflectionReadyLocked() {
if (sActionsAccessFailed) {
return false;
}
try {
if (sActionsField == null) {
Class<?> cls = Class.forName("android.app.Notification$Action");
sActionIconField = cls.getDeclaredField("icon");
sActionTitleField = cls.getDeclaredField("title");
sActionIntentField = cls.getDeclaredField(KEY_ACTION_INTENT);
Field declaredField = Notification.class.getDeclaredField("actions");
sActionsField = declaredField;
declaredField.setAccessible(true);
}
} catch (ClassNotFoundException e) {
Log.e(TAG, "Unable to access notification actions", e);
sActionsAccessFailed = true;
} catch (NoSuchFieldException e2) {
Log.e(TAG, "Unable to access notification actions", e2);
sActionsAccessFailed = true;
}
return !sActionsAccessFailed;
}
public static NotificationCompat.Action getActionFromBundle(Bundle bundle) {
Bundle bundle2 = bundle.getBundle("extras");
return new NotificationCompat.Action(bundle.getInt("icon"), bundle.getCharSequence("title"), (PendingIntent) bundle.getParcelable(KEY_ACTION_INTENT), bundle.getBundle("extras"), fromBundleArray(getBundleArrayFromBundle(bundle, KEY_REMOTE_INPUTS)), fromBundleArray(getBundleArrayFromBundle(bundle, KEY_DATA_ONLY_REMOTE_INPUTS)), bundle2 != null ? bundle2.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES, false) : false, bundle.getInt(KEY_SEMANTIC_ACTION), bundle.getBoolean(KEY_SHOWS_USER_INTERFACE), false, false);
}
public static Bundle getBundleForAction(NotificationCompat.Action action) {
Bundle bundle;
Bundle bundle2 = new Bundle();
IconCompat iconCompat = action.getIconCompat();
bundle2.putInt("icon", iconCompat != null ? iconCompat.getResId() : 0);
bundle2.putCharSequence("title", action.getTitle());
bundle2.putParcelable(KEY_ACTION_INTENT, action.getActionIntent());
if (action.getExtras() != null) {
bundle = new Bundle(action.getExtras());
} else {
bundle = new Bundle();
}
bundle.putBoolean(EXTRA_ALLOW_GENERATED_REPLIES, action.getAllowGeneratedReplies());
bundle2.putBundle("extras", bundle);
bundle2.putParcelableArray(KEY_REMOTE_INPUTS, toBundleArray(action.getRemoteInputs()));
bundle2.putBoolean(KEY_SHOWS_USER_INTERFACE, action.getShowsUserInterface());
bundle2.putInt(KEY_SEMANTIC_ACTION, action.getSemanticAction());
return bundle2;
}
private static RemoteInput fromBundle(Bundle bundle) {
ArrayList<String> stringArrayList = bundle.getStringArrayList(KEY_ALLOWED_DATA_TYPES);
HashSet hashSet = new HashSet();
if (stringArrayList != null) {
Iterator<String> it = stringArrayList.iterator();
while (it.hasNext()) {
hashSet.add(it.next());
}
}
return new RemoteInput(bundle.getString(KEY_RESULT_KEY), bundle.getCharSequence("label"), bundle.getCharSequenceArray(KEY_CHOICES), bundle.getBoolean(KEY_ALLOW_FREE_FORM_INPUT), 0, bundle.getBundle("extras"), hashSet);
}
private static Bundle toBundle(RemoteInput remoteInput) {
Bundle bundle = new Bundle();
bundle.putString(KEY_RESULT_KEY, remoteInput.getResultKey());
bundle.putCharSequence("label", remoteInput.getLabel());
bundle.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices());
bundle.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput());
bundle.putBundle("extras", remoteInput.getExtras());
Set<String> allowedDataTypes = remoteInput.getAllowedDataTypes();
if (allowedDataTypes != null && !allowedDataTypes.isEmpty()) {
ArrayList<String> arrayList = new ArrayList<>(allowedDataTypes.size());
Iterator<String> it = allowedDataTypes.iterator();
while (it.hasNext()) {
arrayList.add(it.next());
}
bundle.putStringArrayList(KEY_ALLOWED_DATA_TYPES, arrayList);
}
return bundle;
}
private static RemoteInput[] fromBundleArray(Bundle[] bundleArr) {
if (bundleArr == null) {
return null;
}
RemoteInput[] remoteInputArr = new RemoteInput[bundleArr.length];
for (int i = 0; i < bundleArr.length; i++) {
remoteInputArr[i] = fromBundle(bundleArr[i]);
}
return remoteInputArr;
}
private static Bundle[] toBundleArray(RemoteInput[] remoteInputArr) {
if (remoteInputArr == null) {
return null;
}
Bundle[] bundleArr = new Bundle[remoteInputArr.length];
for (int i = 0; i < remoteInputArr.length; i++) {
bundleArr[i] = toBundle(remoteInputArr[i]);
}
return bundleArr;
}
private static Bundle[] getBundleArrayFromBundle(Bundle bundle, String str) {
Parcelable[] parcelableArray = bundle.getParcelableArray(str);
if ((parcelableArray instanceof Bundle[]) || parcelableArray == null) {
return (Bundle[]) parcelableArray;
}
Bundle[] bundleArr = (Bundle[]) Arrays.copyOf(parcelableArray, parcelableArray.length, Bundle[].class);
bundle.putParcelableArray(str, bundleArr);
return bundleArr;
}
private NotificationCompatJellybean() {
}
}

View File

@@ -0,0 +1,73 @@
package androidx.core.app;
import android.app.Notification;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v4.app.INotificationSideChannel;
import androidx.annotation.DeprecatedSinceApi;
/* loaded from: classes.dex */
public abstract class NotificationCompatSideChannelService extends Service {
public abstract void cancel(String str, int i, String str2);
public abstract void cancelAll(String str);
public abstract void notify(String str, int i, String str2, Notification notification);
@Override // android.app.Service
@DeprecatedSinceApi(api = 19, message = "SDKs past 19 have no need for side channeling.")
public IBinder onBind(Intent intent) {
intent.getAction().equals(NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL);
return null;
}
public class NotificationSideChannelStub extends INotificationSideChannel.Stub {
public NotificationSideChannelStub() {
}
@Override // android.support.v4.app.INotificationSideChannel
public void notify(String str, int i, String str2, Notification notification) throws RemoteException {
NotificationCompatSideChannelService.this.checkPermission(Binder.getCallingUid(), str);
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
NotificationCompatSideChannelService.this.notify(str, i, str2, notification);
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
@Override // android.support.v4.app.INotificationSideChannel
public void cancel(String str, int i, String str2) throws RemoteException {
NotificationCompatSideChannelService.this.checkPermission(Binder.getCallingUid(), str);
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
NotificationCompatSideChannelService.this.cancel(str, i, str2);
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
@Override // android.support.v4.app.INotificationSideChannel
public void cancelAll(String str) {
NotificationCompatSideChannelService.this.checkPermission(Binder.getCallingUid(), str);
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
NotificationCompatSideChannelService.this.cancelAll(str);
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
}
public void checkPermission(int i, String str) {
for (String str2 : getPackageManager().getPackagesForUid(i)) {
if (str2.equals(str)) {
return;
}
}
throw new SecurityException("NotificationSideChannelService: Uid " + i + " is not authorized for package " + str);
}
}

View File

@@ -0,0 +1,836 @@
package androidx.core.app;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.support.v4.app.INotificationSideChannel;
import android.util.Log;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RequiresPermission;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.internal.security.CertificateUtil;
import com.ironsource.v8;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class NotificationManagerCompat {
public static final String ACTION_BIND_SIDE_CHANNEL = "android.support.BIND_NOTIFICATION_SIDE_CHANNEL";
private static final String CHECK_OP_NO_THROW = "checkOpNoThrow";
public static final String EXTRA_USE_SIDE_CHANNEL = "android.support.useSideChannel";
public static final int IMPORTANCE_DEFAULT = 3;
public static final int IMPORTANCE_HIGH = 4;
public static final int IMPORTANCE_LOW = 2;
public static final int IMPORTANCE_MAX = 5;
public static final int IMPORTANCE_MIN = 1;
public static final int IMPORTANCE_NONE = 0;
public static final int IMPORTANCE_UNSPECIFIED = -1000;
public static final int INTERRUPTION_FILTER_ALARMS = 4;
public static final int INTERRUPTION_FILTER_ALL = 1;
public static final int INTERRUPTION_FILTER_NONE = 3;
public static final int INTERRUPTION_FILTER_PRIORITY = 2;
public static final int INTERRUPTION_FILTER_UNKNOWN = 0;
static final int MAX_SIDE_CHANNEL_SDK_VERSION = 19;
private static final String OP_POST_NOTIFICATION = "OP_POST_NOTIFICATION";
private static final String SETTING_ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
private static final int SIDE_CHANNEL_RETRY_BASE_INTERVAL_MS = 1000;
private static final int SIDE_CHANNEL_RETRY_MAX_COUNT = 6;
private static final String TAG = "NotifManCompat";
@GuardedBy("sEnabledNotificationListenersLock")
private static String sEnabledNotificationListeners;
@GuardedBy("sLock")
private static SideChannelManager sSideChannelManager;
private final Context mContext;
private final NotificationManager mNotificationManager;
private static final Object sEnabledNotificationListenersLock = new Object();
@GuardedBy("sEnabledNotificationListenersLock")
private static Set<String> sEnabledNotificationListenerPackages = new HashSet();
private static final Object sLock = new Object();
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface InterruptionFilter {
}
public interface Task {
void send(INotificationSideChannel iNotificationSideChannel) throws RemoteException;
}
@NonNull
public static NotificationManagerCompat from(@NonNull Context context) {
return new NotificationManagerCompat(context);
}
private NotificationManagerCompat(Context context) {
this.mContext = context;
this.mNotificationManager = (NotificationManager) context.getSystemService("notification");
}
@VisibleForTesting
public NotificationManagerCompat(@NonNull NotificationManager notificationManager, @NonNull Context context) {
this.mContext = context;
this.mNotificationManager = notificationManager;
}
public void cancel(int i) {
cancel(null, i);
}
public void cancel(@Nullable String str, int i) {
this.mNotificationManager.cancel(str, i);
}
public void cancelAll() {
this.mNotificationManager.cancelAll();
}
@RequiresPermission("android.permission.POST_NOTIFICATIONS")
public void notify(int i, @NonNull Notification notification) {
notify(null, i, notification);
}
@RequiresPermission("android.permission.POST_NOTIFICATIONS")
public void notify(@Nullable String str, int i, @NonNull Notification notification) {
if (useSideChannelForNotification(notification)) {
pushSideChannelQueue(new NotifyTask(this.mContext.getPackageName(), i, str, notification));
this.mNotificationManager.cancel(str, i);
} else {
this.mNotificationManager.notify(str, i, notification);
}
}
@RequiresPermission("android.permission.POST_NOTIFICATIONS")
public void notify(@NonNull List<NotificationWithIdAndTag> list) {
int size = list.size();
for (int i = 0; i < size; i++) {
NotificationWithIdAndTag notificationWithIdAndTag = list.get(i);
notify(notificationWithIdAndTag.mTag, notificationWithIdAndTag.mId, notificationWithIdAndTag.mNotification);
}
}
public static class NotificationWithIdAndTag {
final int mId;
Notification mNotification;
final String mTag;
public NotificationWithIdAndTag(@Nullable String str, int i, @NonNull Notification notification) {
this.mTag = str;
this.mId = i;
this.mNotification = notification;
}
public NotificationWithIdAndTag(int i, @NonNull Notification notification) {
this(null, i, notification);
}
}
@NonNull
public List<StatusBarNotification> getActiveNotifications() {
return Api23Impl.getActiveNotifications(this.mNotificationManager);
}
public boolean areNotificationsEnabled() {
return Api24Impl.areNotificationsEnabled(this.mNotificationManager);
}
public int getImportance() {
return Api24Impl.getImportance(this.mNotificationManager);
}
public void createNotificationChannel(@NonNull NotificationChannel notificationChannel) {
Api26Impl.createNotificationChannel(this.mNotificationManager, notificationChannel);
}
public void createNotificationChannel(@NonNull NotificationChannelCompat notificationChannelCompat) {
createNotificationChannel(notificationChannelCompat.getNotificationChannel());
}
public void createNotificationChannelGroup(@NonNull NotificationChannelGroup notificationChannelGroup) {
Api26Impl.createNotificationChannelGroup(this.mNotificationManager, notificationChannelGroup);
}
public void createNotificationChannelGroup(@NonNull NotificationChannelGroupCompat notificationChannelGroupCompat) {
createNotificationChannelGroup(notificationChannelGroupCompat.getNotificationChannelGroup());
}
public void createNotificationChannels(@NonNull List<NotificationChannel> list) {
Api26Impl.createNotificationChannels(this.mNotificationManager, list);
}
public void createNotificationChannelsCompat(@NonNull List<NotificationChannelCompat> list) {
if (list.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList(list.size());
Iterator<NotificationChannelCompat> it = list.iterator();
while (it.hasNext()) {
arrayList.add(it.next().getNotificationChannel());
}
Api26Impl.createNotificationChannels(this.mNotificationManager, arrayList);
}
public void createNotificationChannelGroups(@NonNull List<NotificationChannelGroup> list) {
Api26Impl.createNotificationChannelGroups(this.mNotificationManager, list);
}
public void createNotificationChannelGroupsCompat(@NonNull List<NotificationChannelGroupCompat> list) {
if (list.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList(list.size());
Iterator<NotificationChannelGroupCompat> it = list.iterator();
while (it.hasNext()) {
arrayList.add(it.next().getNotificationChannelGroup());
}
Api26Impl.createNotificationChannelGroups(this.mNotificationManager, arrayList);
}
public void deleteNotificationChannel(@NonNull String str) {
Api26Impl.deleteNotificationChannel(this.mNotificationManager, str);
}
public void deleteNotificationChannelGroup(@NonNull String str) {
Api26Impl.deleteNotificationChannelGroup(this.mNotificationManager, str);
}
public void deleteUnlistedNotificationChannels(@NonNull Collection<String> collection) {
for (NotificationChannel notificationChannel : Api26Impl.getNotificationChannels(this.mNotificationManager)) {
if (!collection.contains(Api26Impl.getId(notificationChannel)) && (Build.VERSION.SDK_INT < 30 || !collection.contains(Api30Impl.getParentChannelId(notificationChannel)))) {
Api26Impl.deleteNotificationChannel(this.mNotificationManager, Api26Impl.getId(notificationChannel));
}
}
}
@Nullable
public NotificationChannel getNotificationChannel(@NonNull String str) {
return Api26Impl.getNotificationChannel(this.mNotificationManager, str);
}
@Nullable
public NotificationChannelCompat getNotificationChannelCompat(@NonNull String str) {
NotificationChannel notificationChannel = getNotificationChannel(str);
if (notificationChannel != null) {
return new NotificationChannelCompat(notificationChannel);
}
return null;
}
@Nullable
public NotificationChannel getNotificationChannel(@NonNull String str, @NonNull String str2) {
if (Build.VERSION.SDK_INT >= 30) {
return Api30Impl.getNotificationChannel(this.mNotificationManager, str, str2);
}
return getNotificationChannel(str);
}
@Nullable
public NotificationChannelCompat getNotificationChannelCompat(@NonNull String str, @NonNull String str2) {
NotificationChannel notificationChannel = getNotificationChannel(str, str2);
if (notificationChannel != null) {
return new NotificationChannelCompat(notificationChannel);
}
return null;
}
@Nullable
public NotificationChannelGroup getNotificationChannelGroup(@NonNull String str) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getNotificationChannelGroup(this.mNotificationManager, str);
}
for (NotificationChannelGroup notificationChannelGroup : getNotificationChannelGroups()) {
if (Api26Impl.getId(notificationChannelGroup).equals(str)) {
return notificationChannelGroup;
}
}
return null;
}
@Nullable
public NotificationChannelGroupCompat getNotificationChannelGroupCompat(@NonNull String str) {
if (Build.VERSION.SDK_INT >= 28) {
NotificationChannelGroup notificationChannelGroup = getNotificationChannelGroup(str);
if (notificationChannelGroup != null) {
return new NotificationChannelGroupCompat(notificationChannelGroup);
}
return null;
}
NotificationChannelGroup notificationChannelGroup2 = getNotificationChannelGroup(str);
if (notificationChannelGroup2 != null) {
return new NotificationChannelGroupCompat(notificationChannelGroup2, getNotificationChannels());
}
return null;
}
@NonNull
public List<NotificationChannel> getNotificationChannels() {
return Api26Impl.getNotificationChannels(this.mNotificationManager);
}
@NonNull
public List<NotificationChannelCompat> getNotificationChannelsCompat() {
List<NotificationChannel> notificationChannels = getNotificationChannels();
if (!notificationChannels.isEmpty()) {
ArrayList arrayList = new ArrayList(notificationChannels.size());
Iterator<NotificationChannel> it = notificationChannels.iterator();
while (it.hasNext()) {
arrayList.add(new NotificationChannelCompat(it.next()));
}
return arrayList;
}
return Collections.emptyList();
}
@NonNull
public List<NotificationChannelGroup> getNotificationChannelGroups() {
return Api26Impl.getNotificationChannelGroups(this.mNotificationManager);
}
@NonNull
public List<NotificationChannelGroupCompat> getNotificationChannelGroupsCompat() {
List<NotificationChannel> notificationChannels;
int i = Build.VERSION.SDK_INT;
List<NotificationChannelGroup> notificationChannelGroups = getNotificationChannelGroups();
if (!notificationChannelGroups.isEmpty()) {
if (i >= 28) {
notificationChannels = Collections.emptyList();
} else {
notificationChannels = getNotificationChannels();
}
ArrayList arrayList = new ArrayList(notificationChannelGroups.size());
for (NotificationChannelGroup notificationChannelGroup : notificationChannelGroups) {
if (Build.VERSION.SDK_INT >= 28) {
arrayList.add(new NotificationChannelGroupCompat(notificationChannelGroup));
} else {
arrayList.add(new NotificationChannelGroupCompat(notificationChannelGroup, notificationChannels));
}
}
return arrayList;
}
return Collections.emptyList();
}
@NonNull
public static Set<String> getEnabledListenerPackages(@NonNull Context context) {
Set<String> set;
String string = Settings.Secure.getString(context.getContentResolver(), SETTING_ENABLED_NOTIFICATION_LISTENERS);
synchronized (sEnabledNotificationListenersLock) {
if (string != null) {
try {
if (!string.equals(sEnabledNotificationListeners)) {
String[] split = string.split(CertificateUtil.DELIMITER, -1);
HashSet hashSet = new HashSet(split.length);
for (String str : split) {
ComponentName unflattenFromString = ComponentName.unflattenFromString(str);
if (unflattenFromString != null) {
hashSet.add(unflattenFromString.getPackageName());
}
}
sEnabledNotificationListenerPackages = hashSet;
sEnabledNotificationListeners = string;
}
} catch (Throwable th) {
throw th;
}
}
set = sEnabledNotificationListenerPackages;
}
return set;
}
public boolean canUseFullScreenIntent() {
int i = Build.VERSION.SDK_INT;
if (i < 29) {
return true;
}
if (i < 34) {
return this.mContext.checkSelfPermission("android.permission.USE_FULL_SCREEN_INTENT") == 0;
}
return Api34Impl.canUseFullScreenIntent(this.mNotificationManager);
}
private static boolean useSideChannelForNotification(Notification notification) {
Bundle extras = NotificationCompat.getExtras(notification);
return extras != null && extras.getBoolean(EXTRA_USE_SIDE_CHANNEL);
}
public int getCurrentInterruptionFilter() {
return Api23Impl.getCurrentInterruptionFilter(this.mNotificationManager);
}
private void pushSideChannelQueue(Task task) {
synchronized (sLock) {
try {
if (sSideChannelManager == null) {
sSideChannelManager = new SideChannelManager(this.mContext.getApplicationContext());
}
sSideChannelManager.queueTask(task);
} catch (Throwable th) {
throw th;
}
}
}
public static class SideChannelManager implements Handler.Callback, ServiceConnection {
private static final int MSG_QUEUE_TASK = 0;
private static final int MSG_RETRY_LISTENER_QUEUE = 3;
private static final int MSG_SERVICE_CONNECTED = 1;
private static final int MSG_SERVICE_DISCONNECTED = 2;
private final Context mContext;
private final Handler mHandler;
private final HandlerThread mHandlerThread;
private final Map<ComponentName, ListenerRecord> mRecordMap = new HashMap();
private Set<String> mCachedEnabledPackages = new HashSet();
public SideChannelManager(Context context) {
this.mContext = context;
HandlerThread handlerThread = new HandlerThread("NotificationManagerCompat");
this.mHandlerThread = handlerThread;
handlerThread.start();
this.mHandler = new Handler(handlerThread.getLooper(), this);
}
public void queueTask(Task task) {
this.mHandler.obtainMessage(0, task).sendToTarget();
}
@Override // android.os.Handler.Callback
public boolean handleMessage(Message message) {
int i = message.what;
if (i == 0) {
handleQueueTask((Task) message.obj);
return true;
}
if (i == 1) {
ServiceConnectedEvent serviceConnectedEvent = (ServiceConnectedEvent) message.obj;
handleServiceConnected(serviceConnectedEvent.componentName, serviceConnectedEvent.iBinder);
return true;
}
if (i == 2) {
handleServiceDisconnected((ComponentName) message.obj);
return true;
}
if (i != 3) {
return false;
}
handleRetryListenerQueue((ComponentName) message.obj);
return true;
}
private void handleQueueTask(Task task) {
updateListenerMap();
for (ListenerRecord listenerRecord : this.mRecordMap.values()) {
listenerRecord.taskQueue.add(task);
processListenerQueue(listenerRecord);
}
}
private void handleServiceConnected(ComponentName componentName, IBinder iBinder) {
ListenerRecord listenerRecord = this.mRecordMap.get(componentName);
if (listenerRecord != null) {
listenerRecord.service = INotificationSideChannel.Stub.asInterface(iBinder);
listenerRecord.retryCount = 0;
processListenerQueue(listenerRecord);
}
}
private void handleServiceDisconnected(ComponentName componentName) {
ListenerRecord listenerRecord = this.mRecordMap.get(componentName);
if (listenerRecord != null) {
ensureServiceUnbound(listenerRecord);
}
}
private void handleRetryListenerQueue(ComponentName componentName) {
ListenerRecord listenerRecord = this.mRecordMap.get(componentName);
if (listenerRecord != null) {
processListenerQueue(listenerRecord);
}
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Connected to service ");
sb.append(componentName);
}
this.mHandler.obtainMessage(1, new ServiceConnectedEvent(componentName, iBinder)).sendToTarget();
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Disconnected from service ");
sb.append(componentName);
}
this.mHandler.obtainMessage(2, componentName).sendToTarget();
}
private void updateListenerMap() {
Set<String> enabledListenerPackages = NotificationManagerCompat.getEnabledListenerPackages(this.mContext);
if (enabledListenerPackages.equals(this.mCachedEnabledPackages)) {
return;
}
this.mCachedEnabledPackages = enabledListenerPackages;
List<ResolveInfo> queryIntentServices = this.mContext.getPackageManager().queryIntentServices(new Intent().setAction(NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL), 0);
HashSet<ComponentName> hashSet = new HashSet();
for (ResolveInfo resolveInfo : queryIntentServices) {
if (enabledListenerPackages.contains(resolveInfo.serviceInfo.packageName)) {
ServiceInfo serviceInfo = resolveInfo.serviceInfo;
ComponentName componentName = new ComponentName(serviceInfo.packageName, serviceInfo.name);
if (resolveInfo.serviceInfo.permission != null) {
Log.w(NotificationManagerCompat.TAG, "Permission present on component " + componentName + ", not adding listener record.");
} else {
hashSet.add(componentName);
}
}
}
for (ComponentName componentName2 : hashSet) {
if (!this.mRecordMap.containsKey(componentName2)) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Adding listener record for ");
sb.append(componentName2);
}
this.mRecordMap.put(componentName2, new ListenerRecord(componentName2));
}
}
Iterator<Map.Entry<ComponentName, ListenerRecord>> it = this.mRecordMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<ComponentName, ListenerRecord> next = it.next();
if (!hashSet.contains(next.getKey())) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb2 = new StringBuilder();
sb2.append("Removing listener record for ");
sb2.append(next.getKey());
}
ensureServiceUnbound(next.getValue());
it.remove();
}
}
}
private boolean ensureServiceBound(ListenerRecord listenerRecord) {
if (listenerRecord.bound) {
return true;
}
boolean bindService = this.mContext.bindService(new Intent(NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL).setComponent(listenerRecord.componentName), this, 33);
listenerRecord.bound = bindService;
if (bindService) {
listenerRecord.retryCount = 0;
} else {
Log.w(NotificationManagerCompat.TAG, "Unable to bind to listener " + listenerRecord.componentName);
this.mContext.unbindService(this);
}
return listenerRecord.bound;
}
private void ensureServiceUnbound(ListenerRecord listenerRecord) {
if (listenerRecord.bound) {
this.mContext.unbindService(this);
listenerRecord.bound = false;
}
listenerRecord.service = null;
}
private void scheduleListenerRetry(ListenerRecord listenerRecord) {
if (this.mHandler.hasMessages(3, listenerRecord.componentName)) {
return;
}
int i = listenerRecord.retryCount;
int i2 = i + 1;
listenerRecord.retryCount = i2;
if (i2 > 6) {
Log.w(NotificationManagerCompat.TAG, "Giving up on delivering " + listenerRecord.taskQueue.size() + " tasks to " + listenerRecord.componentName + " after " + listenerRecord.retryCount + " retries");
listenerRecord.taskQueue.clear();
return;
}
int i3 = (1 << i) * 1000;
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Scheduling retry for ");
sb.append(i3);
sb.append(" ms");
}
this.mHandler.sendMessageDelayed(this.mHandler.obtainMessage(3, listenerRecord.componentName), i3);
}
private void processListenerQueue(ListenerRecord listenerRecord) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Processing component ");
sb.append(listenerRecord.componentName);
sb.append(", ");
sb.append(listenerRecord.taskQueue.size());
sb.append(" queued tasks");
}
if (listenerRecord.taskQueue.isEmpty()) {
return;
}
if (!ensureServiceBound(listenerRecord) || listenerRecord.service == null) {
scheduleListenerRetry(listenerRecord);
return;
}
while (true) {
Task peek = listenerRecord.taskQueue.peek();
if (peek == null) {
break;
}
try {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb2 = new StringBuilder();
sb2.append("Sending task ");
sb2.append(peek);
}
peek.send(listenerRecord.service);
listenerRecord.taskQueue.remove();
} catch (DeadObjectException unused) {
if (Log.isLoggable(NotificationManagerCompat.TAG, 3)) {
StringBuilder sb3 = new StringBuilder();
sb3.append("Remote service has died: ");
sb3.append(listenerRecord.componentName);
}
} catch (RemoteException e) {
Log.w(NotificationManagerCompat.TAG, "RemoteException communicating with " + listenerRecord.componentName, e);
}
}
if (listenerRecord.taskQueue.isEmpty()) {
return;
}
scheduleListenerRetry(listenerRecord);
}
public static class ListenerRecord {
final ComponentName componentName;
INotificationSideChannel service;
boolean bound = false;
ArrayDeque<Task> taskQueue = new ArrayDeque<>();
int retryCount = 0;
public ListenerRecord(ComponentName componentName) {
this.componentName = componentName;
}
}
}
public static class ServiceConnectedEvent {
final ComponentName componentName;
final IBinder iBinder;
public ServiceConnectedEvent(ComponentName componentName, IBinder iBinder) {
this.componentName = componentName;
this.iBinder = iBinder;
}
}
public static class NotifyTask implements Task {
final int id;
final Notification notif;
final String packageName;
final String tag;
public NotifyTask(String str, int i, String str2, Notification notification) {
this.packageName = str;
this.id = i;
this.tag = str2;
this.notif = notification;
}
@Override // androidx.core.app.NotificationManagerCompat.Task
public void send(INotificationSideChannel iNotificationSideChannel) throws RemoteException {
iNotificationSideChannel.notify(this.packageName, this.id, this.tag, this.notif);
}
@NonNull
public String toString() {
return "NotifyTask[packageName:" + this.packageName + ", id:" + this.id + ", tag:" + this.tag + v8.i.e;
}
}
public static class CancelTask implements Task {
final boolean all;
final int id;
final String packageName;
final String tag;
public CancelTask(String str) {
this.packageName = str;
this.id = 0;
this.tag = null;
this.all = true;
}
public CancelTask(String str, int i, String str2) {
this.packageName = str;
this.id = i;
this.tag = str2;
this.all = false;
}
@Override // androidx.core.app.NotificationManagerCompat.Task
public void send(INotificationSideChannel iNotificationSideChannel) throws RemoteException {
if (this.all) {
iNotificationSideChannel.cancelAll(this.packageName);
} else {
iNotificationSideChannel.cancel(this.packageName, this.id, this.tag);
}
}
@NonNull
public String toString() {
return "CancelTask[packageName:" + this.packageName + ", id:" + this.id + ", tag:" + this.tag + ", all:" + this.all + v8.i.e;
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static List<StatusBarNotification> getActiveNotifications(NotificationManager notificationManager) {
StatusBarNotification[] activeNotifications = notificationManager.getActiveNotifications();
if (activeNotifications == null) {
return new ArrayList();
}
return Arrays.asList(activeNotifications);
}
public static int getCurrentInterruptionFilter(NotificationManager notificationManager) {
return notificationManager.getCurrentInterruptionFilter();
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static boolean areNotificationsEnabled(NotificationManager notificationManager) {
return notificationManager.areNotificationsEnabled();
}
public static int getImportance(NotificationManager notificationManager) {
return notificationManager.getImportance();
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static void createNotificationChannel(NotificationManager notificationManager, NotificationChannel notificationChannel) {
notificationManager.createNotificationChannel(notificationChannel);
}
public static NotificationChannel getNotificationChannel(NotificationManager notificationManager, String str) {
return notificationManager.getNotificationChannel(str);
}
public static void createNotificationChannels(NotificationManager notificationManager, List<NotificationChannel> list) {
notificationManager.createNotificationChannels(list);
}
public static List<NotificationChannel> getNotificationChannels(NotificationManager notificationManager) {
return notificationManager.getNotificationChannels();
}
public static void createNotificationChannelGroup(NotificationManager notificationManager, NotificationChannelGroup notificationChannelGroup) {
notificationManager.createNotificationChannelGroup(notificationChannelGroup);
}
public static void createNotificationChannelGroups(NotificationManager notificationManager, List<NotificationChannelGroup> list) {
notificationManager.createNotificationChannelGroups(list);
}
public static List<NotificationChannelGroup> getNotificationChannelGroups(NotificationManager notificationManager) {
return notificationManager.getNotificationChannelGroups();
}
public static void deleteNotificationChannel(NotificationManager notificationManager, String str) {
notificationManager.deleteNotificationChannel(str);
}
public static void deleteNotificationChannelGroup(NotificationManager notificationManager, String str) {
notificationManager.deleteNotificationChannelGroup(str);
}
public static String getId(NotificationChannel notificationChannel) {
return notificationChannel.getId();
}
public static String getId(NotificationChannelGroup notificationChannelGroup) {
return notificationChannelGroup.getId();
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static NotificationChannelGroup getNotificationChannelGroup(NotificationManager notificationManager, String str) {
return notificationManager.getNotificationChannelGroup(str);
}
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static String getParentChannelId(NotificationChannel notificationChannel) {
return notificationChannel.getParentChannelId();
}
public static NotificationChannel getNotificationChannel(NotificationManager notificationManager, String str, String str2) {
return notificationManager.getNotificationChannel(str, str2);
}
}
@RequiresApi(34)
public static class Api34Impl {
private Api34Impl() {
}
public static boolean canUseFullScreenIntent(NotificationManager notificationManager) {
return notificationManager.canUseFullScreenIntent();
}
}
}

View File

@@ -0,0 +1,10 @@
package androidx.core.app;
import androidx.core.util.Consumer;
/* loaded from: classes.dex */
public interface OnMultiWindowModeChangedProvider {
void addOnMultiWindowModeChangedListener(Consumer<MultiWindowModeChangedInfo> consumer);
void removeOnMultiWindowModeChangedListener(Consumer<MultiWindowModeChangedInfo> consumer);
}

View File

@@ -0,0 +1,11 @@
package androidx.core.app;
import android.content.Intent;
import androidx.core.util.Consumer;
/* loaded from: classes.dex */
public interface OnNewIntentProvider {
void addOnNewIntentListener(Consumer<Intent> consumer);
void removeOnNewIntentListener(Consumer<Intent> consumer);
}

View File

@@ -0,0 +1,10 @@
package androidx.core.app;
import androidx.core.util.Consumer;
/* loaded from: classes.dex */
public interface OnPictureInPictureModeChangedProvider {
void addOnPictureInPictureModeChangedListener(Consumer<PictureInPictureModeChangedInfo> consumer);
void removeOnPictureInPictureModeChangedListener(Consumer<PictureInPictureModeChangedInfo> consumer);
}

View File

@@ -0,0 +1,8 @@
package androidx.core.app;
/* loaded from: classes.dex */
public interface OnUserLeaveHintProvider {
void addOnUserLeaveHintListener(Runnable runnable);
void removeOnUserLeaveHintListener(Runnable runnable);
}

View File

@@ -0,0 +1,202 @@
package androidx.core.app;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.app.PendingIntentCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import java.io.Closeable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.CountDownLatch;
/* loaded from: classes.dex */
public final class PendingIntentCompat {
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface Flags {
}
private static int addMutabilityFlags(boolean z, int i) {
int i2;
if (!z) {
i2 = AccessibilityEventCompat.TYPE_VIEW_TARGETED_BY_SCROLL;
} else {
if (Build.VERSION.SDK_INT < 31) {
return i;
}
i2 = 33554432;
}
return i | i2;
}
@NonNull
public static PendingIntent getActivities(@NonNull Context context, int i, @NonNull @SuppressLint({"ArrayReturn"}) Intent[] intentArr, int i2, @Nullable Bundle bundle, boolean z) {
return PendingIntent.getActivities(context, i, intentArr, addMutabilityFlags(z, i2), bundle);
}
@NonNull
public static PendingIntent getActivities(@NonNull Context context, int i, @NonNull @SuppressLint({"ArrayReturn"}) Intent[] intentArr, int i2, boolean z) {
return PendingIntent.getActivities(context, i, intentArr, addMutabilityFlags(z, i2));
}
@Nullable
public static PendingIntent getActivity(@NonNull Context context, int i, @NonNull Intent intent, int i2, boolean z) {
return PendingIntent.getActivity(context, i, intent, addMutabilityFlags(z, i2));
}
@Nullable
public static PendingIntent getActivity(@NonNull Context context, int i, @NonNull Intent intent, int i2, @Nullable Bundle bundle, boolean z) {
return PendingIntent.getActivity(context, i, intent, addMutabilityFlags(z, i2), bundle);
}
@Nullable
public static PendingIntent getBroadcast(@NonNull Context context, int i, @NonNull Intent intent, int i2, boolean z) {
return PendingIntent.getBroadcast(context, i, intent, addMutabilityFlags(z, i2));
}
@NonNull
@RequiresApi(26)
public static PendingIntent getForegroundService(@NonNull Context context, int i, @NonNull Intent intent, int i2, boolean z) {
return Api26Impl.getForegroundService(context, i, intent, addMutabilityFlags(z, i2));
}
@Nullable
public static PendingIntent getService(@NonNull Context context, int i, @NonNull Intent intent, int i2, boolean z) {
return PendingIntent.getService(context, i, intent, addMutabilityFlags(z, i2));
}
@SuppressLint({"LambdaLast"})
public static void send(@NonNull PendingIntent pendingIntent, int i, @Nullable PendingIntent.OnFinished onFinished, @Nullable Handler handler) throws PendingIntent.CanceledException {
GatedCallback gatedCallback = new GatedCallback(onFinished);
try {
pendingIntent.send(i, gatedCallback.getCallback(), handler);
gatedCallback.complete();
gatedCallback.close();
} catch (Throwable th) {
try {
gatedCallback.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
throw th;
}
}
@SuppressLint({"LambdaLast"})
public static void send(@NonNull PendingIntent pendingIntent, @NonNull @SuppressLint({"ContextFirst"}) Context context, int i, @NonNull Intent intent, @Nullable PendingIntent.OnFinished onFinished, @Nullable Handler handler) throws PendingIntent.CanceledException {
send(pendingIntent, context, i, intent, onFinished, handler, null, null);
}
@SuppressLint({"LambdaLast"})
public static void send(@NonNull PendingIntent pendingIntent, @NonNull @SuppressLint({"ContextFirst"}) Context context, int i, @NonNull Intent intent, @Nullable PendingIntent.OnFinished onFinished, @Nullable Handler handler, @Nullable String str, @Nullable Bundle bundle) throws PendingIntent.CanceledException {
GatedCallback gatedCallback = new GatedCallback(onFinished);
try {
Api23Impl.send(pendingIntent, context, i, intent, onFinished, handler, str, bundle);
gatedCallback.complete();
gatedCallback.close();
} catch (Throwable th) {
try {
gatedCallback.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
throw th;
}
}
private PendingIntentCompat() {
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static void send(@NonNull PendingIntent pendingIntent, @NonNull Context context, int i, @NonNull Intent intent, @Nullable PendingIntent.OnFinished onFinished, @Nullable Handler handler, @Nullable String str, @Nullable Bundle bundle) throws PendingIntent.CanceledException {
pendingIntent.send(context, i, intent, onFinished, handler, str, bundle);
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static PendingIntent getForegroundService(Context context, int i, Intent intent, int i2) {
return PendingIntent.getForegroundService(context, i, intent, i2);
}
}
public static class GatedCallback implements Closeable {
@Nullable
private PendingIntent.OnFinished mCallback;
private final CountDownLatch mComplete = new CountDownLatch(1);
private boolean mSuccess = false;
public void complete() {
this.mSuccess = true;
}
public GatedCallback(@Nullable PendingIntent.OnFinished onFinished) {
this.mCallback = onFinished;
}
@Nullable
public PendingIntent.OnFinished getCallback() {
if (this.mCallback == null) {
return null;
}
return new PendingIntent.OnFinished() { // from class: androidx.core.app.PendingIntentCompat$GatedCallback$$ExternalSyntheticLambda0
@Override // android.app.PendingIntent.OnFinished
public final void onSendFinished(PendingIntent pendingIntent, Intent intent, int i, String str, Bundle bundle) {
PendingIntentCompat.GatedCallback.this.onSendFinished(pendingIntent, intent, i, str, bundle);
}
};
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (!this.mSuccess) {
this.mCallback = null;
}
this.mComplete.countDown();
}
/* JADX INFO: Access modifiers changed from: private */
public void onSendFinished(PendingIntent pendingIntent, Intent intent, int i, String str, Bundle bundle) {
boolean z = false;
while (true) {
try {
this.mComplete.await();
break;
} catch (InterruptedException unused) {
z = true;
} catch (Throwable th) {
if (z) {
Thread.currentThread().interrupt();
}
throw th;
}
}
if (z) {
Thread.currentThread().interrupt();
}
PendingIntent.OnFinished onFinished = this.mCallback;
if (onFinished != null) {
onFinished.onSendFinished(pendingIntent, intent, i, str, bundle);
this.mCallback = null;
}
}
}
}

View File

@@ -0,0 +1,263 @@
package androidx.core.app;
import android.app.Person;
import android.os.Bundle;
import android.os.PersistableBundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.IconCompat;
import java.util.Objects;
/* loaded from: classes.dex */
public class Person {
private static final String ICON_KEY = "icon";
private static final String IS_BOT_KEY = "isBot";
private static final String IS_IMPORTANT_KEY = "isImportant";
private static final String KEY_KEY = "key";
private static final String NAME_KEY = "name";
private static final String URI_KEY = "uri";
@Nullable
IconCompat mIcon;
boolean mIsBot;
boolean mIsImportant;
@Nullable
String mKey;
@Nullable
CharSequence mName;
@Nullable
String mUri;
@Nullable
public IconCompat getIcon() {
return this.mIcon;
}
@Nullable
public String getKey() {
return this.mKey;
}
@Nullable
public CharSequence getName() {
return this.mName;
}
@Nullable
public String getUri() {
return this.mUri;
}
public boolean isBot() {
return this.mIsBot;
}
public boolean isImportant() {
return this.mIsImportant;
}
@NonNull
public static Person fromBundle(@NonNull Bundle bundle) {
Bundle bundle2 = bundle.getBundle("icon");
return new Builder().setName(bundle.getCharSequence("name")).setIcon(bundle2 != null ? IconCompat.createFromBundle(bundle2) : null).setUri(bundle.getString("uri")).setKey(bundle.getString("key")).setBot(bundle.getBoolean(IS_BOT_KEY)).setImportant(bundle.getBoolean(IS_IMPORTANT_KEY)).build();
}
@NonNull
@RequiresApi(22)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static Person fromPersistableBundle(@NonNull PersistableBundle persistableBundle) {
return Api22Impl.fromPersistableBundle(persistableBundle);
}
@NonNull
@RequiresApi(28)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static Person fromAndroidPerson(@NonNull android.app.Person person) {
return Api28Impl.fromAndroidPerson(person);
}
public Person(Builder builder) {
this.mName = builder.mName;
this.mIcon = builder.mIcon;
this.mUri = builder.mUri;
this.mKey = builder.mKey;
this.mIsBot = builder.mIsBot;
this.mIsImportant = builder.mIsImportant;
}
@NonNull
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putCharSequence("name", this.mName);
IconCompat iconCompat = this.mIcon;
bundle.putBundle("icon", iconCompat != null ? iconCompat.toBundle() : null);
bundle.putString("uri", this.mUri);
bundle.putString("key", this.mKey);
bundle.putBoolean(IS_BOT_KEY, this.mIsBot);
bundle.putBoolean(IS_IMPORTANT_KEY, this.mIsImportant);
return bundle;
}
@NonNull
@RequiresApi(22)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PersistableBundle toPersistableBundle() {
return Api22Impl.toPersistableBundle(this);
}
@NonNull
public Builder toBuilder() {
return new Builder(this);
}
@NonNull
@RequiresApi(28)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public android.app.Person toAndroidPerson() {
return Api28Impl.toAndroidPerson(this);
}
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public String resolveToLegacyUri() {
String str = this.mUri;
if (str != null) {
return str;
}
if (this.mName == null) {
return "";
}
return "name:" + ((Object) this.mName);
}
public boolean equals(@Nullable Object obj) {
if (obj == null || !(obj instanceof Person)) {
return false;
}
Person person = (Person) obj;
String key = getKey();
String key2 = person.getKey();
if (key == null && key2 == null) {
return Objects.equals(Objects.toString(getName()), Objects.toString(person.getName())) && Objects.equals(getUri(), person.getUri()) && Objects.equals(Boolean.valueOf(isBot()), Boolean.valueOf(person.isBot())) && Objects.equals(Boolean.valueOf(isImportant()), Boolean.valueOf(person.isImportant()));
}
return Objects.equals(key, key2);
}
public int hashCode() {
String key = getKey();
if (key != null) {
return key.hashCode();
}
return Objects.hash(getName(), getUri(), Boolean.valueOf(isBot()), Boolean.valueOf(isImportant()));
}
public static class Builder {
@Nullable
IconCompat mIcon;
boolean mIsBot;
boolean mIsImportant;
@Nullable
String mKey;
@Nullable
CharSequence mName;
@Nullable
String mUri;
@NonNull
public Builder setBot(boolean z) {
this.mIsBot = z;
return this;
}
@NonNull
public Builder setIcon(@Nullable IconCompat iconCompat) {
this.mIcon = iconCompat;
return this;
}
@NonNull
public Builder setImportant(boolean z) {
this.mIsImportant = z;
return this;
}
@NonNull
public Builder setKey(@Nullable String str) {
this.mKey = str;
return this;
}
@NonNull
public Builder setName(@Nullable CharSequence charSequence) {
this.mName = charSequence;
return this;
}
@NonNull
public Builder setUri(@Nullable String str) {
this.mUri = str;
return this;
}
public Builder() {
}
public Builder(Person person) {
this.mName = person.mName;
this.mIcon = person.mIcon;
this.mUri = person.mUri;
this.mKey = person.mKey;
this.mIsBot = person.mIsBot;
this.mIsImportant = person.mIsImportant;
}
@NonNull
public Person build() {
return new Person(this);
}
}
@RequiresApi(22)
public static class Api22Impl {
private Api22Impl() {
}
public static Person fromPersistableBundle(PersistableBundle persistableBundle) {
return new Builder().setName(persistableBundle.getString("name")).setUri(persistableBundle.getString("uri")).setKey(persistableBundle.getString("key")).setBot(persistableBundle.getBoolean(Person.IS_BOT_KEY)).setImportant(persistableBundle.getBoolean(Person.IS_IMPORTANT_KEY)).build();
}
public static PersistableBundle toPersistableBundle(Person person) {
PersistableBundle persistableBundle = new PersistableBundle();
CharSequence charSequence = person.mName;
persistableBundle.putString("name", charSequence != null ? charSequence.toString() : null);
persistableBundle.putString("uri", person.mUri);
persistableBundle.putString("key", person.mKey);
persistableBundle.putBoolean(Person.IS_BOT_KEY, person.mIsBot);
persistableBundle.putBoolean(Person.IS_IMPORTANT_KEY, person.mIsImportant);
return persistableBundle;
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static Person fromAndroidPerson(android.app.Person person) {
return new Builder().setName(person.getName()).setIcon(person.getIcon() != null ? IconCompat.createFromIcon(person.getIcon()) : null).setUri(person.getUri()).setKey(person.getKey()).setBot(person.isBot()).setImportant(person.isImportant()).build();
}
public static android.app.Person toAndroidPerson(Person person) {
return new Person.Builder().setName(person.getName()).setIcon(person.getIcon() != null ? person.getIcon().toIcon() : null).setUri(person.getUri()).setKey(person.getKey()).setBot(person.isBot()).setImportant(person.isImportant()).build();
}
}
}

View File

@@ -0,0 +1,38 @@
package androidx.core.app;
import android.content.res.Configuration;
import androidx.annotation.RequiresApi;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class PictureInPictureModeChangedInfo {
private final boolean isInPictureInPictureMode;
@RequiresApi(26)
private Configuration newConfiguration;
public final boolean isInPictureInPictureMode() {
return this.isInPictureInPictureMode;
}
public PictureInPictureModeChangedInfo(boolean z) {
this.isInPictureInPictureMode = z;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@RequiresApi(26)
public PictureInPictureModeChangedInfo(boolean z, Configuration newConfig) {
this(z);
Intrinsics.checkNotNullParameter(newConfig, "newConfig");
this.newConfiguration = newConfig;
}
@RequiresApi(26)
public final Configuration getNewConfig() {
Configuration configuration = this.newConfiguration;
if (configuration != null) {
return configuration;
}
throw new IllegalStateException("PictureInPictureModeChangedInfo must be constructed with the constructor that takes a Configuration to access the newConfig. Are you running on an API 26 or higher device that makes this information available?".toString());
}
}

View File

@@ -0,0 +1,170 @@
package androidx.core.app;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.app.RemoteAction;
import android.graphics.drawable.Icon;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.IconCompat;
import androidx.core.util.Preconditions;
import androidx.versionedparcelable.VersionedParcelable;
/* loaded from: classes.dex */
public final class RemoteActionCompat implements VersionedParcelable {
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public PendingIntent mActionIntent;
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public CharSequence mContentDescription;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public boolean mEnabled;
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public IconCompat mIcon;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public boolean mShouldShowIcon;
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public CharSequence mTitle;
@NonNull
public PendingIntent getActionIntent() {
return this.mActionIntent;
}
@NonNull
public CharSequence getContentDescription() {
return this.mContentDescription;
}
@NonNull
public IconCompat getIcon() {
return this.mIcon;
}
@NonNull
public CharSequence getTitle() {
return this.mTitle;
}
public boolean isEnabled() {
return this.mEnabled;
}
public void setEnabled(boolean z) {
this.mEnabled = z;
}
public void setShouldShowIcon(boolean z) {
this.mShouldShowIcon = z;
}
@SuppressLint({"KotlinPropertyAccess"})
public boolean shouldShowIcon() {
return this.mShouldShowIcon;
}
public RemoteActionCompat(@NonNull IconCompat iconCompat, @NonNull CharSequence charSequence, @NonNull CharSequence charSequence2, @NonNull PendingIntent pendingIntent) {
this.mIcon = (IconCompat) Preconditions.checkNotNull(iconCompat);
this.mTitle = (CharSequence) Preconditions.checkNotNull(charSequence);
this.mContentDescription = (CharSequence) Preconditions.checkNotNull(charSequence2);
this.mActionIntent = (PendingIntent) Preconditions.checkNotNull(pendingIntent);
this.mEnabled = true;
this.mShouldShowIcon = true;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public RemoteActionCompat() {
}
public RemoteActionCompat(@NonNull RemoteActionCompat remoteActionCompat) {
Preconditions.checkNotNull(remoteActionCompat);
this.mIcon = remoteActionCompat.mIcon;
this.mTitle = remoteActionCompat.mTitle;
this.mContentDescription = remoteActionCompat.mContentDescription;
this.mActionIntent = remoteActionCompat.mActionIntent;
this.mEnabled = remoteActionCompat.mEnabled;
this.mShouldShowIcon = remoteActionCompat.mShouldShowIcon;
}
@NonNull
@RequiresApi(26)
public static RemoteActionCompat createFromRemoteAction(@NonNull RemoteAction remoteAction) {
Preconditions.checkNotNull(remoteAction);
RemoteActionCompat remoteActionCompat = new RemoteActionCompat(IconCompat.createFromIcon(Api26Impl.getIcon(remoteAction)), Api26Impl.getTitle(remoteAction), Api26Impl.getContentDescription(remoteAction), Api26Impl.getActionIntent(remoteAction));
remoteActionCompat.setEnabled(Api26Impl.isEnabled(remoteAction));
if (Build.VERSION.SDK_INT >= 28) {
remoteActionCompat.setShouldShowIcon(Api28Impl.shouldShowIcon(remoteAction));
}
return remoteActionCompat;
}
@NonNull
@RequiresApi(26)
public RemoteAction toRemoteAction() {
RemoteAction createRemoteAction = Api26Impl.createRemoteAction(this.mIcon.toIcon(), this.mTitle, this.mContentDescription, this.mActionIntent);
Api26Impl.setEnabled(createRemoteAction, isEnabled());
if (Build.VERSION.SDK_INT >= 28) {
Api28Impl.setShouldShowIcon(createRemoteAction, shouldShowIcon());
}
return createRemoteAction;
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static boolean shouldShowIcon(RemoteAction remoteAction) {
return remoteAction.shouldShowIcon();
}
public static void setShouldShowIcon(RemoteAction remoteAction, boolean z) {
remoteAction.setShouldShowIcon(z);
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static CharSequence getContentDescription(RemoteAction remoteAction) {
return remoteAction.getContentDescription();
}
public static PendingIntent getActionIntent(RemoteAction remoteAction) {
return remoteAction.getActionIntent();
}
public static CharSequence getTitle(RemoteAction remoteAction) {
return remoteAction.getTitle();
}
public static Icon getIcon(RemoteAction remoteAction) {
return remoteAction.getIcon();
}
public static boolean isEnabled(RemoteAction remoteAction) {
return remoteAction.isEnabled();
}
public static RemoteAction createRemoteAction(Icon icon, CharSequence charSequence, CharSequence charSequence2, PendingIntent pendingIntent) {
return new RemoteAction(icon, charSequence, charSequence2, pendingIntent);
}
public static void setEnabled(RemoteAction remoteAction, boolean z) {
remoteAction.setEnabled(z);
}
}
}

View File

@@ -0,0 +1,31 @@
package androidx.core.app;
import android.app.PendingIntent;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.IconCompat;
import androidx.versionedparcelable.VersionedParcel;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public class RemoteActionCompatParcelizer {
public static RemoteActionCompat read(VersionedParcel versionedParcel) {
RemoteActionCompat remoteActionCompat = new RemoteActionCompat();
remoteActionCompat.mIcon = (IconCompat) versionedParcel.readVersionedParcelable(remoteActionCompat.mIcon, 1);
remoteActionCompat.mTitle = versionedParcel.readCharSequence(remoteActionCompat.mTitle, 2);
remoteActionCompat.mContentDescription = versionedParcel.readCharSequence(remoteActionCompat.mContentDescription, 3);
remoteActionCompat.mActionIntent = (PendingIntent) versionedParcel.readParcelable(remoteActionCompat.mActionIntent, 4);
remoteActionCompat.mEnabled = versionedParcel.readBoolean(remoteActionCompat.mEnabled, 5);
remoteActionCompat.mShouldShowIcon = versionedParcel.readBoolean(remoteActionCompat.mShouldShowIcon, 6);
return remoteActionCompat;
}
public static void write(RemoteActionCompat remoteActionCompat, VersionedParcel versionedParcel) {
versionedParcel.setSerializationFlags(false, false);
versionedParcel.writeVersionedParcelable(remoteActionCompat.mIcon, 1);
versionedParcel.writeCharSequence(remoteActionCompat.mTitle, 2);
versionedParcel.writeCharSequence(remoteActionCompat.mContentDescription, 3);
versionedParcel.writeParcelable(remoteActionCompat.mActionIntent, 4);
versionedParcel.writeBoolean(remoteActionCompat.mEnabled, 5);
versionedParcel.writeBoolean(remoteActionCompat.mShouldShowIcon, 6);
}
}

View File

@@ -0,0 +1,343 @@
package androidx.core.app;
import android.app.RemoteInput;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class RemoteInput {
public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0;
public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1;
public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2;
private static final String EXTRA_DATA_TYPE_RESULTS_DATA = "android.remoteinput.dataTypeResultsData";
public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
private static final String EXTRA_RESULTS_SOURCE = "android.remoteinput.resultsSource";
public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
public static final int SOURCE_CHOICE = 1;
public static final int SOURCE_FREE_FORM_INPUT = 0;
private final boolean mAllowFreeFormTextInput;
private final Set<String> mAllowedDataTypes;
private final CharSequence[] mChoices;
private final int mEditChoicesBeforeSending;
private final Bundle mExtras;
private final CharSequence mLabel;
private final String mResultKey;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface EditChoicesBeforeSending {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface Source {
}
public boolean getAllowFreeFormInput() {
return this.mAllowFreeFormTextInput;
}
@Nullable
public Set<String> getAllowedDataTypes() {
return this.mAllowedDataTypes;
}
@Nullable
public CharSequence[] getChoices() {
return this.mChoices;
}
public int getEditChoicesBeforeSending() {
return this.mEditChoicesBeforeSending;
}
@NonNull
public Bundle getExtras() {
return this.mExtras;
}
@Nullable
public CharSequence getLabel() {
return this.mLabel;
}
@NonNull
public String getResultKey() {
return this.mResultKey;
}
public RemoteInput(String str, CharSequence charSequence, CharSequence[] charSequenceArr, boolean z, int i, Bundle bundle, Set<String> set) {
this.mResultKey = str;
this.mLabel = charSequence;
this.mChoices = charSequenceArr;
this.mAllowFreeFormTextInput = z;
this.mEditChoicesBeforeSending = i;
this.mExtras = bundle;
this.mAllowedDataTypes = set;
if (getEditChoicesBeforeSending() == 2 && !getAllowFreeFormInput()) {
throw new IllegalArgumentException("setEditChoicesBeforeSending requires setAllowFreeFormInput");
}
}
public boolean isDataOnly() {
return (getAllowFreeFormInput() || (getChoices() != null && getChoices().length != 0) || getAllowedDataTypes() == null || getAllowedDataTypes().isEmpty()) ? false : true;
}
public static final class Builder {
private CharSequence[] mChoices;
private CharSequence mLabel;
private final String mResultKey;
private final Set<String> mAllowedDataTypes = new HashSet();
private final Bundle mExtras = new Bundle();
private boolean mAllowFreeFormTextInput = true;
private int mEditChoicesBeforeSending = 0;
@NonNull
public Bundle getExtras() {
return this.mExtras;
}
@NonNull
public Builder setAllowFreeFormInput(boolean z) {
this.mAllowFreeFormTextInput = z;
return this;
}
@NonNull
public Builder setChoices(@Nullable CharSequence[] charSequenceArr) {
this.mChoices = charSequenceArr;
return this;
}
@NonNull
public Builder setEditChoicesBeforeSending(int i) {
this.mEditChoicesBeforeSending = i;
return this;
}
@NonNull
public Builder setLabel(@Nullable CharSequence charSequence) {
this.mLabel = charSequence;
return this;
}
public Builder(@NonNull String str) {
if (str == null) {
throw new IllegalArgumentException("Result key can't be null");
}
this.mResultKey = str;
}
@NonNull
public Builder setAllowDataType(@NonNull String str, boolean z) {
if (z) {
this.mAllowedDataTypes.add(str);
} else {
this.mAllowedDataTypes.remove(str);
}
return this;
}
@NonNull
public Builder addExtras(@NonNull Bundle bundle) {
if (bundle != null) {
this.mExtras.putAll(bundle);
}
return this;
}
@NonNull
public RemoteInput build() {
return new RemoteInput(this.mResultKey, this.mLabel, this.mChoices, this.mAllowFreeFormTextInput, this.mEditChoicesBeforeSending, this.mExtras, this.mAllowedDataTypes);
}
}
@Nullable
public static Map<String, Uri> getDataResultsFromIntent(@NonNull Intent intent, @NonNull String str) {
return Api26Impl.getDataResultsFromIntent(intent, str);
}
@Nullable
public static Bundle getResultsFromIntent(@NonNull Intent intent) {
return Api20Impl.getResultsFromIntent(intent);
}
public static void addResultsToIntent(@NonNull RemoteInput[] remoteInputArr, @NonNull Intent intent, @NonNull Bundle bundle) {
Api20Impl.addResultsToIntent(fromCompat(remoteInputArr), intent, bundle);
}
public static void addDataResultToIntent(@NonNull RemoteInput remoteInput, @NonNull Intent intent, @NonNull Map<String, Uri> map) {
Api26Impl.addDataResultToIntent(remoteInput, intent, map);
}
public static void setResultsSource(@NonNull Intent intent, int i) {
if (Build.VERSION.SDK_INT >= 28) {
Api28Impl.setResultsSource(intent, i);
return;
}
Intent clipDataIntentFromIntent = getClipDataIntentFromIntent(intent);
if (clipDataIntentFromIntent == null) {
clipDataIntentFromIntent = new Intent();
}
clipDataIntentFromIntent.putExtra(EXTRA_RESULTS_SOURCE, i);
intent.setClipData(ClipData.newIntent(RESULTS_CLIP_LABEL, clipDataIntentFromIntent));
}
public static int getResultsSource(@NonNull Intent intent) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getResultsSource(intent);
}
Intent clipDataIntentFromIntent = getClipDataIntentFromIntent(intent);
if (clipDataIntentFromIntent == null) {
return 0;
}
return clipDataIntentFromIntent.getExtras().getInt(EXTRA_RESULTS_SOURCE, 0);
}
private static String getExtraResultsKeyForData(String str) {
return EXTRA_DATA_TYPE_RESULTS_DATA + str;
}
@RequiresApi(20)
public static android.app.RemoteInput[] fromCompat(RemoteInput[] remoteInputArr) {
if (remoteInputArr == null) {
return null;
}
android.app.RemoteInput[] remoteInputArr2 = new android.app.RemoteInput[remoteInputArr.length];
for (int i = 0; i < remoteInputArr.length; i++) {
remoteInputArr2[i] = fromCompat(remoteInputArr[i]);
}
return remoteInputArr2;
}
@RequiresApi(20)
public static android.app.RemoteInput fromCompat(RemoteInput remoteInput) {
return Api20Impl.fromCompat(remoteInput);
}
@RequiresApi(20)
public static RemoteInput fromPlatform(android.app.RemoteInput remoteInput) {
return Api20Impl.fromPlatform(remoteInput);
}
private static Intent getClipDataIntentFromIntent(Intent intent) {
ClipData clipData = intent.getClipData();
if (clipData == null) {
return null;
}
ClipDescription description = clipData.getDescription();
if (description.hasMimeType("text/vnd.android.intent") && description.getLabel().toString().contentEquals(RESULTS_CLIP_LABEL)) {
return clipData.getItemAt(0).getIntent();
}
return null;
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static Map<String, Uri> getDataResultsFromIntent(Intent intent, String str) {
return android.app.RemoteInput.getDataResultsFromIntent(intent, str);
}
public static Set<String> getAllowedDataTypes(Object obj) {
return ((android.app.RemoteInput) obj).getAllowedDataTypes();
}
public static void addDataResultToIntent(RemoteInput remoteInput, Intent intent, Map<String, Uri> map) {
android.app.RemoteInput.addDataResultToIntent(RemoteInput.fromCompat(remoteInput), intent, map);
}
public static RemoteInput.Builder setAllowDataType(RemoteInput.Builder builder, String str, boolean z) {
return builder.setAllowDataType(str, z);
}
}
@RequiresApi(20)
public static class Api20Impl {
private Api20Impl() {
}
public static Bundle getResultsFromIntent(Intent intent) {
return android.app.RemoteInput.getResultsFromIntent(intent);
}
public static void addResultsToIntent(Object obj, Intent intent, Bundle bundle) {
android.app.RemoteInput.addResultsToIntent((android.app.RemoteInput[]) obj, intent, bundle);
}
public static RemoteInput fromPlatform(Object obj) {
android.app.RemoteInput remoteInput = (android.app.RemoteInput) obj;
Builder addExtras = new Builder(remoteInput.getResultKey()).setLabel(remoteInput.getLabel()).setChoices(remoteInput.getChoices()).setAllowFreeFormInput(remoteInput.getAllowFreeFormInput()).addExtras(remoteInput.getExtras());
Set<String> allowedDataTypes = Api26Impl.getAllowedDataTypes(remoteInput);
if (allowedDataTypes != null) {
Iterator<String> it = allowedDataTypes.iterator();
while (it.hasNext()) {
addExtras.setAllowDataType(it.next(), true);
}
}
if (Build.VERSION.SDK_INT >= 29) {
addExtras.setEditChoicesBeforeSending(Api29Impl.getEditChoicesBeforeSending(remoteInput));
}
return addExtras.build();
}
public static android.app.RemoteInput fromCompat(RemoteInput remoteInput) {
RemoteInput.Builder addExtras = new RemoteInput.Builder(remoteInput.getResultKey()).setLabel(remoteInput.getLabel()).setChoices(remoteInput.getChoices()).setAllowFreeFormInput(remoteInput.getAllowFreeFormInput()).addExtras(remoteInput.getExtras());
Set<String> allowedDataTypes = remoteInput.getAllowedDataTypes();
if (allowedDataTypes != null) {
Iterator<String> it = allowedDataTypes.iterator();
while (it.hasNext()) {
Api26Impl.setAllowDataType(addExtras, it.next(), true);
}
}
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.setEditChoicesBeforeSending(addExtras, remoteInput.getEditChoicesBeforeSending());
}
return addExtras.build();
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static int getEditChoicesBeforeSending(Object obj) {
return ((android.app.RemoteInput) obj).getEditChoicesBeforeSending();
}
public static RemoteInput.Builder setEditChoicesBeforeSending(RemoteInput.Builder builder, int i) {
return builder.setEditChoicesBeforeSending(i);
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static void setResultsSource(Intent intent, int i) {
android.app.RemoteInput.setResultsSource(intent, i);
}
public static int getResultsSource(Intent intent) {
return android.app.RemoteInput.getResultsSource(intent);
}
}
}

View File

@@ -0,0 +1,80 @@
package androidx.core.app;
import android.app.Notification;
import android.app.Service;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public final class ServiceCompat {
private static final int FOREGROUND_SERVICE_TYPE_ALLOWED_SINCE_Q = 255;
private static final int FOREGROUND_SERVICE_TYPE_ALLOWED_SINCE_U = 1073745919;
public static final int START_STICKY = 1;
public static final int STOP_FOREGROUND_DETACH = 2;
public static final int STOP_FOREGROUND_REMOVE = 1;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface StopForegroundFlags {
}
private ServiceCompat() {
}
public static void startForeground(@NonNull Service service, int i, @NonNull Notification notification, int i2) {
int i3 = Build.VERSION.SDK_INT;
if (i3 >= 34) {
Api34Impl.startForeground(service, i, notification, i2);
} else if (i3 >= 29) {
Api29Impl.startForeground(service, i, notification, i2);
} else {
service.startForeground(i, notification);
}
}
public static void stopForeground(@NonNull Service service, int i) {
Api24Impl.stopForeground(service, i);
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static void stopForeground(Service service, int i) {
service.stopForeground(i);
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static void startForeground(Service service, int i, Notification notification, int i2) {
if (i2 == 0 || i2 == -1) {
service.startForeground(i, notification, i2);
} else {
service.startForeground(i, notification, i2 & 255);
}
}
}
@RequiresApi(34)
public static class Api34Impl {
private Api34Impl() {
}
public static void startForeground(Service service, int i, Notification notification, int i2) {
if (i2 == 0 || i2 == -1) {
service.startForeground(i, notification, i2);
} else {
service.startForeground(i, notification, i2 & ServiceCompat.FOREGROUND_SERVICE_TYPE_ALLOWED_SINCE_U);
}
}
}
}

View File

@@ -0,0 +1,523 @@
package androidx.core.app;
import android.app.Activity;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.ActionProvider;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ShareActionProvider;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.core.content.IntentCompat;
import androidx.core.util.Preconditions;
import java.util.ArrayList;
/* loaded from: classes.dex */
public final class ShareCompat {
public static final String EXTRA_CALLING_ACTIVITY = "androidx.core.app.EXTRA_CALLING_ACTIVITY";
public static final String EXTRA_CALLING_ACTIVITY_INTEROP = "android.support.v4.app.EXTRA_CALLING_ACTIVITY";
public static final String EXTRA_CALLING_PACKAGE = "androidx.core.app.EXTRA_CALLING_PACKAGE";
public static final String EXTRA_CALLING_PACKAGE_INTEROP = "android.support.v4.app.EXTRA_CALLING_PACKAGE";
private static final String HISTORY_FILENAME_PREFIX = ".sharecompat_";
private ShareCompat() {
}
@Nullable
public static String getCallingPackage(@NonNull Activity activity) {
Intent intent = activity.getIntent();
String callingPackage = activity.getCallingPackage();
return (callingPackage != null || intent == null) ? callingPackage : getCallingPackage(intent);
}
@Nullable
public static String getCallingPackage(@NonNull Intent intent) {
String stringExtra = intent.getStringExtra(EXTRA_CALLING_PACKAGE);
return stringExtra == null ? intent.getStringExtra(EXTRA_CALLING_PACKAGE_INTEROP) : stringExtra;
}
@Nullable
public static ComponentName getCallingActivity(@NonNull Activity activity) {
Intent intent = activity.getIntent();
ComponentName callingActivity = activity.getCallingActivity();
return callingActivity == null ? getCallingActivity(intent) : callingActivity;
}
@Nullable
public static ComponentName getCallingActivity(@NonNull Intent intent) {
ComponentName componentName = (ComponentName) intent.getParcelableExtra(EXTRA_CALLING_ACTIVITY);
return componentName == null ? (ComponentName) intent.getParcelableExtra(EXTRA_CALLING_ACTIVITY_INTEROP) : componentName;
}
@Deprecated
public static void configureMenuItem(@NonNull MenuItem menuItem, @NonNull IntentBuilder intentBuilder) {
ShareActionProvider shareActionProvider;
ActionProvider actionProvider = menuItem.getActionProvider();
if (!(actionProvider instanceof ShareActionProvider)) {
shareActionProvider = new ShareActionProvider(intentBuilder.getContext());
} else {
shareActionProvider = (ShareActionProvider) actionProvider;
}
shareActionProvider.setShareHistoryFileName(HISTORY_FILENAME_PREFIX + intentBuilder.getContext().getClass().getName());
shareActionProvider.setShareIntent(intentBuilder.getIntent());
menuItem.setActionProvider(shareActionProvider);
}
@Deprecated
public static void configureMenuItem(@NonNull Menu menu, @IdRes int i, @NonNull IntentBuilder intentBuilder) {
MenuItem findItem = menu.findItem(i);
if (findItem == null) {
throw new IllegalArgumentException("Could not find menu item with id " + i + " in the supplied menu");
}
configureMenuItem(findItem, intentBuilder);
}
public static class IntentBuilder {
@Nullable
private ArrayList<String> mBccAddresses;
@Nullable
private ArrayList<String> mCcAddresses;
@Nullable
private CharSequence mChooserTitle;
@NonNull
private final Context mContext;
@NonNull
private final Intent mIntent;
@Nullable
private ArrayList<Uri> mStreams;
@Nullable
private ArrayList<String> mToAddresses;
@NonNull
public Context getContext() {
return this.mContext;
}
@NonNull
public IntentBuilder setChooserTitle(@Nullable CharSequence charSequence) {
this.mChooserTitle = charSequence;
return this;
}
@NonNull
@Deprecated
public static IntentBuilder from(@NonNull Activity activity) {
return new IntentBuilder(activity);
}
public IntentBuilder(@NonNull Context context) {
Activity activity;
this.mContext = (Context) Preconditions.checkNotNull(context);
Intent action = new Intent().setAction("android.intent.action.SEND");
this.mIntent = action;
action.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE, context.getPackageName());
action.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE_INTEROP, context.getPackageName());
action.addFlags(524288);
while (true) {
if (!(context instanceof ContextWrapper)) {
activity = null;
break;
} else {
if (context instanceof Activity) {
activity = (Activity) context;
break;
}
context = ((ContextWrapper) context).getBaseContext();
}
}
if (activity != null) {
ComponentName componentName = activity.getComponentName();
this.mIntent.putExtra(ShareCompat.EXTRA_CALLING_ACTIVITY, componentName);
this.mIntent.putExtra(ShareCompat.EXTRA_CALLING_ACTIVITY_INTEROP, componentName);
}
}
@NonNull
public Intent getIntent() {
ArrayList<String> arrayList = this.mToAddresses;
if (arrayList != null) {
combineArrayExtra("android.intent.extra.EMAIL", arrayList);
this.mToAddresses = null;
}
ArrayList<String> arrayList2 = this.mCcAddresses;
if (arrayList2 != null) {
combineArrayExtra("android.intent.extra.CC", arrayList2);
this.mCcAddresses = null;
}
ArrayList<String> arrayList3 = this.mBccAddresses;
if (arrayList3 != null) {
combineArrayExtra("android.intent.extra.BCC", arrayList3);
this.mBccAddresses = null;
}
ArrayList<Uri> arrayList4 = this.mStreams;
if (arrayList4 == null || arrayList4.size() <= 1) {
this.mIntent.setAction("android.intent.action.SEND");
ArrayList<Uri> arrayList5 = this.mStreams;
if (arrayList5 != null && !arrayList5.isEmpty()) {
this.mIntent.putExtra("android.intent.extra.STREAM", this.mStreams.get(0));
ShareCompat.migrateExtraStreamToClipData(this.mIntent, this.mStreams);
} else {
this.mIntent.removeExtra("android.intent.extra.STREAM");
this.mIntent.setClipData(null);
Intent intent = this.mIntent;
intent.setFlags(intent.getFlags() & (-2));
}
} else {
this.mIntent.setAction("android.intent.action.SEND_MULTIPLE");
this.mIntent.putParcelableArrayListExtra("android.intent.extra.STREAM", this.mStreams);
ShareCompat.migrateExtraStreamToClipData(this.mIntent, this.mStreams);
}
return this.mIntent;
}
private void combineArrayExtra(String str, ArrayList<String> arrayList) {
String[] stringArrayExtra = this.mIntent.getStringArrayExtra(str);
int length = stringArrayExtra != null ? stringArrayExtra.length : 0;
String[] strArr = new String[arrayList.size() + length];
arrayList.toArray(strArr);
if (stringArrayExtra != null) {
System.arraycopy(stringArrayExtra, 0, strArr, arrayList.size(), length);
}
this.mIntent.putExtra(str, strArr);
}
private void combineArrayExtra(@Nullable String str, @NonNull String[] strArr) {
Intent intent = getIntent();
String[] stringArrayExtra = intent.getStringArrayExtra(str);
int length = stringArrayExtra != null ? stringArrayExtra.length : 0;
String[] strArr2 = new String[strArr.length + length];
if (stringArrayExtra != null) {
System.arraycopy(stringArrayExtra, 0, strArr2, 0, length);
}
System.arraycopy(strArr, 0, strArr2, length, strArr.length);
intent.putExtra(str, strArr2);
}
@NonNull
public Intent createChooserIntent() {
return Intent.createChooser(getIntent(), this.mChooserTitle);
}
public void startChooser() {
this.mContext.startActivity(createChooserIntent());
}
@NonNull
public IntentBuilder setChooserTitle(@StringRes int i) {
return setChooserTitle(this.mContext.getText(i));
}
@NonNull
public IntentBuilder setType(@Nullable String str) {
this.mIntent.setType(str);
return this;
}
@NonNull
public IntentBuilder setText(@Nullable CharSequence charSequence) {
this.mIntent.putExtra("android.intent.extra.TEXT", charSequence);
return this;
}
@NonNull
public IntentBuilder setHtmlText(@Nullable String str) {
this.mIntent.putExtra(IntentCompat.EXTRA_HTML_TEXT, str);
if (!this.mIntent.hasExtra("android.intent.extra.TEXT")) {
setText(Html.fromHtml(str));
}
return this;
}
@NonNull
public IntentBuilder setStream(@Nullable Uri uri) {
this.mStreams = null;
if (uri != null) {
addStream(uri);
}
return this;
}
@NonNull
public IntentBuilder addStream(@NonNull Uri uri) {
if (this.mStreams == null) {
this.mStreams = new ArrayList<>();
}
this.mStreams.add(uri);
return this;
}
@NonNull
public IntentBuilder setEmailTo(@Nullable String[] strArr) {
if (this.mToAddresses != null) {
this.mToAddresses = null;
}
this.mIntent.putExtra("android.intent.extra.EMAIL", strArr);
return this;
}
@NonNull
public IntentBuilder addEmailTo(@NonNull String str) {
if (this.mToAddresses == null) {
this.mToAddresses = new ArrayList<>();
}
this.mToAddresses.add(str);
return this;
}
@NonNull
public IntentBuilder addEmailTo(@NonNull String[] strArr) {
combineArrayExtra("android.intent.extra.EMAIL", strArr);
return this;
}
@NonNull
public IntentBuilder setEmailCc(@Nullable String[] strArr) {
this.mIntent.putExtra("android.intent.extra.CC", strArr);
return this;
}
@NonNull
public IntentBuilder addEmailCc(@NonNull String str) {
if (this.mCcAddresses == null) {
this.mCcAddresses = new ArrayList<>();
}
this.mCcAddresses.add(str);
return this;
}
@NonNull
public IntentBuilder addEmailCc(@NonNull String[] strArr) {
combineArrayExtra("android.intent.extra.CC", strArr);
return this;
}
@NonNull
public IntentBuilder setEmailBcc(@Nullable String[] strArr) {
this.mIntent.putExtra("android.intent.extra.BCC", strArr);
return this;
}
@NonNull
public IntentBuilder addEmailBcc(@NonNull String str) {
if (this.mBccAddresses == null) {
this.mBccAddresses = new ArrayList<>();
}
this.mBccAddresses.add(str);
return this;
}
@NonNull
public IntentBuilder addEmailBcc(@NonNull String[] strArr) {
combineArrayExtra("android.intent.extra.BCC", strArr);
return this;
}
@NonNull
public IntentBuilder setSubject(@Nullable String str) {
this.mIntent.putExtra("android.intent.extra.SUBJECT", str);
return this;
}
}
public static class IntentReader {
private static final String TAG = "IntentReader";
@Nullable
private final ComponentName mCallingActivity;
@Nullable
private final String mCallingPackage;
@NonNull
private final Context mContext;
@NonNull
private final Intent mIntent;
@Nullable
private ArrayList<Uri> mStreams;
@Nullable
public ComponentName getCallingActivity() {
return this.mCallingActivity;
}
@Nullable
public String getCallingPackage() {
return this.mCallingPackage;
}
@NonNull
@Deprecated
public static IntentReader from(@NonNull Activity activity) {
return new IntentReader(activity);
}
public IntentReader(@NonNull Activity activity) {
this((Context) Preconditions.checkNotNull(activity), activity.getIntent());
}
public IntentReader(@NonNull Context context, @NonNull Intent intent) {
this.mContext = (Context) Preconditions.checkNotNull(context);
this.mIntent = (Intent) Preconditions.checkNotNull(intent);
this.mCallingPackage = ShareCompat.getCallingPackage(intent);
this.mCallingActivity = ShareCompat.getCallingActivity(intent);
}
public boolean isShareIntent() {
String action = this.mIntent.getAction();
return "android.intent.action.SEND".equals(action) || "android.intent.action.SEND_MULTIPLE".equals(action);
}
public boolean isSingleShare() {
return "android.intent.action.SEND".equals(this.mIntent.getAction());
}
public boolean isMultipleShare() {
return "android.intent.action.SEND_MULTIPLE".equals(this.mIntent.getAction());
}
@Nullable
public String getType() {
return this.mIntent.getType();
}
@Nullable
public CharSequence getText() {
return this.mIntent.getCharSequenceExtra("android.intent.extra.TEXT");
}
@Nullable
public String getHtmlText() {
String stringExtra = this.mIntent.getStringExtra(IntentCompat.EXTRA_HTML_TEXT);
if (stringExtra != null) {
return stringExtra;
}
CharSequence text = getText();
if (text instanceof Spanned) {
return Html.toHtml((Spanned) text);
}
return text != null ? Html.escapeHtml(text) : stringExtra;
}
@Nullable
public Uri getStream() {
return (Uri) this.mIntent.getParcelableExtra("android.intent.extra.STREAM");
}
@Nullable
public Uri getStream(int i) {
if (this.mStreams == null && isMultipleShare()) {
this.mStreams = this.mIntent.getParcelableArrayListExtra("android.intent.extra.STREAM");
}
ArrayList<Uri> arrayList = this.mStreams;
if (arrayList != null) {
return arrayList.get(i);
}
if (i == 0) {
return (Uri) this.mIntent.getParcelableExtra("android.intent.extra.STREAM");
}
throw new IndexOutOfBoundsException("Stream items available: " + getStreamCount() + " index requested: " + i);
}
public int getStreamCount() {
if (this.mStreams == null && isMultipleShare()) {
this.mStreams = this.mIntent.getParcelableArrayListExtra("android.intent.extra.STREAM");
}
ArrayList<Uri> arrayList = this.mStreams;
if (arrayList != null) {
return arrayList.size();
}
return this.mIntent.hasExtra("android.intent.extra.STREAM") ? 1 : 0;
}
@Nullable
public String[] getEmailTo() {
return this.mIntent.getStringArrayExtra("android.intent.extra.EMAIL");
}
@Nullable
public String[] getEmailCc() {
return this.mIntent.getStringArrayExtra("android.intent.extra.CC");
}
@Nullable
public String[] getEmailBcc() {
return this.mIntent.getStringArrayExtra("android.intent.extra.BCC");
}
@Nullable
public String getSubject() {
return this.mIntent.getStringExtra("android.intent.extra.SUBJECT");
}
@Nullable
public Drawable getCallingActivityIcon() {
if (this.mCallingActivity == null) {
return null;
}
try {
return this.mContext.getPackageManager().getActivityIcon(this.mCallingActivity);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve icon for calling activity", e);
return null;
}
}
@Nullable
public Drawable getCallingApplicationIcon() {
if (this.mCallingPackage == null) {
return null;
}
try {
return this.mContext.getPackageManager().getApplicationIcon(this.mCallingPackage);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve icon for calling application", e);
return null;
}
}
@Nullable
public CharSequence getCallingApplicationLabel() {
if (this.mCallingPackage == null) {
return null;
}
PackageManager packageManager = this.mContext.getPackageManager();
try {
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(this.mCallingPackage, 0));
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve label for calling application", e);
return null;
}
}
}
public static void migrateExtraStreamToClipData(@NonNull Intent intent, @NonNull ArrayList<Uri> arrayList) {
ClipData clipData = new ClipData(null, new String[]{intent.getType()}, new ClipData.Item(intent.getCharSequenceExtra("android.intent.extra.TEXT"), intent.getStringExtra(IntentCompat.EXTRA_HTML_TEXT), null, arrayList.get(0)));
int size = arrayList.size();
for (int i = 1; i < size; i++) {
clipData.addItem(new ClipData.Item(arrayList.get(i)));
}
intent.setClipData(clipData);
intent.addFlags(1);
}
}

View File

@@ -0,0 +1,136 @@
package androidx.core.app;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
import android.widget.ImageView;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class SharedElementCallback {
private static final String BUNDLE_SNAPSHOT_BITMAP = "sharedElement:snapshot:bitmap";
private static final String BUNDLE_SNAPSHOT_IMAGE_MATRIX = "sharedElement:snapshot:imageMatrix";
private static final String BUNDLE_SNAPSHOT_IMAGE_SCALETYPE = "sharedElement:snapshot:imageScaleType";
private static final int MAX_IMAGE_SIZE = 1048576;
private Matrix mTempMatrix;
public interface OnSharedElementsReadyListener {
void onSharedElementsReady();
}
public void onMapSharedElements(List<String> list, Map<String, View> map) {
}
public void onRejectSharedElements(List<View> list) {
}
public void onSharedElementEnd(List<String> list, List<View> list2, List<View> list3) {
}
public void onSharedElementStart(List<String> list, List<View> list2, List<View> list3) {
}
public Parcelable onCaptureSharedElementSnapshot(View view, Matrix matrix, RectF rectF) {
Bitmap createDrawableBitmap;
if (view instanceof ImageView) {
ImageView imageView = (ImageView) view;
Drawable drawable = imageView.getDrawable();
Drawable background = imageView.getBackground();
if (drawable != null && background == null && (createDrawableBitmap = createDrawableBitmap(drawable)) != null) {
Bundle bundle = new Bundle();
bundle.putParcelable(BUNDLE_SNAPSHOT_BITMAP, createDrawableBitmap);
bundle.putString(BUNDLE_SNAPSHOT_IMAGE_SCALETYPE, imageView.getScaleType().toString());
if (imageView.getScaleType() == ImageView.ScaleType.MATRIX) {
float[] fArr = new float[9];
imageView.getImageMatrix().getValues(fArr);
bundle.putFloatArray(BUNDLE_SNAPSHOT_IMAGE_MATRIX, fArr);
}
return bundle;
}
}
int round = Math.round(rectF.width());
int round2 = Math.round(rectF.height());
if (round <= 0 || round2 <= 0) {
return null;
}
float min = Math.min(1.0f, 1048576.0f / (round * round2));
int i = (int) (round * min);
int i2 = (int) (round2 * min);
if (this.mTempMatrix == null) {
this.mTempMatrix = new Matrix();
}
this.mTempMatrix.set(matrix);
this.mTempMatrix.postTranslate(-rectF.left, -rectF.top);
this.mTempMatrix.postScale(min, min);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
canvas.concat(this.mTempMatrix);
view.draw(canvas);
return createBitmap;
}
private static Bitmap createDrawableBitmap(Drawable drawable) {
int intrinsicWidth = drawable.getIntrinsicWidth();
int intrinsicHeight = drawable.getIntrinsicHeight();
if (intrinsicWidth <= 0 || intrinsicHeight <= 0) {
return null;
}
float min = Math.min(1.0f, 1048576.0f / (intrinsicWidth * intrinsicHeight));
if ((drawable instanceof BitmapDrawable) && min == 1.0f) {
return ((BitmapDrawable) drawable).getBitmap();
}
int i = (int) (intrinsicWidth * min);
int i2 = (int) (intrinsicHeight * min);
Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
Rect bounds = drawable.getBounds();
int i3 = bounds.left;
int i4 = bounds.top;
int i5 = bounds.right;
int i6 = bounds.bottom;
drawable.setBounds(0, 0, i, i2);
drawable.draw(canvas);
drawable.setBounds(i3, i4, i5, i6);
return createBitmap;
}
public View onCreateSnapshotView(Context context, Parcelable parcelable) {
if (parcelable instanceof Bundle) {
Bundle bundle = (Bundle) parcelable;
Bitmap bitmap = (Bitmap) bundle.getParcelable(BUNDLE_SNAPSHOT_BITMAP);
if (bitmap == null) {
return null;
}
ImageView imageView = new ImageView(context);
imageView.setImageBitmap(bitmap);
imageView.setScaleType(ImageView.ScaleType.valueOf(bundle.getString(BUNDLE_SNAPSHOT_IMAGE_SCALETYPE)));
if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
return imageView;
}
float[] floatArray = bundle.getFloatArray(BUNDLE_SNAPSHOT_IMAGE_MATRIX);
Matrix matrix = new Matrix();
matrix.setValues(floatArray);
imageView.setImageMatrix(matrix);
return imageView;
}
if (!(parcelable instanceof Bitmap)) {
return null;
}
ImageView imageView2 = new ImageView(context);
imageView2.setImageBitmap((Bitmap) parcelable);
return imageView2;
}
public void onSharedElementsArrived(List<String> list, List<View> list2, OnSharedElementsReadyListener onSharedElementsReadyListener) {
onSharedElementsReadyListener.onSharedElementsReady();
}
}

View File

@@ -0,0 +1,168 @@
package androidx.core.app;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.google.android.gms.drive.DriveFile;
import java.util.ArrayList;
import java.util.Iterator;
/* loaded from: classes.dex */
public final class TaskStackBuilder implements Iterable<Intent> {
private static final String TAG = "TaskStackBuilder";
private final ArrayList<Intent> mIntents = new ArrayList<>();
private final Context mSourceContext;
public interface SupportParentable {
@Nullable
Intent getSupportParentActivityIntent();
}
private TaskStackBuilder(Context context) {
this.mSourceContext = context;
}
@NonNull
public static TaskStackBuilder create(@NonNull Context context) {
return new TaskStackBuilder(context);
}
@Deprecated
public static TaskStackBuilder from(Context context) {
return create(context);
}
@NonNull
public TaskStackBuilder addNextIntent(@NonNull Intent intent) {
this.mIntents.add(intent);
return this;
}
@NonNull
public TaskStackBuilder addNextIntentWithParentStack(@NonNull Intent intent) {
ComponentName component = intent.getComponent();
if (component == null) {
component = intent.resolveActivity(this.mSourceContext.getPackageManager());
}
if (component != null) {
addParentStack(component);
}
addNextIntent(intent);
return this;
}
/* JADX WARN: Multi-variable type inference failed */
@NonNull
public TaskStackBuilder addParentStack(@NonNull Activity activity) {
Intent supportParentActivityIntent = activity instanceof SupportParentable ? ((SupportParentable) activity).getSupportParentActivityIntent() : null;
if (supportParentActivityIntent == null) {
supportParentActivityIntent = NavUtils.getParentActivityIntent(activity);
}
if (supportParentActivityIntent != null) {
ComponentName component = supportParentActivityIntent.getComponent();
if (component == null) {
component = supportParentActivityIntent.resolveActivity(this.mSourceContext.getPackageManager());
}
addParentStack(component);
addNextIntent(supportParentActivityIntent);
}
return this;
}
@NonNull
public TaskStackBuilder addParentStack(@NonNull Class<?> cls) {
return addParentStack(new ComponentName(this.mSourceContext, cls));
}
@NonNull
public TaskStackBuilder addParentStack(@NonNull ComponentName componentName) {
int size = this.mIntents.size();
try {
Intent parentActivityIntent = NavUtils.getParentActivityIntent(this.mSourceContext, componentName);
while (parentActivityIntent != null) {
this.mIntents.add(size, parentActivityIntent);
parentActivityIntent = NavUtils.getParentActivityIntent(this.mSourceContext, parentActivityIntent.getComponent());
}
return this;
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Bad ComponentName while traversing activity parent metadata");
throw new IllegalArgumentException(e);
}
}
public int getIntentCount() {
return this.mIntents.size();
}
@Deprecated
public Intent getIntent(int i) {
return editIntentAt(i);
}
@Nullable
public Intent editIntentAt(int i) {
return this.mIntents.get(i);
}
@Override // java.lang.Iterable
@NonNull
@Deprecated
public Iterator<Intent> iterator() {
return this.mIntents.iterator();
}
public void startActivities() {
startActivities(null);
}
public void startActivities(@Nullable Bundle bundle) {
if (this.mIntents.isEmpty()) {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot startActivities");
}
Intent[] intentArr = (Intent[]) this.mIntents.toArray(new Intent[0]);
intentArr[0] = new Intent(intentArr[0]).addFlags(268484608);
if (ContextCompat.startActivities(this.mSourceContext, intentArr, bundle)) {
return;
}
Intent intent = new Intent(intentArr[intentArr.length - 1]);
intent.addFlags(DriveFile.MODE_READ_ONLY);
this.mSourceContext.startActivity(intent);
}
@Nullable
public PendingIntent getPendingIntent(int i, int i2) {
return getPendingIntent(i, i2, null);
}
@Nullable
public PendingIntent getPendingIntent(int i, int i2, @Nullable Bundle bundle) {
if (this.mIntents.isEmpty()) {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot getPendingIntent");
}
Intent[] intentArr = (Intent[]) this.mIntents.toArray(new Intent[0]);
intentArr[0] = new Intent(intentArr[0]).addFlags(268484608);
return PendingIntent.getActivities(this.mSourceContext, i, intentArr, i2, bundle);
}
@NonNull
public Intent[] getIntents() {
int size = this.mIntents.size();
Intent[] intentArr = new Intent[size];
if (size == 0) {
return intentArr;
}
intentArr[0] = new Intent(this.mIntents.get(0)).addFlags(268484608);
for (int i = 1; i < size; i++) {
intentArr[i] = new Intent(this.mIntents.get(i));
}
return intentArr;
}
}

View File

@@ -0,0 +1,98 @@
package androidx.core.app.unusedapprestrictions;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public interface IUnusedAppRestrictionsBackportCallback extends IInterface {
public static final String DESCRIPTOR = "androidx$core$app$unusedapprestrictions$IUnusedAppRestrictionsBackportCallback".replace('$', '.');
public static class Default implements IUnusedAppRestrictionsBackportCallback {
@Override // android.os.IInterface
public IBinder asBinder() {
return null;
}
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback
public void onIsPermissionRevocationEnabledForAppResult(boolean z, boolean z2) throws RemoteException {
}
}
void onIsPermissionRevocationEnabledForAppResult(boolean z, boolean z2) throws RemoteException;
public static abstract class Stub extends Binder implements IUnusedAppRestrictionsBackportCallback {
static final int TRANSACTION_onIsPermissionRevocationEnabledForAppResult = 1;
@Override // android.os.IInterface
public IBinder asBinder() {
return this;
}
public Stub() {
attachInterface(this, IUnusedAppRestrictionsBackportCallback.DESCRIPTOR);
}
public static IUnusedAppRestrictionsBackportCallback asInterface(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface(IUnusedAppRestrictionsBackportCallback.DESCRIPTOR);
if (queryLocalInterface != null && (queryLocalInterface instanceof IUnusedAppRestrictionsBackportCallback)) {
return (IUnusedAppRestrictionsBackportCallback) queryLocalInterface;
}
return new Proxy(iBinder);
}
@Override // android.os.Binder
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
String str = IUnusedAppRestrictionsBackportCallback.DESCRIPTOR;
if (i >= 1 && i <= 16777215) {
parcel.enforceInterface(str);
}
if (i == 1598968902) {
parcel2.writeString(str);
return true;
}
if (i == 1) {
onIsPermissionRevocationEnabledForAppResult(parcel.readInt() != 0, parcel.readInt() != 0);
return true;
}
return super.onTransact(i, parcel, parcel2, i2);
}
public static class Proxy implements IUnusedAppRestrictionsBackportCallback {
private IBinder mRemote;
@Override // android.os.IInterface
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return IUnusedAppRestrictionsBackportCallback.DESCRIPTOR;
}
public Proxy(IBinder iBinder) {
this.mRemote = iBinder;
}
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback
public void onIsPermissionRevocationEnabledForAppResult(boolean z, boolean z2) throws RemoteException {
Parcel obtain = Parcel.obtain();
try {
obtain.writeInterfaceToken(IUnusedAppRestrictionsBackportCallback.DESCRIPTOR);
obtain.writeInt(z ? 1 : 0);
obtain.writeInt(z2 ? 1 : 0);
this.mRemote.transact(1, obtain, null, 1);
} finally {
obtain.recycle();
}
}
}
}
}

View File

@@ -0,0 +1,98 @@
package androidx.core.app.unusedapprestrictions;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import androidx.annotation.RestrictTo;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public interface IUnusedAppRestrictionsBackportService extends IInterface {
public static final String DESCRIPTOR = "androidx$core$app$unusedapprestrictions$IUnusedAppRestrictionsBackportService".replace('$', '.');
public static class Default implements IUnusedAppRestrictionsBackportService {
@Override // android.os.IInterface
public IBinder asBinder() {
return null;
}
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportService
public void isPermissionRevocationEnabledForApp(IUnusedAppRestrictionsBackportCallback iUnusedAppRestrictionsBackportCallback) throws RemoteException {
}
}
void isPermissionRevocationEnabledForApp(IUnusedAppRestrictionsBackportCallback iUnusedAppRestrictionsBackportCallback) throws RemoteException;
public static abstract class Stub extends Binder implements IUnusedAppRestrictionsBackportService {
static final int TRANSACTION_isPermissionRevocationEnabledForApp = 1;
@Override // android.os.IInterface
public IBinder asBinder() {
return this;
}
public Stub() {
attachInterface(this, IUnusedAppRestrictionsBackportService.DESCRIPTOR);
}
public static IUnusedAppRestrictionsBackportService asInterface(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface(IUnusedAppRestrictionsBackportService.DESCRIPTOR);
if (queryLocalInterface != null && (queryLocalInterface instanceof IUnusedAppRestrictionsBackportService)) {
return (IUnusedAppRestrictionsBackportService) queryLocalInterface;
}
return new Proxy(iBinder);
}
@Override // android.os.Binder
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
String str = IUnusedAppRestrictionsBackportService.DESCRIPTOR;
if (i >= 1 && i <= 16777215) {
parcel.enforceInterface(str);
}
if (i == 1598968902) {
parcel2.writeString(str);
return true;
}
if (i == 1) {
isPermissionRevocationEnabledForApp(IUnusedAppRestrictionsBackportCallback.Stub.asInterface(parcel.readStrongBinder()));
return true;
}
return super.onTransact(i, parcel, parcel2, i2);
}
public static class Proxy implements IUnusedAppRestrictionsBackportService {
private IBinder mRemote;
@Override // android.os.IInterface
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return IUnusedAppRestrictionsBackportService.DESCRIPTOR;
}
public Proxy(IBinder iBinder) {
this.mRemote = iBinder;
}
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportService
public void isPermissionRevocationEnabledForApp(IUnusedAppRestrictionsBackportCallback iUnusedAppRestrictionsBackportCallback) throws RemoteException {
Parcel obtain = Parcel.obtain();
try {
obtain.writeInterfaceToken(IUnusedAppRestrictionsBackportService.DESCRIPTOR);
obtain.writeStrongInterface(iUnusedAppRestrictionsBackportCallback);
this.mRemote.transact(1, obtain, null, 1);
} finally {
obtain.recycle();
}
}
}
}
}