Loading proto/src/system_messages.proto +0 −3 Original line number Diff line number Diff line Loading @@ -252,9 +252,6 @@ message SystemMessage { // Package: android NOTE_ID_WIFI_SIM_REQUIRED = 60; // Inform the user a foreground service while-in-use permission is restricted. NOTE_FOREGROUND_SERVICE_WHILE_IN_USE_PERMISSION = 61; // Display the Android Debug Protocol status // Package: android NOTE_ADB_WIFI_ACTIVE = 62; Loading services/core/java/com/android/server/am/ActiveServices.java +1 −39 Original line number Diff line number Diff line Loading @@ -4920,35 +4920,7 @@ public final class ActiveServices { } // TODO: remove this toast after feature development is done private void showWhileInUsePermissionInFgsBlockedNotificationLocked(String callingPackage, String detailInfo) { final Context context = mAm.mContext; final String title = "Foreground Service While-in-use Permission Restricted"; final String content = "App affected:" + callingPackage + ", please file a bug report"; Notification.Builder n = new Notification.Builder(context, SystemNotificationChannels.ALERTS) .setSmallIcon(R.drawable.stat_sys_vitals) .setWhen(0) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setTicker(title) .setContentTitle(title) .setContentText(content) .setStyle(new Notification.BigTextStyle().bigText(detailInfo)); final NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE); notificationManager.notifyAsUser(null, SystemMessageProto.SystemMessage.NOTE_FOREGROUND_SERVICE_WHILE_IN_USE_PERMISSION, n.build(), UserHandle.ALL); } // TODO: remove this toast after feature development is done // show a toast message to ask user to file a bugreport so we know how many apps are impacted by // the new background started foreground service while-in-use permission restriction. void showWhileInUseDebugNotificationLocked(int uid, int op, int mode) { StringBuilder packageNameBuilder = new StringBuilder(); StringBuilder detailInfoBuilder = new StringBuilder(); void showWhileInUseDebugToastLocked(int uid, int op, int mode) { for (int i = mAm.mProcessList.mLruProcesses.size() - 1; i >= 0; i--) { ProcessRecord pr = mAm.mProcessList.mLruProcesses.get(i); if (pr.uid != uid) { Loading @@ -4965,18 +4937,8 @@ public final class ActiveServices { + " affected while-in-use permission:" + AppOpsManager.opToPublicName(op); Slog.wtf(TAG, msg); packageNameBuilder.append(r.mRecentCallingPackage + " "); detailInfoBuilder.append(msg); detailInfoBuilder.append("\n"); } } } final String callingPackageStr = packageNameBuilder.toString(); if (mAm.mConstants.mFlagForegroundServiceStartsLoggingEnabled && !callingPackageStr.isEmpty()) { showWhileInUsePermissionInFgsBlockedNotificationLocked(callingPackageStr, detailInfoBuilder.toString()); } } } services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -19352,7 +19352,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void showWhileInUseDebugToast(int uid, int op, int mode) { synchronized (ActivityManagerService.this) { ActivityManagerService.this.mServices.showWhileInUseDebugNotificationLocked( ActivityManagerService.this.mServices.showWhileInUseDebugToastLocked( uid, op, mode); } } Loading
proto/src/system_messages.proto +0 −3 Original line number Diff line number Diff line Loading @@ -252,9 +252,6 @@ message SystemMessage { // Package: android NOTE_ID_WIFI_SIM_REQUIRED = 60; // Inform the user a foreground service while-in-use permission is restricted. NOTE_FOREGROUND_SERVICE_WHILE_IN_USE_PERMISSION = 61; // Display the Android Debug Protocol status // Package: android NOTE_ADB_WIFI_ACTIVE = 62; Loading
services/core/java/com/android/server/am/ActiveServices.java +1 −39 Original line number Diff line number Diff line Loading @@ -4920,35 +4920,7 @@ public final class ActiveServices { } // TODO: remove this toast after feature development is done private void showWhileInUsePermissionInFgsBlockedNotificationLocked(String callingPackage, String detailInfo) { final Context context = mAm.mContext; final String title = "Foreground Service While-in-use Permission Restricted"; final String content = "App affected:" + callingPackage + ", please file a bug report"; Notification.Builder n = new Notification.Builder(context, SystemNotificationChannels.ALERTS) .setSmallIcon(R.drawable.stat_sys_vitals) .setWhen(0) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setTicker(title) .setContentTitle(title) .setContentText(content) .setStyle(new Notification.BigTextStyle().bigText(detailInfo)); final NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE); notificationManager.notifyAsUser(null, SystemMessageProto.SystemMessage.NOTE_FOREGROUND_SERVICE_WHILE_IN_USE_PERMISSION, n.build(), UserHandle.ALL); } // TODO: remove this toast after feature development is done // show a toast message to ask user to file a bugreport so we know how many apps are impacted by // the new background started foreground service while-in-use permission restriction. void showWhileInUseDebugNotificationLocked(int uid, int op, int mode) { StringBuilder packageNameBuilder = new StringBuilder(); StringBuilder detailInfoBuilder = new StringBuilder(); void showWhileInUseDebugToastLocked(int uid, int op, int mode) { for (int i = mAm.mProcessList.mLruProcesses.size() - 1; i >= 0; i--) { ProcessRecord pr = mAm.mProcessList.mLruProcesses.get(i); if (pr.uid != uid) { Loading @@ -4965,18 +4937,8 @@ public final class ActiveServices { + " affected while-in-use permission:" + AppOpsManager.opToPublicName(op); Slog.wtf(TAG, msg); packageNameBuilder.append(r.mRecentCallingPackage + " "); detailInfoBuilder.append(msg); detailInfoBuilder.append("\n"); } } } final String callingPackageStr = packageNameBuilder.toString(); if (mAm.mConstants.mFlagForegroundServiceStartsLoggingEnabled && !callingPackageStr.isEmpty()) { showWhileInUsePermissionInFgsBlockedNotificationLocked(callingPackageStr, detailInfoBuilder.toString()); } } }
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -19352,7 +19352,7 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void showWhileInUseDebugToast(int uid, int op, int mode) { synchronized (ActivityManagerService.this) { ActivityManagerService.this.mServices.showWhileInUseDebugNotificationLocked( ActivityManagerService.this.mServices.showWhileInUseDebugToastLocked( uid, op, mode); } }