summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-07-19 13:49:20 -0700
committerRoman Birg <roman@cyngn.com>2016-07-25 08:42:43 -0700
commitb4600cdbfb5001680a1d68205bfa3c345b2cb318 (patch)
tree3ee616d77f8ea334b8aac87e8930bfa9d0b724cd /packages/SystemUI
parent1af5e7f2c2d6d3d41694431fade7a12b51eb65be (diff)
downloadframeworks_base-b4600cdbfb5001680a1d68205bfa3c345b2cb318.zip
frameworks_base-b4600cdbfb5001680a1d68205bfa3c345b2cb318.tar.gz
frameworks_base-b4600cdbfb5001680a1d68205bfa3c345b2cb318.tar.bz2
SystemUI: don't automatically disable compass tile
Persist the user state until they disable it. Ticket: CYNGNOS-3135 Change-Id: I9956f78419e94cc63b6a6ecabd28075a32192c2a Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CompassTile.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CompassTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CompassTile.java
index f19e466..85790d1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CompassTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CompassTile.java
@@ -32,6 +32,7 @@ public class CompassTile extends QSTile<QSTile.BooleanState> implements SensorEv
private final static float ALPHA = 0.97f;
private boolean mActive = false;
+ private boolean mListening = false;
private SensorManager mSensorManager;
private Sensor mAccelerationSensor;
@@ -95,7 +96,7 @@ public class CompassTile extends QSTile<QSTile.BooleanState> implements SensorEv
Float degrees = arg == null ? 0 :(float) arg;
state.visible = true;
- state.value = mActive;
+ state.value = mActive && mListening;
if (state.value) {
state.icon = ResourceIcon.get(R.drawable.ic_qs_compass_on);
@@ -126,10 +127,10 @@ public class CompassTile extends QSTile<QSTile.BooleanState> implements SensorEv
@Override
public void setListening(boolean listening) {
- if (!listening) {
- setListeningSensors(false);
- mActive = false;
- }
+ // setListening might get called multiple times with the same value, we check for it
+ // in setListeningSensors
+ mListening = listening;
+ setListeningSensors(mListening && mActive);
}
private String formatValueWithCardinalDirection(float degree) {