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

Commit b6fa989d authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Replace UserHandle.CURRENT with UserTracker"

parents 368f1c05 914836ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -199,7 +199,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
        }
        }


        mSecureSettings.registerContentObserverForUser(
        mSecureSettings.registerContentObserverForUser(
                Settings.Secure.getUriFor(Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK),
                Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK,
                false, /* notifyForDescendants */
                false, /* notifyForDescendants */
                mDoubleLineClockObserver,
                mDoubleLineClockObserver,
                UserHandle.USER_ALL
                UserHandle.USER_ALL
+3 −2
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import android.provider.Settings;
import android.util.Log;
import android.util.Log;


import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.settings.UserTracker;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -67,8 +68,8 @@ public class AccessibilityButtonModeObserver extends
    }
    }


    @Inject
    @Inject
    public AccessibilityButtonModeObserver(Context context) {
    public AccessibilityButtonModeObserver(Context context, UserTracker userTracker) {
        super(context, Settings.Secure.ACCESSIBILITY_BUTTON_MODE);
        super(context, userTracker, Settings.Secure.ACCESSIBILITY_BUTTON_MODE);
    }
    }


    @Override
    @Override
+3 −2
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import androidx.annotation.MainThread;
import androidx.annotation.Nullable;
import androidx.annotation.Nullable;


import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.settings.UserTracker;


import javax.inject.Inject;
import javax.inject.Inject;


@@ -48,8 +49,8 @@ public class AccessibilityButtonTargetsObserver extends
    }
    }


    @Inject
    @Inject
    public AccessibilityButtonTargetsObserver(Context context) {
    public AccessibilityButtonTargetsObserver(Context context, UserTracker userTracker) {
        super(context, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
        super(context, userTracker, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
    }
    }


    @Override
    @Override
+6 −2
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.annotation.NonNull;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.settings.UserTracker;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
@@ -44,6 +45,7 @@ import java.util.Objects;
public abstract class SecureSettingsContentObserver<T> {
public abstract class SecureSettingsContentObserver<T> {


    private final ContentResolver mContentResolver;
    private final ContentResolver mContentResolver;
    private final UserTracker mUserTracker;
    @VisibleForTesting
    @VisibleForTesting
    final ContentObserver mContentObserver;
    final ContentObserver mContentObserver;


@@ -52,9 +54,11 @@ public abstract class SecureSettingsContentObserver<T> {
    @VisibleForTesting
    @VisibleForTesting
    final List<T> mListeners = new ArrayList<>();
    final List<T> mListeners = new ArrayList<>();


    protected SecureSettingsContentObserver(Context context, String secureSettingsKey) {
    protected SecureSettingsContentObserver(Context context, UserTracker userTracker,
            String secureSettingsKey) {
        mKey = secureSettingsKey;
        mKey = secureSettingsKey;
        mContentResolver = context.getContentResolver();
        mContentResolver = context.getContentResolver();
        mUserTracker = userTracker;
        mContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
        mContentObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
            @Override
            @Override
            public void onChange(boolean selfChange) {
            public void onChange(boolean selfChange) {
@@ -103,7 +107,7 @@ public abstract class SecureSettingsContentObserver<T> {
     * See {@link Settings.Secure}.
     * See {@link Settings.Secure}.
     */
     */
    public final String getSettingsValue() {
    public final String getSettingsValue() {
        return Settings.Secure.getStringForUser(mContentResolver, mKey, UserHandle.USER_CURRENT);
        return Settings.Secure.getStringForUser(mContentResolver, mKey, mUserTracker.getUserId());
    }
    }


    private void updateValueChanged() {
    private void updateValueChanged() {
+5 −2
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ import android.os.Looper;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.UserHandle;
import android.util.Log;
import android.util.Log;
import android.view.Display;
import android.view.Display;
import android.view.IWindowManager;
import android.view.IWindowManager;
@@ -51,6 +50,7 @@ import com.android.internal.util.ScreenshotHelper;
import com.android.systemui.CoreStartable;
import com.android.systemui.CoreStartable;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.Recents;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
@@ -178,6 +178,7 @@ public class SystemActions implements CoreStartable {


    private final SystemActionsBroadcastReceiver mReceiver;
    private final SystemActionsBroadcastReceiver mReceiver;
    private final Context mContext;
    private final Context mContext;
    private final UserTracker mUserTracker;
    private final Optional<Recents> mRecentsOptional;
    private final Optional<Recents> mRecentsOptional;
    private Locale mLocale;
    private Locale mLocale;
    private final AccessibilityManager mA11yManager;
    private final AccessibilityManager mA11yManager;
@@ -189,11 +190,13 @@ public class SystemActions implements CoreStartable {


    @Inject
    @Inject
    public SystemActions(Context context,
    public SystemActions(Context context,
            UserTracker userTracker,
            NotificationShadeWindowController notificationShadeController,
            NotificationShadeWindowController notificationShadeController,
            ShadeController shadeController,
            ShadeController shadeController,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            Optional<Recents> recentsOptional) {
            Optional<Recents> recentsOptional) {
        mContext = context;
        mContext = context;
        mUserTracker = userTracker;
        mShadeController = shadeController;
        mShadeController = shadeController;
        mRecentsOptional = recentsOptional;
        mRecentsOptional = recentsOptional;
        mReceiver = new SystemActionsBroadcastReceiver();
        mReceiver = new SystemActionsBroadcastReceiver();
@@ -527,7 +530,7 @@ public class SystemActions implements CoreStartable {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        final String chooserClassName = AccessibilityButtonChooserActivity.class.getName();
        final String chooserClassName = AccessibilityButtonChooserActivity.class.getName();
        intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName);
        intent.setClassName(CHOOSER_PACKAGE_NAME, chooserClassName);
        mContext.startActivityAsUser(intent, UserHandle.CURRENT);
        mContext.startActivityAsUser(intent, mUserTracker.getUserHandle());
    }
    }


    private void handleAccessibilityShortcut() {
    private void handleAccessibilityShortcut() {
Loading