CrackMe.apk
Download file
package androidx.media.app;
import android.app.Notification;
import android.app.PendingIntent;
import android.media.session.MediaSession;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.media.session.MediaSessionCompat;
import android.widget.RemoteViews;
import androidx.core.app.BundleCompat;
import androidx.core.app.NotificationBuilderWithBuilderAccessor;
import androidx.core.app.NotificationCompat;
import androidx.media.R;
public class NotificationCompat {
private NotificationCompat() {
}
public static class MediaStyle extends NotificationCompat.Style {
private static final int MAX_MEDIA_BUTTONS = 5;
private static final int MAX_MEDIA_BUTTONS_IN_COMPACT = 3;
int[] mActionsToShowInCompact = null;
PendingIntent mCancelButtonIntent;
boolean mShowCancelButton;
MediaSessionCompat.Token mToken;
public static MediaSessionCompat.Token getMediaSession(Notification notification) {
Bundle extras = androidx.core.app.NotificationCompat.getExtras(notification);
if (extras == null) {
return null;
}
if (Build.VERSION.SDK_INT >= 21) {
Parcelable parcelable = extras.getParcelable(androidx.core.app.NotificationCompat.EXTRA_MEDIA_SESSION);
if (parcelable != null) {
return MediaSessionCompat.Token.fromToken(parcelable);
}
return null;
}
IBinder binder = BundleCompat.getBinder(extras, androidx.core.app.NotificationCompat.EXTRA_MEDIA_SESSION);
if (binder == null) {
return null;
}
Parcel obtain = Parcel.obtain();
obtain.writeStrongBinder(binder);
obtain.setDataPosition(0);
MediaSessionCompat.Token createFromParcel = MediaSessionCompat.Token.CREATOR.createFromParcel(obtain);
obtain.recycle();
return createFromParcel;
}
public MediaStyle() {
}
public MediaStyle(NotificationCompat.Builder builder) {
setBuilder(builder);
}
public MediaStyle setShowActionsInCompactView(int... iArr) {
this.mActionsToShowInCompact = iArr;
return this;
}
public MediaStyle setMediaSession(MediaSessionCompat.Token token) {
this.mToken = token;
return this;
}
public MediaStyle setShowCancelButton(boolean z) {
if (Build.VERSION.SDK_INT < 21) {
this.mShowCancelButton = z;
}
return this;
}
public MediaStyle setCancelButtonIntent(PendingIntent pendingIntent) {
this.mCancelButtonIntent = pendingIntent;
return this;
}
public void apply(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
if (Build.VERSION.SDK_INT >= 21) {
Api21Impl.setMediaStyle(notificationBuilderWithBuilderAccessor.getBuilder(), Api21Impl.fillInMediaStyle(Api21Impl.createMediaStyle(), this.mActionsToShowInCompact, this.mToken));
} else if (this.mShowCancelButton) {
notificationBuilderWithBuilderAccessor.getBuilder().setOngoing(true);
}
}
public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
if (Build.VERSION.SDK_INT >= 21) {
return null;
}
return generateContentView();
}
/* access modifiers changed from: package-private */
public RemoteViews generateContentView() {
int i;
RemoteViews applyStandardTemplate = applyStandardTemplate(false, getContentViewLayoutResource(), true);
int size = this.mBuilder.mActions.size();
int[] iArr = this.mActionsToShowInCompact;
if (iArr == null) {
i = 0;
} else {
i = Math.min(iArr.length, 3);
}
applyStandardTemplate.removeAllViews(R.id.media_actions);
if (i > 0) {
int i2 = 0;
while (i2 < i) {
if (i2 < size) {
applyStandardTemplate.addView(R.id.media_actions, generateMediaActionButton(this.mBuilder.mActions.get(this.mActionsToShowInCompact[i2])));
i2++;
} else {
throw new IllegalArgumentException(String.format("setShowActionsInCompactView: action %d out of bounds (max %d)", new Object[]{Integer.valueOf(i2), Integer.valueOf(size - 1)}));
}
}
}
if (this.mShowCancelButton) {
applyStandardTemplate.setViewVisibility(R.id.end_padder, 8);
applyStandardTemplate.setViewVisibility(R.id.cancel_action, 0);
applyStandardTemplate.setOnClickPendingIntent(R.id.cancel_action, this.mCancelButtonIntent);
applyStandardTemplate.setInt(R.id.cancel_action, "setAlpha", this.mBuilder.mContext.getResources().getInteger(R.integer.cancel_button_image_alpha));
} else {
applyStandardTemplate.setViewVisibility(R.id.end_padder, 0);
applyStandardTemplate.setViewVisibility(R.id.cancel_action, 8);
}
return applyStandardTemplate;
}
private RemoteViews generateMediaActionButton(NotificationCompat.Action action) {
boolean z = action.getActionIntent() == null;
RemoteViews remoteViews = new RemoteViews(this.mBuilder.mContext.getPackageName(), R.layout.notification_media_action);
remoteViews.setImageViewResource(R.id.action0, action.getIcon());
if (!z) {
remoteViews.setOnClickPendingIntent(R.id.action0, action.getActionIntent());
}
if (Build.VERSION.SDK_INT >= 15) {
Api15Impl.setContentDescription(remoteViews, R.id.action0, action.getTitle());
}
return remoteViews;
}
/* access modifiers changed from: package-private */
public int getContentViewLayoutResource() {
return R.layout.notification_template_media;
}
public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
if (Build.VERSION.SDK_INT >= 21) {
return null;
}
return generateBigContentView();
}
/* access modifiers changed from: package-private */
public RemoteViews generateBigContentView() {
int min = Math.min(this.mBuilder.mActions.size(), 5);
RemoteViews applyStandardTemplate = applyStandardTemplate(false, getBigContentViewLayoutResource(min), false);
applyStandardTemplate.removeAllViews(R.id.media_actions);
if (min > 0) {
for (int i = 0; i < min; i++) {
applyStandardTemplate.addView(R.id.media_actions, generateMediaActionButton(this.mBuilder.mActions.get(i)));
}
}
if (this.mShowCancelButton) {
applyStandardTemplate.setViewVisibility(R.id.cancel_action, 0);
applyStandardTemplate.setInt(R.id.cancel_action, "setAlpha", this.mBuilder.mContext.getResources().getInteger(R.integer.cancel_button_image_alpha));
applyStandardTemplate.setOnClickPendingIntent(R.id.cancel_action, this.mCancelButtonIntent);
} else {
applyStandardTemplate.setViewVisibility(R.id.cancel_action, 8);
}
return applyStandardTemplate;
}
/* access modifiers changed from: package-private */
public int getBigContentViewLayoutResource(int i) {
if (i <= 3) {
return R.layout.notification_template_big_media_narrow;
}
return R.layout.notification_template_big_media;
}
}
public static class DecoratedMediaCustomViewStyle extends MediaStyle {
public void apply(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
if (Build.VERSION.SDK_INT >= 24) {
Api21Impl.setMediaStyle(notificationBuilderWithBuilderAccessor.getBuilder(), Api21Impl.fillInMediaStyle(Api24Impl.createDecoratedMediaCustomViewStyle(), this.mActionsToShowInCompact, this.mToken));
} else {
super.apply(notificationBuilderWithBuilderAccessor);
}
}
public RemoteViews makeContentView(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
if (Build.VERSION.SDK_INT >= 24) {
return null;
}
boolean z = true;
boolean z2 = this.mBuilder.getContentView() != null;
if (Build.VERSION.SDK_INT >= 21) {
if (!z2 && this.mBuilder.getBigContentView() == null) {
z = false;
}
if (z) {
RemoteViews generateContentView = generateContentView();
if (z2) {
buildIntoRemoteViews(generateContentView, this.mBuilder.getContentView());
}
setBackgroundColor(generateContentView);
return generateContentView;
}
} else {
RemoteViews generateContentView2 = generateContentView();
if (z2) {
buildIntoRemoteViews(generateContentView2, this.mBuilder.getContentView());
return generateContentView2;
}
}
return null;
}
/* access modifiers changed from: package-private */
public int getContentViewLayoutResource() {
if (this.mBuilder.getContentView() != null) {
return R.layout.notification_template_media_custom;
}
return super.getContentViewLayoutResource();
}
public RemoteViews makeBigContentView(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
RemoteViews remoteViews;
if (Build.VERSION.SDK_INT >= 24) {
return null;
}
if (this.mBuilder.getBigContentView() != null) {
remoteViews = this.mBuilder.getBigContentView();
} else {
remoteViews = this.mBuilder.getContentView();
}
if (remoteViews == null) {
return null;
}
RemoteViews generateBigContentView = generateBigContentView();
buildIntoRemoteViews(generateBigContentView, remoteViews);
if (Build.VERSION.SDK_INT >= 21) {
setBackgroundColor(generateBigContentView);
}
return generateBigContentView;
}
/* access modifiers changed from: package-private */
public int getBigContentViewLayoutResource(int i) {
if (i <= 3) {
return R.layout.notification_template_big_media_narrow_custom;
}
return R.layout.notification_template_big_media_custom;
}
public RemoteViews makeHeadsUpContentView(NotificationBuilderWithBuilderAccessor notificationBuilderWithBuilderAccessor) {
RemoteViews remoteViews;
if (Build.VERSION.SDK_INT >= 24) {
return null;
}
if (this.mBuilder.getHeadsUpContentView() != null) {
remoteViews = this.mBuilder.getHeadsUpContentView();
} else {
remoteViews = this.mBuilder.getContentView();
}
if (remoteViews == null) {
return null;
}
RemoteViews generateBigContentView = generateBigContentView();
buildIntoRemoteViews(generateBigContentView, remoteViews);
if (Build.VERSION.SDK_INT >= 21) {
setBackgroundColor(generateBigContentView);
}
return generateBigContentView;
}
private void setBackgroundColor(RemoteViews remoteViews) {
int i;
if (this.mBuilder.getColor() != 0) {
i = this.mBuilder.getColor();
} else {
i = this.mBuilder.mContext.getResources().getColor(R.color.notification_material_background_media_default_color);
}
remoteViews.setInt(R.id.status_bar_latest_event_content, "setBackgroundColor", i);
}
}
private static class Api15Impl {
private Api15Impl() {
}
static void setContentDescription(RemoteViews remoteViews, int i, CharSequence charSequence) {
remoteViews.setContentDescription(i, charSequence);
}
}
private static class Api21Impl {
private Api21Impl() {
}
static void setMediaStyle(Notification.Builder builder, Notification.MediaStyle mediaStyle) {
builder.setStyle(mediaStyle);
}
static Notification.MediaStyle createMediaStyle() {
return new Notification.MediaStyle();
}
static Notification.MediaStyle fillInMediaStyle(Notification.MediaStyle mediaStyle, int[] iArr, MediaSessionCompat.Token token) {
if (iArr != null) {
setShowActionsInCompactView(mediaStyle, iArr);
}
if (token != null) {
setMediaSession(mediaStyle, (MediaSession.Token) token.getToken());
}
return mediaStyle;
}
static void setShowActionsInCompactView(Notification.MediaStyle mediaStyle, int... iArr) {
mediaStyle.setShowActionsInCompactView(iArr);
}
static void setMediaSession(Notification.MediaStyle mediaStyle, MediaSession.Token token) {
mediaStyle.setMediaSession(token);
}
}
private static class Api24Impl {
private Api24Impl() {
}
static Notification.DecoratedMediaCustomViewStyle createDecoratedMediaCustomViewStyle() {
return new Notification.DecoratedMediaCustomViewStyle();
}
}
}
Download file