CrackMe.apk
Download file
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;
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 final Object sActionsLock = new Object();
private static Field sExtrasField;
private static boolean sExtrasFieldAccessFailed;
private static final Object sExtrasLock = 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(KEY_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) {
boolean z;
RemoteInput[] remoteInputArr;
RemoteInput[] remoteInputArr2;
if (bundle != null) {
remoteInputArr2 = fromBundleArray(getBundleArrayFromBundle(bundle, NotificationCompatExtras.EXTRA_REMOTE_INPUTS));
remoteInputArr = fromBundleArray(getBundleArrayFromBundle(bundle, EXTRA_DATA_ONLY_REMOTE_INPUTS));
z = bundle.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES);
} else {
remoteInputArr2 = null;
remoteInputArr = null;
z = false;
}
return new NotificationCompat.Action(i, charSequence, pendingIntent, bundle, remoteInputArr2, remoteInputArr, z, 0, true, 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) {
Object[] actionObjectsLocked = getActionObjectsLocked(notification);
length = actionObjectsLocked != null ? actionObjectsLocked.length : 0;
}
return length;
}
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0012, code lost:
r5 = r5.getSparseParcelableArray(androidx.core.app.NotificationCompatExtras.EXTRA_ACTION_EXTRAS);
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public static androidx.core.app.NotificationCompat.Action getAction(android.app.Notification r5, int r6) {
/*
java.lang.Object r0 = sActionsLock
monitor-enter(r0)
r1 = 0
java.lang.Object[] r2 = getActionObjectsLocked(r5) // Catch:{ IllegalAccessException -> 0x0040 }
if (r2 == 0) goto L_0x004b
r2 = r2[r6] // Catch:{ IllegalAccessException -> 0x0040 }
android.os.Bundle r5 = getExtras(r5) // Catch:{ IllegalAccessException -> 0x0040 }
if (r5 == 0) goto L_0x0021
java.lang.String r3 = "android.support.actionExtras"
android.util.SparseArray r5 = r5.getSparseParcelableArray(r3) // Catch:{ IllegalAccessException -> 0x0040 }
if (r5 == 0) goto L_0x0021
java.lang.Object r5 = r5.get(r6) // Catch:{ IllegalAccessException -> 0x0040 }
android.os.Bundle r5 = (android.os.Bundle) r5 // Catch:{ IllegalAccessException -> 0x0040 }
goto L_0x0022
L_0x0021:
r5 = r1
L_0x0022:
java.lang.reflect.Field r6 = sActionIconField // Catch:{ IllegalAccessException -> 0x0040 }
int r6 = r6.getInt(r2) // Catch:{ IllegalAccessException -> 0x0040 }
java.lang.reflect.Field r3 = sActionTitleField // Catch:{ IllegalAccessException -> 0x0040 }
java.lang.Object r3 = r3.get(r2) // Catch:{ IllegalAccessException -> 0x0040 }
java.lang.CharSequence r3 = (java.lang.CharSequence) r3 // Catch:{ IllegalAccessException -> 0x0040 }
java.lang.reflect.Field r4 = sActionIntentField // Catch:{ IllegalAccessException -> 0x0040 }
java.lang.Object r2 = r4.get(r2) // Catch:{ IllegalAccessException -> 0x0040 }
android.app.PendingIntent r2 = (android.app.PendingIntent) r2 // Catch:{ IllegalAccessException -> 0x0040 }
androidx.core.app.NotificationCompat$Action r5 = readAction(r6, r3, r2, r5) // Catch:{ IllegalAccessException -> 0x0040 }
monitor-exit(r0) // Catch:{ all -> 0x003e }
return r5
L_0x003e:
r5 = move-exception
goto L_0x004d
L_0x0040:
r5 = move-exception
java.lang.String r6 = "NotificationCompat"
java.lang.String r2 = "Unable to access notification actions"
android.util.Log.e(r6, r2, r5) // Catch:{ all -> 0x003e }
r5 = 1
sActionsAccessFailed = r5 // Catch:{ all -> 0x003e }
L_0x004b:
monitor-exit(r0) // Catch:{ all -> 0x003e }
return r1
L_0x004d:
monitor-exit(r0) // Catch:{ all -> 0x003e }
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.app.NotificationCompatJellybean.getAction(android.app.Notification, int):androidx.core.app.NotificationCompat$Action");
}
private static Object[] getActionObjectsLocked(Notification notification) {
synchronized (sActionsLock) {
if (!ensureActionReflectionReadyLocked()) {
return null;
}
try {
Object[] objArr = (Object[]) sActionsField.get(notification);
return objArr;
} 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(KEY_ICON);
sActionTitleField = cls.getDeclaredField(KEY_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;
}
static NotificationCompat.Action getActionFromBundle(Bundle bundle) {
Bundle bundle2 = bundle.getBundle(KEY_EXTRAS);
return new NotificationCompat.Action(bundle.getInt(KEY_ICON), bundle.getCharSequence(KEY_TITLE), (PendingIntent) bundle.getParcelable(KEY_ACTION_INTENT), bundle.getBundle(KEY_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);
}
static Bundle getBundleForAction(NotificationCompat.Action action) {
Bundle bundle;
Bundle bundle2 = new Bundle();
IconCompat iconCompat = action.getIconCompat();
bundle2.putInt(KEY_ICON, iconCompat != null ? iconCompat.getResId() : 0);
bundle2.putCharSequence(KEY_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(KEY_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(KEY_LABEL), bundle.getCharSequenceArray(KEY_CHOICES), bundle.getBoolean(KEY_ALLOW_FREE_FORM_INPUT), 0, bundle.getBundle(KEY_EXTRAS), hashSet);
}
private static Bundle toBundle(RemoteInput remoteInput) {
Bundle bundle = new Bundle();
bundle.putString(KEY_RESULT_KEY, remoteInput.getResultKey());
bundle.putCharSequence(KEY_LABEL, remoteInput.getLabel());
bundle.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices());
bundle.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput());
bundle.putBundle(KEY_EXTRAS, remoteInput.getExtras());
Set<String> allowedDataTypes = remoteInput.getAllowedDataTypes();
if (allowedDataTypes != null && !allowedDataTypes.isEmpty()) {
ArrayList arrayList = new ArrayList(allowedDataTypes.size());
for (String add : allowedDataTypes) {
arrayList.add(add);
}
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() {
}
}
Download file