Loading packages/SystemUI/src/com/android/systemui/Prefs.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -38,7 +38,7 @@ import java.util.Set; * * NOTE: Clients of this class should take care to pass in the correct user context when querying * settings, otherwise you will always read/write for user 0 which is almost never what you want. * See {@link CurrentUserContextTracker} for a simple way to get the current context * See {@link UserContextProvider} for a simple way to get the current context */ public final class Prefs { private Prefs() {} // no instantation Loading packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +5 −5 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ import com.android.systemui.model.SysUiState; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.GlobalActions.GlobalActionsManager; import com.android.systemui.plugins.GlobalActionsPanelPlugin; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -252,7 +252,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, private final RingerModeTracker mRingerModeTracker; private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms private Handler mMainHandler; private CurrentUserContextTracker mCurrentUserContextTracker; private UserContextProvider mUserContextProvider; @VisibleForTesting boolean mShowLockScreenCardsAndControls = false; Loading Loading @@ -313,7 +313,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, UiEventLogger uiEventLogger, RingerModeTracker ringerModeTracker, SysUiState sysUiState, @Main Handler handler, ControlsComponent controlsComponent, CurrentUserContextTracker currentUserContextTracker) { UserContextProvider userContextProvider) { mContext = context; mWindowManagerFuncs = windowManagerFuncs; mAudioManager = audioManager; Loading Loading @@ -342,7 +342,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mControlsControllerOptional = controlsComponent.getControlsController(); mSysUiState = sysUiState; mMainHandler = handler; mCurrentUserContextTracker = currentUserContextTracker; mUserContextProvider = userContextProvider; // receive broadcasts IntentFilter filter = new IntentFilter(); Loading Loading @@ -436,7 +436,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, String[] preferredControlsPackages = mContext.getResources() .getStringArray(com.android.systemui.R.array.config_controlsPreferredPackages); SharedPreferences prefs = mCurrentUserContextTracker.getCurrentUserContext() SharedPreferences prefs = mUserContextProvider.getUserContext() .getSharedPreferences(PREFS_CONTROLS_FILE, Context.MODE_PRIVATE); Set<String> seededPackages = prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, Collections.emptySet()); Loading packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.UiEventLogger; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.LongRunning; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.io.IOException; Loading Loading @@ -79,12 +79,12 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis private final Executor mLongExecutor; private final UiEventLogger mUiEventLogger; private final NotificationManager mNotificationManager; private final CurrentUserContextTracker mUserContextTracker; private final UserContextProvider mUserContextTracker; @Inject public RecordingService(RecordingController controller, @LongRunning Executor executor, UiEventLogger uiEventLogger, NotificationManager notificationManager, CurrentUserContextTracker userContextTracker, KeyguardDismissUtil keyguardDismissUtil) { UserContextProvider userContextTracker, KeyguardDismissUtil keyguardDismissUtil) { mController = controller; mLongExecutor = executor; mUiEventLogger = uiEventLogger; Loading Loading @@ -120,7 +120,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis String action = intent.getAction(); Log.d(TAG, "onStartCommand " + action); int mCurrentUserId = mUserContextTracker.getCurrentUserContext().getUserId(); int mCurrentUserId = mUserContextTracker.getUserContext().getUserId(); UserHandle currentUser = new UserHandle(mCurrentUserId); switch (action) { case ACTION_START: Loading @@ -136,7 +136,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis setTapsVisible(mShowTaps); mRecorder = new ScreenMediaRecorder( mUserContextTracker.getCurrentUserContext(), mUserContextTracker.getUserContext(), mCurrentUserId, mAudioSource, this Loading @@ -156,7 +156,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis // we want to post the notifications for that user, which is NOT current user int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); if (userId == -1) { userId = mUserContextTracker.getCurrentUserContext().getUserId(); userId = mUserContextTracker.getUserContext().getUserId(); } Log.d(TAG, "notifying for user " + userId); stopRecording(userId); Loading packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java +5 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.widget.Spinner; import android.widget.Switch; import com.android.systemui.R; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import java.util.ArrayList; import java.util.List; Loading @@ -51,7 +51,7 @@ public class ScreenRecordDialog extends Activity { private static final String TAG = "ScreenRecordDialog"; private final RecordingController mController; private final CurrentUserContextTracker mCurrentUserContextTracker; private final UserContextProvider mUserContextProvider; private Switch mTapsSwitch; private Switch mAudioSwitch; private Spinner mOptions; Loading @@ -59,9 +59,9 @@ public class ScreenRecordDialog extends Activity { @Inject public ScreenRecordDialog(RecordingController controller, CurrentUserContextTracker currentUserContextTracker) { UserContextProvider userContextProvider) { mController = controller; mCurrentUserContextTracker = currentUserContextTracker; mUserContextProvider = userContextProvider; } @Override Loading Loading @@ -108,7 +108,7 @@ public class ScreenRecordDialog extends Activity { } private void requestScreenCapture() { Context userContext = mCurrentUserContextTracker.getCurrentUserContext(); Context userContext = mUserContextProvider.getUserContext(); boolean showTaps = mTapsSwitch.isChecked(); ScreenRecordingAudioSource audioMode = mAudioSwitch.isChecked() ? (ScreenRecordingAudioSource) mOptions.getSelectedItem() Loading packages/SystemUI/src/com/android/systemui/settings/CurrentUserContentResolverProvider.kt→packages/SystemUI/src/com/android/systemui/settings/UserContentResolverProvider.kt +5 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ package com.android.systemui.settings import android.content.ContentResolver interface CurrentUserContentResolverProvider { /** * Implemented by [UserTrackerImpl]. */ interface UserContentResolverProvider { val currentUserContentResolver: ContentResolver val userContentResolver: ContentResolver } No newline at end of file Loading
packages/SystemUI/src/com/android/systemui/Prefs.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; Loading @@ -38,7 +38,7 @@ import java.util.Set; * * NOTE: Clients of this class should take care to pass in the correct user context when querying * settings, otherwise you will always read/write for user 0 which is almost never what you want. * See {@link CurrentUserContextTracker} for a simple way to get the current context * See {@link UserContextProvider} for a simple way to get the current context */ public final class Prefs { private Prefs() {} // no instantation Loading
packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +5 −5 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ import com.android.systemui.model.SysUiState; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.GlobalActions.GlobalActionsManager; import com.android.systemui.plugins.GlobalActionsPanelPlugin; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -252,7 +252,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, private final RingerModeTracker mRingerModeTracker; private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms private Handler mMainHandler; private CurrentUserContextTracker mCurrentUserContextTracker; private UserContextProvider mUserContextProvider; @VisibleForTesting boolean mShowLockScreenCardsAndControls = false; Loading Loading @@ -313,7 +313,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, UiEventLogger uiEventLogger, RingerModeTracker ringerModeTracker, SysUiState sysUiState, @Main Handler handler, ControlsComponent controlsComponent, CurrentUserContextTracker currentUserContextTracker) { UserContextProvider userContextProvider) { mContext = context; mWindowManagerFuncs = windowManagerFuncs; mAudioManager = audioManager; Loading Loading @@ -342,7 +342,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, mControlsControllerOptional = controlsComponent.getControlsController(); mSysUiState = sysUiState; mMainHandler = handler; mCurrentUserContextTracker = currentUserContextTracker; mUserContextProvider = userContextProvider; // receive broadcasts IntentFilter filter = new IntentFilter(); Loading Loading @@ -436,7 +436,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, String[] preferredControlsPackages = mContext.getResources() .getStringArray(com.android.systemui.R.array.config_controlsPreferredPackages); SharedPreferences prefs = mCurrentUserContextTracker.getCurrentUserContext() SharedPreferences prefs = mUserContextProvider.getUserContext() .getSharedPreferences(PREFS_CONTROLS_FILE, Context.MODE_PRIVATE); Set<String> seededPackages = prefs.getStringSet(PREFS_CONTROLS_SEEDING_COMPLETED, Collections.emptySet()); Loading
packages/SystemUI/src/com/android/systemui/screenrecord/RecordingService.java +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.UiEventLogger; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.LongRunning; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.io.IOException; Loading Loading @@ -79,12 +79,12 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis private final Executor mLongExecutor; private final UiEventLogger mUiEventLogger; private final NotificationManager mNotificationManager; private final CurrentUserContextTracker mUserContextTracker; private final UserContextProvider mUserContextTracker; @Inject public RecordingService(RecordingController controller, @LongRunning Executor executor, UiEventLogger uiEventLogger, NotificationManager notificationManager, CurrentUserContextTracker userContextTracker, KeyguardDismissUtil keyguardDismissUtil) { UserContextProvider userContextTracker, KeyguardDismissUtil keyguardDismissUtil) { mController = controller; mLongExecutor = executor; mUiEventLogger = uiEventLogger; Loading Loading @@ -120,7 +120,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis String action = intent.getAction(); Log.d(TAG, "onStartCommand " + action); int mCurrentUserId = mUserContextTracker.getCurrentUserContext().getUserId(); int mCurrentUserId = mUserContextTracker.getUserContext().getUserId(); UserHandle currentUser = new UserHandle(mCurrentUserId); switch (action) { case ACTION_START: Loading @@ -136,7 +136,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis setTapsVisible(mShowTaps); mRecorder = new ScreenMediaRecorder( mUserContextTracker.getCurrentUserContext(), mUserContextTracker.getUserContext(), mCurrentUserId, mAudioSource, this Loading @@ -156,7 +156,7 @@ public class RecordingService extends Service implements MediaRecorder.OnInfoLis // we want to post the notifications for that user, which is NOT current user int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1); if (userId == -1) { userId = mUserContextTracker.getCurrentUserContext().getUserId(); userId = mUserContextTracker.getUserContext().getUserId(); } Log.d(TAG, "notifying for user " + userId); stopRecording(userId); Loading
packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordDialog.java +5 −5 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import android.widget.Spinner; import android.widget.Switch; import com.android.systemui.R; import com.android.systemui.settings.CurrentUserContextTracker; import com.android.systemui.settings.UserContextProvider; import java.util.ArrayList; import java.util.List; Loading @@ -51,7 +51,7 @@ public class ScreenRecordDialog extends Activity { private static final String TAG = "ScreenRecordDialog"; private final RecordingController mController; private final CurrentUserContextTracker mCurrentUserContextTracker; private final UserContextProvider mUserContextProvider; private Switch mTapsSwitch; private Switch mAudioSwitch; private Spinner mOptions; Loading @@ -59,9 +59,9 @@ public class ScreenRecordDialog extends Activity { @Inject public ScreenRecordDialog(RecordingController controller, CurrentUserContextTracker currentUserContextTracker) { UserContextProvider userContextProvider) { mController = controller; mCurrentUserContextTracker = currentUserContextTracker; mUserContextProvider = userContextProvider; } @Override Loading Loading @@ -108,7 +108,7 @@ public class ScreenRecordDialog extends Activity { } private void requestScreenCapture() { Context userContext = mCurrentUserContextTracker.getCurrentUserContext(); Context userContext = mUserContextProvider.getUserContext(); boolean showTaps = mTapsSwitch.isChecked(); ScreenRecordingAudioSource audioMode = mAudioSwitch.isChecked() ? (ScreenRecordingAudioSource) mOptions.getSelectedItem() Loading
packages/SystemUI/src/com/android/systemui/settings/CurrentUserContentResolverProvider.kt→packages/SystemUI/src/com/android/systemui/settings/UserContentResolverProvider.kt +5 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,10 @@ package com.android.systemui.settings import android.content.ContentResolver interface CurrentUserContentResolverProvider { /** * Implemented by [UserTrackerImpl]. */ interface UserContentResolverProvider { val currentUserContentResolver: ContentResolver val userContentResolver: ContentResolver } No newline at end of file