Merge "Switch to task manager on tapping on long-running FGS alerts." into tm-dev am: 1016a19294
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17130357 Change-Id: Iefe099e51ecbec172c8d7186be2a279e73f62e8d
This commit is contained in:
@@ -182,7 +182,7 @@ public final class AppRestrictionController {
|
|||||||
/**
|
/**
|
||||||
* Whether or not to show the foreground service manager on tapping notifications.
|
* Whether or not to show the foreground service manager on tapping notifications.
|
||||||
*/
|
*/
|
||||||
private static final boolean ENABLE_SHOW_FOREGROUND_SERVICE_MANAGER = false;
|
private static final boolean ENABLE_SHOW_FOREGROUND_SERVICE_MANAGER = true;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final HandlerThread mBgHandlerThread;
|
private final HandlerThread mBgHandlerThread;
|
||||||
@@ -1595,8 +1595,8 @@ public final class AppRestrictionController {
|
|||||||
cancelRequestBgRestrictedIfNecessary(packageName, uid);
|
cancelRequestBgRestrictedIfNecessary(packageName, uid);
|
||||||
final Intent newIntent = new Intent(ACTION_SHOW_FOREGROUND_SERVICE_MANAGER);
|
final Intent newIntent = new Intent(ACTION_SHOW_FOREGROUND_SERVICE_MANAGER);
|
||||||
newIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
newIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
||||||
mContext.sendBroadcastAsUser(newIntent,
|
// Task manager runs in SystemUI, which is SYSTEM user only.
|
||||||
UserHandle.of(UserHandle.getUserId(uid)));
|
mContext.sendBroadcastAsUser(newIntent, UserHandle.SYSTEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1670,9 +1670,10 @@ public final class AppRestrictionController {
|
|||||||
if (ENABLE_SHOW_FOREGROUND_SERVICE_MANAGER) {
|
if (ENABLE_SHOW_FOREGROUND_SERVICE_MANAGER) {
|
||||||
final Intent intent = new Intent(ACTION_SHOW_FOREGROUND_SERVICE_MANAGER);
|
final Intent intent = new Intent(ACTION_SHOW_FOREGROUND_SERVICE_MANAGER);
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
|
||||||
|
// Task manager runs in SystemUI, which is SYSTEM user only.
|
||||||
pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0,
|
pendingIntent = PendingIntent.getBroadcastAsUser(mContext, 0,
|
||||||
intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE,
|
intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE,
|
||||||
UserHandle.of(UserHandle.getUserId(uid)));
|
UserHandle.SYSTEM);
|
||||||
} else {
|
} else {
|
||||||
final Intent intent = new Intent(Settings.ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL);
|
final Intent intent = new Intent(Settings.ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL);
|
||||||
intent.setData(Uri.fromParts(PACKAGE_SCHEME, packageName, null));
|
intent.setData(Uri.fromParts(PACKAGE_SCHEME, packageName, null));
|
||||||
@@ -1750,7 +1751,7 @@ public final class AppRestrictionController {
|
|||||||
SYSTEM_UID, UserHandle.getUserId(uid));
|
SYSTEM_UID, UserHandle.getUserId(uid));
|
||||||
final String title = mContext.getString(titleRes);
|
final String title = mContext.getString(titleRes);
|
||||||
final String message = mContext.getString(messageRes,
|
final String message = mContext.getString(messageRes,
|
||||||
ai != null ? pm.getText(packageName, ai.labelRes, ai) : packageName);
|
ai != null ? ai.loadLabel(pm) : packageName);
|
||||||
final Icon icon = ai != null ? Icon.createWithResource(packageName, ai.icon) : null;
|
final Icon icon = ai != null ? Icon.createWithResource(packageName, ai.icon) : null;
|
||||||
|
|
||||||
postNotification(notificationId, packageName, uid, title, message, icon, pendingIntent,
|
postNotification(notificationId, packageName, uid, title, message, icon, pendingIntent,
|
||||||
|
|||||||
Reference in New Issue
Block a user