summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Bookatz <bookatz@google.com> 2020-07-30 16:03:40 -0700
committer Adam Bookatz <bookatz@google.com> 2020-07-30 16:04:10 -0700
commit1599e0207ce6b7c97ab95ddb4e30fa45489ed49f (patch)
tree474ad46b19f6ddfad9dce294650d906393111324
parent75301c4bc6de506074e01b91385ee83c2f657f7c (diff)
Fix confusion of userId vs. uid
There function was trying to get the UserHandle of a userId, but was instead treating the userId as a uid, and thereby getting the wrong UserHandle. Bug: 162543841 Test: com.android.frameworks.telephonytests (i.e. FrameworksTelephonyTests) Change-Id: I2b6f9c92f1d101fe18a5fdf54b85aa5acf9c94b0
-rw-r--r--telephony/common/com/android/internal/telephony/CarrierAppUtils.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java
index e57b03098758..d4308c4c30ad 100644
--- a/telephony/common/com/android/internal/telephony/CarrierAppUtils.java
+++ b/telephony/common/com/android/internal/telephony/CarrierAppUtils.java
@@ -17,6 +17,7 @@
package com.android.internal.telephony;
import android.annotation.Nullable;
+import android.annotation.UserIdInt;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -74,7 +75,7 @@ public final class CarrierAppUtils {
* privileged apps may have changed.
*/
public static synchronized void disableCarrierAppsUntilPrivileged(String callingPackage,
- TelephonyManager telephonyManager, int userId, Context context) {
+ TelephonyManager telephonyManager, @UserIdInt int userId, Context context) {
if (DEBUG) {
Log.d(TAG, "disableCarrierAppsUntilPrivileged");
}
@@ -101,7 +102,7 @@ public final class CarrierAppUtils {
* Manager can kill it, and this can lead to crashes as the app is in an unexpected state.
*/
public static synchronized void disableCarrierAppsUntilPrivileged(String callingPackage,
- int userId, Context context) {
+ @UserIdInt int userId, Context context) {
if (DEBUG) {
Log.d(TAG, "disableCarrierAppsUntilPrivileged");
}
@@ -117,9 +118,9 @@ public final class CarrierAppUtils {
systemCarrierAssociatedAppsDisabledUntilUsed, context);
}
- private static ContentResolver getContentResolverForUser(Context context, int userId) {
- Context userContext = context.createContextAsUser(UserHandle.getUserHandleForUid(userId),
- 0);
+ private static ContentResolver getContentResolverForUser(Context context,
+ @UserIdInt int userId) {
+ Context userContext = context.createContextAsUser(UserHandle.of(userId), 0);
return userContext.getContentResolver();
}