Merge "Ensure that we use the current user context when adding nav mode listeners" into qt-dev
This commit is contained in:
@@ -44,6 +44,7 @@ import android.graphics.Region;
|
|||||||
import android.hardware.input.InputManager;
|
import android.hardware.input.InputManager;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Debug;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -450,20 +451,20 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
// Assumes device always starts with back button until launcher tells it that it does not
|
// Assumes device always starts with back button until launcher tells it that it does not
|
||||||
mBackButtonAlpha = 1.0f;
|
mBackButtonAlpha = 1.0f;
|
||||||
|
|
||||||
|
// Listen for nav bar mode changes
|
||||||
mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this);
|
mNavBarMode = Dependency.get(NavigationModeController.class).addListener(this);
|
||||||
|
|
||||||
// Listen for the package update changes.
|
// Listen for device provisioned/user setup
|
||||||
if (mDeviceProvisionedController.getCurrentUser() == UserHandle.USER_SYSTEM) {
|
updateEnabledState();
|
||||||
updateEnabledState();
|
mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback);
|
||||||
mDeviceProvisionedController.addCallback(mDeviceProvisionedCallback);
|
|
||||||
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
|
// Listen for launcher package changes
|
||||||
filter.addDataScheme("package");
|
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
|
||||||
filter.addDataSchemeSpecificPart(mRecentsComponentName.getPackageName(),
|
filter.addDataScheme("package");
|
||||||
PatternMatcher.PATTERN_LITERAL);
|
filter.addDataSchemeSpecificPart(mRecentsComponentName.getPackageName(),
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
PatternMatcher.PATTERN_LITERAL);
|
||||||
// TODO: Shouldn't this be per-user?
|
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||||
mContext.registerReceiver(mLauncherStateChangedReceiver, filter);
|
mContext.registerReceiver(mLauncherStateChangedReceiver, filter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyBackAction(boolean completed, int downX, int downY, boolean isButton,
|
public void notifyBackAction(boolean completed, int downX, int downY, boolean isButton,
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class NavigationModeController implements Dumpable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
private Context mCurrentUserContext;
|
||||||
private final IOverlayManager mOverlayManager;
|
private final IOverlayManager mOverlayManager;
|
||||||
private final DeviceProvisionedController mDeviceProvisionedController;
|
private final DeviceProvisionedController mDeviceProvisionedController;
|
||||||
private final UiOffloadThread mUiOffloadThread;
|
private final UiOffloadThread mUiOffloadThread;
|
||||||
@@ -127,6 +128,7 @@ public class NavigationModeController implements Dumpable {
|
|||||||
DeviceProvisionedController deviceProvisionedController,
|
DeviceProvisionedController deviceProvisionedController,
|
||||||
UiOffloadThread uiOffloadThread) {
|
UiOffloadThread uiOffloadThread) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mCurrentUserContext = context;
|
||||||
mOverlayManager = IOverlayManager.Stub.asInterface(
|
mOverlayManager = IOverlayManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.OVERLAY_SERVICE));
|
ServiceManager.getService(Context.OVERLAY_SERVICE));
|
||||||
mUiOffloadThread = uiOffloadThread;
|
mUiOffloadThread = uiOffloadThread;
|
||||||
@@ -145,13 +147,13 @@ public class NavigationModeController implements Dumpable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCurrentInteractionMode(boolean notify) {
|
public void updateCurrentInteractionMode(boolean notify) {
|
||||||
Context context = getCurrentUserContext();
|
mCurrentUserContext = getCurrentUserContext();
|
||||||
int mode = getCurrentInteractionMode(context);
|
int mode = getCurrentInteractionMode(mCurrentUserContext);
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.e(TAG, "updateCurrentInteractionMode: mode=" + mMode
|
Log.e(TAG, "updateCurrentInteractionMode: mode=" + mMode
|
||||||
+ " contextUser=" + context.getUserId());
|
+ " contextUser=" + mCurrentUserContext.getUserId());
|
||||||
dumpAssetPaths(context);
|
dumpAssetPaths(mCurrentUserContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notify) {
|
if (notify) {
|
||||||
@@ -163,7 +165,7 @@ public class NavigationModeController implements Dumpable {
|
|||||||
|
|
||||||
public int addListener(ModeChangedListener listener) {
|
public int addListener(ModeChangedListener listener) {
|
||||||
mListeners.add(listener);
|
mListeners.add(listener);
|
||||||
return getCurrentInteractionMode(mContext);
|
return getCurrentInteractionMode(mCurrentUserContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeListener(ModeChangedListener listener) {
|
public void removeListener(ModeChangedListener listener) {
|
||||||
@@ -265,7 +267,7 @@ public class NavigationModeController implements Dumpable {
|
|||||||
defaultOverlays = "failed_to_fetch";
|
defaultOverlays = "failed_to_fetch";
|
||||||
}
|
}
|
||||||
pw.println(" defaultOverlays=" + defaultOverlays);
|
pw.println(" defaultOverlays=" + defaultOverlays);
|
||||||
dumpAssetPaths(getCurrentUserContext());
|
dumpAssetPaths(mCurrentUserContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dumpAssetPaths(Context context) {
|
private void dumpAssetPaths(Context context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user