Loading packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +15 −12 Original line number Diff line number Diff line Loading @@ -54,8 +54,10 @@ import android.graphics.Region; import android.graphics.drawable.VectorDrawable; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.HandlerExecutor; import android.os.HandlerThread; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings.Secure; import android.util.DisplayMetrics; import android.util.Log; Loading Loading @@ -298,13 +300,15 @@ public class ScreenDecorations extends SystemUI implements Tunable { updateColorInversion(value); } }; } mColorInversionSetting.setListening(true); mColorInversionSetting.onChange(false); } IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter, mHandler); mBroadcastDispatcher.registerReceiver(mUserSwitchIntentReceiver, filter, new HandlerExecutor(mHandler), UserHandle.ALL); mIsRegistered = true; } else { mMainHandler.post(() -> mTunerService.removeTunable(this)); Loading @@ -313,7 +317,7 @@ public class ScreenDecorations extends SystemUI implements Tunable { mColorInversionSetting.setListening(false); } mBroadcastDispatcher.unregisterReceiver(mIntentReceiver); mBroadcastDispatcher.unregisterReceiver(mUserSwitchIntentReceiver); mIsRegistered = false; } } Loading Loading @@ -503,18 +507,17 @@ public class ScreenDecorations extends SystemUI implements Tunable { } } private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { private final BroadcastReceiver mUserSwitchIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_USER_SWITCHED)) { int newUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, ActivityManager.getCurrentUser()); int newUserId = ActivityManager.getCurrentUser(); if (DEBUG) { Log.d(TAG, "UserSwitched newUserId=" + newUserId); } // update color inversion setting to the new user mColorInversionSetting.setUserId(newUserId); updateColorInversion(mColorInversionSetting.getValue()); } } }; private void updateColorInversion(int colorsInvertedValue) { Loading Loading
packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +15 −12 Original line number Diff line number Diff line Loading @@ -54,8 +54,10 @@ import android.graphics.Region; import android.graphics.drawable.VectorDrawable; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.HandlerExecutor; import android.os.HandlerThread; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings.Secure; import android.util.DisplayMetrics; import android.util.Log; Loading Loading @@ -298,13 +300,15 @@ public class ScreenDecorations extends SystemUI implements Tunable { updateColorInversion(value); } }; } mColorInversionSetting.setListening(true); mColorInversionSetting.onChange(false); } IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_SWITCHED); mBroadcastDispatcher.registerReceiverWithHandler(mIntentReceiver, filter, mHandler); mBroadcastDispatcher.registerReceiver(mUserSwitchIntentReceiver, filter, new HandlerExecutor(mHandler), UserHandle.ALL); mIsRegistered = true; } else { mMainHandler.post(() -> mTunerService.removeTunable(this)); Loading @@ -313,7 +317,7 @@ public class ScreenDecorations extends SystemUI implements Tunable { mColorInversionSetting.setListening(false); } mBroadcastDispatcher.unregisterReceiver(mIntentReceiver); mBroadcastDispatcher.unregisterReceiver(mUserSwitchIntentReceiver); mIsRegistered = false; } } Loading Loading @@ -503,18 +507,17 @@ public class ScreenDecorations extends SystemUI implements Tunable { } } private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { private final BroadcastReceiver mUserSwitchIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_USER_SWITCHED)) { int newUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, ActivityManager.getCurrentUser()); int newUserId = ActivityManager.getCurrentUser(); if (DEBUG) { Log.d(TAG, "UserSwitched newUserId=" + newUserId); } // update color inversion setting to the new user mColorInversionSetting.setUserId(newUserId); updateColorInversion(mColorInversionSetting.getValue()); } } }; private void updateColorInversion(int colorsInvertedValue) { Loading