Repost PageAgnostic mode notification when dismissed
Device is in experimental mode when using 16kB developer option. When the notification is dimissed, repost it again. Bug: 351029724 Test: m Settings && adb install -r $ANDROID_PRODUCT_OUT/system_ext/priv-app/Settings/Settings.apk Flag: EXEMPT bugfix Change-Id: Ie579b6c4dd060b165c6cc8ae635d48e257d49bec
This commit is contained in:
@@ -34,6 +34,8 @@ public class PageAgnosticNotificationService extends Service {
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_ID =
|
||||
"com.android.settings.development.PageAgnosticNotificationService";
|
||||
public static final String INTENT_ACTION_DISMISSED =
|
||||
"com.android.settings.development.NOTIFICATION_DISMISSED";
|
||||
private static final int NOTIFICATION_ID = 1;
|
||||
|
||||
static final int DISABLE_UPDATES_SETTING = 1;
|
||||
@@ -63,6 +65,9 @@ public class PageAgnosticNotificationService extends Service {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
createNotificationChannel();
|
||||
|
||||
// No updates should be allowed in page-agnostic mode
|
||||
disableAutomaticUpdates();
|
||||
}
|
||||
|
||||
private Notification buildNotification() {
|
||||
@@ -89,6 +94,15 @@ public class PageAgnosticNotificationService extends Service {
|
||||
notifyIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
Intent dismissIntent = new Intent(this, Enable16KBootReceiver.class);
|
||||
dismissIntent.setAction(INTENT_ACTION_DISMISSED);
|
||||
PendingIntent dismissPendingIntent =
|
||||
PendingIntent.getBroadcast(
|
||||
this.getApplicationContext(),
|
||||
0,
|
||||
dismissIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
Notification.Action action =
|
||||
new Notification.Action.Builder(
|
||||
R.drawable.empty_icon,
|
||||
@@ -104,6 +118,7 @@ public class PageAgnosticNotificationService extends Service {
|
||||
.setOngoing(true)
|
||||
.setSmallIcon(R.drawable.ic_settings_24dp)
|
||||
.setContentIntent(notifyPendingIntent)
|
||||
.setDeleteIntent(dismissPendingIntent)
|
||||
.addAction(action);
|
||||
|
||||
return builder.build();
|
||||
@@ -131,9 +146,6 @@ public class PageAgnosticNotificationService extends Service {
|
||||
if (mNotificationManager != null) {
|
||||
mNotificationManager.notify(NOTIFICATION_ID, notification);
|
||||
}
|
||||
|
||||
// No updates should be allowed in page-agnostic mode
|
||||
disableAutomaticUpdates();
|
||||
return Service.START_REDELIVER_INTENT;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user