OSDN Git Service

use packageManager @SystemAPI
authorChen Xu <fionaxu@google.com>
Tue, 30 Jul 2019 22:02:00 +0000 (15:02 -0700)
committerChen Xu <fionaxu@google.com>
Thu, 26 Sep 2019 00:54:07 +0000 (17:54 -0700)
Bug: 137202333
Test: Build
Merged-In: I1c0cb7840cb7d68fd720723eec96aa51aefc1df8
Change-Id: I1c0cb7840cb7d68fd720723eec96aa51aefc1df8
(cherry picked from commit 4b5f423c5c1b0df63ad5b232351682ab79389580)

telephony/java/com/android/internal/telephony/SmsApplication.java
telephony/java/com/android/internal/telephony/TelephonyPermissions.java

index 98f52cb..6df5457 100644 (file)
@@ -158,7 +158,7 @@ public final class SmsApplication {
                 ApplicationInfo appInfo;
                 try {
                     appInfo = pm.getApplicationInfoAsUser(mPackageName, 0,
-                            UserHandle.getUserId(mUid));
+                            UserHandle.getUserHandleForUid(mUid));
                 } catch (NameNotFoundException e) {
                     return null;
                 }
@@ -300,7 +300,7 @@ public final class SmsApplication {
                 Uri.fromParts(SCHEME_SMSTO, "", null));
         List<ResolveInfo> respondServices = packageManager.queryIntentServicesAsUser(intent,
                 PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
-                userId);
+                UserHandle.getUserHandleForUid(userId));
         for (ResolveInfo resolveInfo : respondServices) {
             final ServiceInfo serviceInfo = resolveInfo.serviceInfo;
             if (serviceInfo == null) {
index 7a0ab9c..52fc8ce 100644 (file)
@@ -367,7 +367,7 @@ public final class TelephonyPermissions {
         ApplicationInfo callingPackageInfo = null;
         try {
             callingPackageInfo = context.getPackageManager().getApplicationInfoAsUser(
-                    callingPackage, 0, UserHandle.getUserId(uid));
+                    callingPackage, 0, UserHandle.getUserHandleForUid(uid));
             if (callingPackageInfo != null) {
                 if (callingPackageInfo.isSystemApp()) {
                     isPreinstalled = true;