Merge "Expose OPSTR_READ_DEVICE_IDENTIFIERS"

This commit is contained in:
Hall Liu
2020-01-23 01:56:42 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 3 deletions

View File

@@ -389,6 +389,7 @@ package android.app {
field public static final String OPSTR_POST_NOTIFICATION = "android:post_notification";
field public static final String OPSTR_PROJECT_MEDIA = "android:project_media";
field public static final String OPSTR_READ_CLIPBOARD = "android:read_clipboard";
field public static final String OPSTR_READ_DEVICE_IDENTIFIERS = "android:read_device_identifiers";
field public static final String OPSTR_READ_ICC_SMS = "android:read_icc_sms";
field public static final String OPSTR_READ_MEDIA_AUDIO = "android:read_media_audio";
field public static final String OPSTR_READ_MEDIA_IMAGES = "android:read_media_images";

View File

@@ -1159,6 +1159,7 @@ public class AppOpsManager {
@SystemApi
public static final String OPSTR_ACCESS_ACCESSIBILITY = "android:access_accessibility";
/** @hide Read device identifiers */
@SystemApi
public static final String OPSTR_READ_DEVICE_IDENTIFIERS = "android:read_device_identifiers";
/** @hide Query all packages on device */
public static final String OPSTR_QUERY_ALL_PACKAGES = "android:query_all_packages";

View File

@@ -205,7 +205,7 @@ public final class SmsApplication {
< android.os.Process.FIRST_APPLICATION_UID) {
return contextUserId;
} else {
return UserHandle.getUserId(callingUid);
return UserHandle.getUserHandleForUid(callingUid).getIdentifier();
}
}
@@ -811,10 +811,10 @@ public final class SmsApplication {
// This should never happen in prod -- unit tests will put the receiver into a
// unusual state where the pending result is null, which produces a NPE when calling
// getSendingUserId. Just pretend like it's the system user for testing.
userId = UserHandle.USER_SYSTEM;
userId = UserHandle.SYSTEM.getIdentifier();
}
Context userContext = mContext;
if (userId != UserHandle.USER_SYSTEM) {
if (userId != UserHandle.SYSTEM.getIdentifier()) {
try {
userContext = mContext.createPackageContextAsUser(mContext.getPackageName(), 0,
UserHandle.of(userId));