OSDN Git Service

resolve merge conflicts of 148db9dfa669 to oc-mr1-dev
[android-x86/frameworks-base.git] / packages / SystemUI / src / com / android / systemui / statusbar / phone / NavigationBarView.java
index 12fa946..94f8ef8 100644 (file)
@@ -59,6 +59,7 @@ import com.android.systemui.statusbar.policy.KeyButtonDrawable;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
+import java.util.function.Consumer;
 
 public class NavigationBarView extends FrameLayout implements PluginListener<NavGesture> {
     final static boolean DEBUG = false;
@@ -559,25 +560,19 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
     public void onFinishInflate() {
         mNavigationInflaterView = (NavigationBarInflaterView) findViewById(
                 R.id.navigation_inflater);
-        updateRotatedViews();
         mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers);
 
         getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
 
-        DockedStackExistsListener.register(exists -> mHandler.post(() -> {
-            mDockedStackExists = exists;
-            updateRecentsIcon();
-        }));
+        DockedStackExistsListener.register(mDockedListener);
+        updateRotatedViews();
     }
 
-    void updateRotatedViews() {
+    private void updateRotatedViews() {
         mRotatedViews[Surface.ROTATION_0] =
                 mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
         mRotatedViews[Surface.ROTATION_270] =
                 mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
-
-        mCurrentRotation = -1;
-        reorient();
     }
 
     public boolean needsReorient(int rotation) {
@@ -616,9 +611,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         }
 
         mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);
-        if (getRootView() instanceof NavigationBarFrame) {
-            ((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone);
-        }
+
+        ((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone);
+
         mDeadZone.setDisplayRotation(mCurrentRotation);
 
         // force the low profile & disabled states into compliance
@@ -759,6 +754,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
     @Override
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
+        reorient();
         onPluginDisconnected(null); // Create default gesture helper
         Dependency.get(PluginManager.class).addPluginListener(this,
                 NavGesture.class, false /* Only one */);
@@ -841,4 +837,8 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         void onVerticalChanged(boolean isVertical);
     }
 
+    private final Consumer<Boolean> mDockedListener = exists -> mHandler.post(() -> {
+        mDockedStackExists = exists;
+        updateRecentsIcon();
+    });
 }