Merge "Fix inconsistency in nav mode changes" into rvc-dev
This commit is contained in:
@@ -93,7 +93,6 @@ public class NavigationBarInflaterView extends FrameLayout
|
||||
|
||||
private boolean mIsVertical;
|
||||
private boolean mAlternativeOrder;
|
||||
private boolean mUsingCustomLayout;
|
||||
|
||||
private OverviewProxyService mOverviewProxyService;
|
||||
private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
|
||||
@@ -145,7 +144,6 @@ public class NavigationBarInflaterView extends FrameLayout
|
||||
@Override
|
||||
public void onNavigationModeChanged(int mode) {
|
||||
mNavBarMode = mode;
|
||||
onLikelyDefaultLayoutChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,17 +152,7 @@ public class NavigationBarInflaterView extends FrameLayout
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
public void setNavigationBarLayout(String layoutValue) {
|
||||
if (!Objects.equals(mCurrentLayout, layoutValue)) {
|
||||
mUsingCustomLayout = layoutValue != null;
|
||||
clearViews();
|
||||
inflateLayout(layoutValue);
|
||||
}
|
||||
}
|
||||
|
||||
public void onLikelyDefaultLayoutChange() {
|
||||
// Don't override custom layouts
|
||||
if (mUsingCustomLayout) return;
|
||||
|
||||
// Reevaluate new layout
|
||||
final String newValue = getDefaultLayout();
|
||||
|
||||
@@ -16,19 +16,14 @@
|
||||
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static android.content.Intent.ACTION_OVERLAY_CHANGED;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.om.IOverlayManager;
|
||||
import android.content.om.OverlayInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ApkAssets;
|
||||
import android.os.PatternMatcher;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
@@ -39,6 +34,7 @@ import android.util.Log;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.dagger.qualifiers.UiBackground;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -69,16 +65,6 @@ public class NavigationModeController implements Dumpable {
|
||||
|
||||
private ArrayList<ModeChangedListener> mListeners = new ArrayList<>();
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "ACTION_OVERLAY_CHANGED");
|
||||
}
|
||||
updateCurrentInteractionMode(true /* notify */);
|
||||
}
|
||||
};
|
||||
|
||||
private final DeviceProvisionedController.DeviceProvisionedListener mDeviceProvisionedCallback =
|
||||
new DeviceProvisionedController.DeviceProvisionedListener() {
|
||||
@Override
|
||||
@@ -97,6 +83,7 @@ public class NavigationModeController implements Dumpable {
|
||||
@Inject
|
||||
public NavigationModeController(Context context,
|
||||
DeviceProvisionedController deviceProvisionedController,
|
||||
ConfigurationController configurationController,
|
||||
@UiBackground Executor uiBgExecutor) {
|
||||
mContext = context;
|
||||
mCurrentUserContext = context;
|
||||
@@ -105,10 +92,15 @@ public class NavigationModeController implements Dumpable {
|
||||
mUiBgExecutor = uiBgExecutor;
|
||||
deviceProvisionedController.addCallback(mDeviceProvisionedCallback);
|
||||
|
||||
IntentFilter overlayFilter = new IntentFilter(ACTION_OVERLAY_CHANGED);
|
||||
overlayFilter.addDataScheme("package");
|
||||
overlayFilter.addDataSchemeSpecificPart("android", PatternMatcher.PATTERN_LITERAL);
|
||||
mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, overlayFilter, null, null);
|
||||
configurationController.addCallback(new ConfigurationController.ConfigurationListener() {
|
||||
@Override
|
||||
public void onOverlayChanged() {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onOverlayChanged");
|
||||
}
|
||||
updateCurrentInteractionMode(true /* notify */);
|
||||
}
|
||||
});
|
||||
|
||||
updateCurrentInteractionMode(false /* notify */);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user