Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6d602df authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Android (Google) Code Review
Browse files

Merge "Cleanup USER_OWNER in various services"

parents 29a52669 7c69636c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -57,15 +57,15 @@ public final class UserHandle implements Parcelable {

    /**
     * @hide A user id constant to indicate the "owner" user of the device
     * @deprecated Consider using either USER_SYSTEM constant or
     * UserInfo.isPrimary().
     * @deprecated Consider using either {@link UserHandle#USER_SYSTEM} constant or
     * check the target user's flag {@link android.content.pm.UserInfo#isAdmin}.
     */
    public static final int USER_OWNER = 0;

    /**
     * @hide A user handle to indicate the primary/owner user of the device
     * @deprecated Consider using either SYSTEM constant or
     * UserInfo.isPrimary().
     * @deprecated Consider using either {@link UserHandle#SYSTEM} constant or
     * check the target user's flag {@link android.content.pm.UserInfo#isAdmin}.
     */
    public static final UserHandle OWNER = new UserHandle(USER_OWNER);

@@ -280,6 +280,7 @@ public final class UserHandle implements Parcelable {
     * Returns true if this UserHandle refers to the owner user; false otherwise.
     * @return true if this UserHandle refers to the owner user; false otherwise.
     * @hide
     * TODO: find an alternative to this Api.
     */
    @SystemApi
    public final boolean isOwner() {
+4 −3
Original line number Diff line number Diff line
@@ -363,7 +363,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku

                    // ... and see if these are hosts we've been awaiting.
                    // NOTE: We are backing up and restoring only the owner.
                    if (newPackageAdded && userId == UserHandle.USER_OWNER) {
                    // TODO: http://b/22388012
                    if (newPackageAdded && userId == UserHandle.USER_SYSTEM) {
                        final int uid = getUidForPackage(pkgName, userId);
                        if (uid >= 0 ) {
                            resolveHostUidLocked(pkgName, uid);
@@ -2729,7 +2730,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            Host host = lookupHostLocked(oldHostId);
            if (host != null) {
                final int uid = getUidForPackage(NEW_KEYGUARD_HOST_PACKAGE,
                        UserHandle.USER_OWNER);
                        UserHandle.USER_SYSTEM);
                if (uid >= 0) {
                    host.id = new HostId(uid, KEYGUARD_HOST_ID, NEW_KEYGUARD_HOST_PACKAGE);
                }
@@ -2750,7 +2751,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
    private static AtomicFile getSavedStateFile(int userId) {
        File dir = Environment.getUserSystemDirectory(userId);
        File settingsFile = getStateFile(userId);
        if (!settingsFile.exists() && userId == UserHandle.USER_OWNER) {
        if (!settingsFile.exists() && userId == UserHandle.USER_SYSTEM) {
            if (!dir.exists()) {
                dir.mkdirs();
            }
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        int sysUiUid = -1;
        try {
            sysUiUid = mContext.getPackageManager().getPackageUid("com.android.systemui",
                    UserHandle.USER_OWNER);
                    UserHandle.USER_SYSTEM);
        } catch (PackageManager.NameNotFoundException e) {
            // Some platforms, such as wearables do not have a system ui.
            Log.w(TAG, "Unable to resolve SystemUI's UID.", e);
+1 −1
Original line number Diff line number Diff line
@@ -1689,7 +1689,7 @@ public class DeviceIdleController extends SystemService
        }

        if (args != null) {
            int userId = UserHandle.USER_OWNER;
            int userId = UserHandle.USER_SYSTEM;
            for (int i=0; i<args.length; i++) {
                String arg = args[i];
                if ("-h".equals(arg)) {
+1 −1
Original line number Diff line number Diff line
@@ -3504,7 +3504,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                throw new NullPointerException("methodMap is null");
            }
            mMethodMap = methodMap;
            final File systemDir = userId == UserHandle.USER_OWNER
            final File systemDir = userId == UserHandle.USER_SYSTEM
                    ? new File(Environment.getDataDirectory(), SYSTEM_PATH)
                    : Environment.getUserSystemDirectory(userId);
            final File inputMethodDir = new File(systemDir, INPUT_METHOD_PATH);
Loading