summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wesley.CW Wang <wesleycwwang@google.com> 2021-05-20 18:44:43 +0800
committer Wesley Wang <wesleycwwang@google.com> 2021-05-21 10:13:57 +0000
commit0b174a944f55acfddf77ec6dbee7fd1c61b7c387 (patch)
treeeb6376bab911b3583fb191063503861d389036b3
parentb04a005c3f31f2444007ee2973427b31d4df7d8e (diff)
Add uId into AppInfo page launch variable
- Insert uid as launch variable, make AppInfo page can receive uId to query battery usage data Bug: 178197718 Test: manual test, - Long click any work profile app from launcher -> app info -> launches fine - Long click any app from launcher -> app info -> launches fine Change-Id: I99941c04ab4ba7d98925e999e12929d11e379bcd
-rw-r--r--services/core/java/com/android/server/pm/LauncherAppsService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index de9add0d0b37..b135e88f40c7 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -1207,8 +1207,16 @@ public class LauncherAppsService extends SystemService {
final long ident = Binder.clearCallingIdentity();
try {
String packageName = component.getPackageName();
+ int uId = -1;
+ try {
+ uId = mContext.getPackageManager().getApplicationInfo(
+ packageName, PackageManager.MATCH_ANY_USER).uid;
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.d(TAG, "package not found: " + e);
+ }
intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", packageName, null));
+ intent.putExtra("uId", uId);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.setSourceBounds(sourceBounds);
} finally {