diff options
Diffstat (limited to 'src')
3 files changed, 9 insertions, 38 deletions
diff --git a/src/com/android/systemui/navigation/BaseEditor.java b/src/com/android/systemui/navigation/BaseEditor.java index fe05730..63c8a1c 100644 --- a/src/com/android/systemui/navigation/BaseEditor.java +++ b/src/com/android/systemui/navigation/BaseEditor.java @@ -90,12 +90,10 @@ public abstract class BaseEditor implements Editor { if (mode == MODE_ON) { changeEditMode(MODE_OFF); mHost.setSlippery(true); - mHost.mOrientationEventListener.enable(); } else { if (isEditorAvailable()) { changeEditMode(MODE_ON); mHost.setSlippery(false); - mHost.mOrientationEventListener.disable(); } else { toastState(69); } diff --git a/src/com/android/systemui/navigation/BaseNavigationBar.java b/src/com/android/systemui/navigation/BaseNavigationBar.java index 29eacd8..91e16e7 100644 --- a/src/com/android/systemui/navigation/BaseNavigationBar.java +++ b/src/com/android/systemui/navigation/BaseNavigationBar.java @@ -53,13 +53,11 @@ import android.graphics.Canvas; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.hardware.SensorManager; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.Display; -import android.view.OrientationEventListener; import android.view.Surface; import android.view.View; import android.view.ViewGroup; @@ -92,9 +90,7 @@ public abstract class BaseNavigationBar extends LinearLayout implements Navigato protected View mCurrentView = null; protected FrameLayout mRot0, mRot90; protected int mDisabledFlags = 0; - private int mLastRotation = Surface.ROTATION_0; protected int mNavigationIconHints = 0; - private boolean isOrientationListenerEnabled; protected boolean mVertical; protected boolean mScreenOn; protected boolean mLeftInLandscape; @@ -102,7 +98,6 @@ public abstract class BaseNavigationBar extends LinearLayout implements Navigato protected boolean mWakeAndUnlocking; protected boolean mScreenPinningEnabled; protected OnVerticalChangedListener mOnVerticalChangedListener; - protected OrientationEventListener mOrientationEventListener; protected SmartObserver mSmartObserver; protected PulseController mPulse; protected PhoneStatusBar mBar; @@ -160,21 +155,6 @@ public abstract class BaseNavigationBar extends LinearLayout implements Navigato mSmartObserver = new SmartObserver(mHandler, context.getContentResolver()); mSpringSystem = SpringSystem.create(); sIsTablet = !DUActionUtils.navigationBarCanMove(); - mOrientationEventListener = new OrientationEventListener(mContext, - SensorManager.SENSOR_DELAY_NORMAL) { - @Override - public void onOrientationChanged(int orientation) { - int rotation = mDisplay.getRotation(); - if (rotation != mLastRotation) { - setLeftInLandscape(rotation == Surface.ROTATION_270); - } - mLastRotation = rotation; - } - }; - if (mOrientationEventListener.canDetectOrientation()) { - mOrientationEventListener.enable(); - isOrientationListenerEnabled = true; - } } // require implementation. Surely they have something to clean up @@ -331,14 +311,6 @@ public abstract class BaseNavigationBar extends LinearLayout implements Navigato if (mPulse != null) { mPulse.setKeyguardShowing(showing); } - if (mScreenOn && !mKeyguardShowing && !isOrientationListenerEnabled - && mOrientationEventListener.canDetectOrientation()) { - mOrientationEventListener.enable(); - isOrientationListenerEnabled = true; - } else if (isOrientationListenerEnabled) { - mOrientationEventListener.disable(); - isOrientationListenerEnabled = false; - } onKeyguardShowing(showing); } } @@ -424,14 +396,6 @@ public abstract class BaseNavigationBar extends LinearLayout implements Navigato if (mPulse != null) { mPulse.notifyScreenOn(screenOn); } - if (mScreenOn && !mKeyguardShowing && !isOrientationListenerEnabled - && mOrientationEventListener.canDetectOrientation()) { - mOrientationEventListener.enable(); - isOrientationListenerEnabled = true; - } else if (isOrientationListenerEnabled) { - mOrientationEventListener.disable(); - isOrientationListenerEnabled = false; - } setDisabledFlags(mDisabledFlags, true); } diff --git a/src/com/android/systemui/navigation/NavigationController.java b/src/com/android/systemui/navigation/NavigationController.java index 21c4e1b..76e21d4 100644 --- a/src/com/android/systemui/navigation/NavigationController.java +++ b/src/com/android/systemui/navigation/NavigationController.java @@ -74,6 +74,7 @@ public class NavigationController implements PackageChangedListener { private boolean mScreenPinningEnabled; private Configuration mConfiguration; private Resources mResources; + private boolean mLeftInLandscape; private final Runnable mAddNavbar = new Runnable() { @Override @@ -156,6 +157,13 @@ public class NavigationController implements PackageChangedListener { return handled; } + public void leftInLandscapeChanged(boolean isLeft) { + mLeftInLandscape = isLeft; + if (mNavigationBarView != null) { + mNavigationBarView.setLeftInLandscape(isLeft); + } + } + public void recreateNavigationBar(Context context) { int navMode = Settings.Secure.getIntForUser(context.getContentResolver(), Settings.Secure.NAVIGATION_BAR_MODE, NAVIGATION_MODE_SMARTBAR, @@ -176,6 +184,7 @@ public class NavigationController implements PackageChangedListener { mNavigationBarView.setStatusBar(mBar); mNavigationBarView.setResourceMap(mResourceMap); mNavigationBarView.setControllers(mPulseController); + mNavigationBarView.setLeftInLandscape(mLeftInLandscape); } public Navigator getBar() { |
