Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -1023,6 +1023,7 @@ public abstract class BaseStatusBar extends SystemUI implements } protected void setZenMode(int mode) { if (!isDeviceProvisioned()) return; final boolean change = mZenMode != mode; mZenMode = mode; final int N = mNotificationData.size(); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { public void setZenMode(int mode) { super.setZenMode(mode); if (mModeIcon == null) return; if (!isDeviceProvisioned()) return; final boolean limited = mode == Settings.Global.ZEN_MODE_LIMITED; final boolean full = mode == Settings.Global.ZEN_MODE_FULL; mModeIcon.setVisibility(full || limited ? View.VISIBLE : View.GONE); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java +16 −3 Original line number Diff line number Diff line Loading @@ -175,6 +175,10 @@ public class ZenModeView extends RelativeLayout { addView(mHintText, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } private boolean isApplicable() { return mAdapter != null && mAdapter.isApplicable(); } private void close() { mClosing = true; final int startBottom = mBottom; Loading Loading @@ -217,6 +221,11 @@ public class ZenModeView extends RelativeLayout { } private void updateState(boolean animate) { final boolean applicable = isApplicable(); setVisibility(applicable ? VISIBLE : GONE); if (!applicable) { return; } if (mAdapter != null && mAdapter.getMode() == Adapter.MODE_OFF && !mPeekable) { close(); } else { Loading Loading @@ -303,7 +312,8 @@ public class ZenModeView extends RelativeLayout { public boolean onInterceptTouchEvent(MotionEvent ev) { final boolean rt = super.onInterceptTouchEvent(ev); if (DEBUG) logTouchEvent("onInterceptTouchEvent", rt, ev); if (ev.getAction() == MotionEvent.ACTION_DOWN if (isApplicable() && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getY() > mCloseButton.getBottom() && mPeekable) { return true; Loading @@ -326,7 +336,7 @@ public class ZenModeView extends RelativeLayout { public boolean onTouchEvent(MotionEvent event) { boolean rt = super.onTouchEvent(event); if (DEBUG) logTouchEvent("onTouchEvent", rt, event); if (!mPeekable) { if (!isApplicable() || !mPeekable) { return rt; } if (event.getAction() == MotionEvent.ACTION_DOWN) { Loading Loading @@ -398,8 +408,10 @@ public class ZenModeView extends RelativeLayout { } public void dispatchExternalTouchEvent(MotionEvent ev) { if (isApplicable()) { onTouchEvent(ev); } } private static void bounce(final View v, final Runnable midBounce) { v.animate().scaleX(BOUNCE_SCALE).scaleY(BOUNCE_SCALE).setDuration(DURATION / 3) Loading Loading @@ -584,6 +596,7 @@ public class ZenModeView extends RelativeLayout { public static final int MODE_LIMITED = 1; public static final int MODE_FULL = 2; boolean isApplicable(); int getMode(); void setMode(int mode); void select(ExitCondition ec); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java +36 −8 Original line number Diff line number Diff line Loading @@ -33,27 +33,30 @@ public class ZenModeViewAdapter implements ZenModeView.Adapter { private final Context mContext; private final ContentResolver mResolver; private final Handler mHandler = new Handler(); private final SettingsObserver mObserver; private final List<ExitCondition> mExits = Arrays.asList( newExit("Until you delete this", "Until", "You delete this")); private Callbacks mCallbacks; private int mExitIndex; private boolean mDeviceProvisioned; private int mMode; public ZenModeViewAdapter(Context context) { mContext = context; mResolver = mContext.getContentResolver(); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false, new SettingsObserver(mHandler)); mObserver = new SettingsObserver(mHandler); mObserver.init(); } @Override public boolean isApplicable() { return mDeviceProvisioned; } @Override public int getMode() { final int v = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_OFF); if (v == Settings.Global.ZEN_MODE_LIMITED) return MODE_LIMITED; if (v == Settings.Global.ZEN_MODE_FULL) return MODE_FULL; return MODE_OFF; return mMode; } @Override Loading Loading @@ -137,9 +140,34 @@ public class ZenModeViewAdapter implements ZenModeView.Adapter { super(handler); } public void init() { loadSettings(); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false, this); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), false, this); } @Override public void onChange(boolean selfChange) { loadSettings(); mChange.run(); // already on handler } private void loadSettings() { mDeviceProvisioned = Settings.Global.getInt(mResolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0; mMode = getMode(); } private int getMode() { final int v = Settings.Global.getInt(mResolver, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_OFF); if (v == Settings.Global.ZEN_MODE_LIMITED) return MODE_LIMITED; if (v == Settings.Global.ZEN_MODE_FULL) return MODE_FULL; return MODE_OFF; } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -1023,6 +1023,7 @@ public abstract class BaseStatusBar extends SystemUI implements } protected void setZenMode(int mode) { if (!isDeviceProvisioned()) return; final boolean change = mZenMode != mode; mZenMode = mode; final int N = mNotificationData.size(); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { public void setZenMode(int mode) { super.setZenMode(mode); if (mModeIcon == null) return; if (!isDeviceProvisioned()) return; final boolean limited = mode == Settings.Global.ZEN_MODE_LIMITED; final boolean full = mode == Settings.Global.ZEN_MODE_FULL; mModeIcon.setVisibility(full || limited ? View.VISIBLE : View.GONE); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeView.java +16 −3 Original line number Diff line number Diff line Loading @@ -175,6 +175,10 @@ public class ZenModeView extends RelativeLayout { addView(mHintText, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } private boolean isApplicable() { return mAdapter != null && mAdapter.isApplicable(); } private void close() { mClosing = true; final int startBottom = mBottom; Loading Loading @@ -217,6 +221,11 @@ public class ZenModeView extends RelativeLayout { } private void updateState(boolean animate) { final boolean applicable = isApplicable(); setVisibility(applicable ? VISIBLE : GONE); if (!applicable) { return; } if (mAdapter != null && mAdapter.getMode() == Adapter.MODE_OFF && !mPeekable) { close(); } else { Loading Loading @@ -303,7 +312,8 @@ public class ZenModeView extends RelativeLayout { public boolean onInterceptTouchEvent(MotionEvent ev) { final boolean rt = super.onInterceptTouchEvent(ev); if (DEBUG) logTouchEvent("onInterceptTouchEvent", rt, ev); if (ev.getAction() == MotionEvent.ACTION_DOWN if (isApplicable() && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getY() > mCloseButton.getBottom() && mPeekable) { return true; Loading @@ -326,7 +336,7 @@ public class ZenModeView extends RelativeLayout { public boolean onTouchEvent(MotionEvent event) { boolean rt = super.onTouchEvent(event); if (DEBUG) logTouchEvent("onTouchEvent", rt, event); if (!mPeekable) { if (!isApplicable() || !mPeekable) { return rt; } if (event.getAction() == MotionEvent.ACTION_DOWN) { Loading Loading @@ -398,8 +408,10 @@ public class ZenModeView extends RelativeLayout { } public void dispatchExternalTouchEvent(MotionEvent ev) { if (isApplicable()) { onTouchEvent(ev); } } private static void bounce(final View v, final Runnable midBounce) { v.animate().scaleX(BOUNCE_SCALE).scaleY(BOUNCE_SCALE).setDuration(DURATION / 3) Loading Loading @@ -584,6 +596,7 @@ public class ZenModeView extends RelativeLayout { public static final int MODE_LIMITED = 1; public static final int MODE_FULL = 2; boolean isApplicable(); int getMode(); void setMode(int mode); void select(ExitCondition ec); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ZenModeViewAdapter.java +36 −8 Original line number Diff line number Diff line Loading @@ -33,27 +33,30 @@ public class ZenModeViewAdapter implements ZenModeView.Adapter { private final Context mContext; private final ContentResolver mResolver; private final Handler mHandler = new Handler(); private final SettingsObserver mObserver; private final List<ExitCondition> mExits = Arrays.asList( newExit("Until you delete this", "Until", "You delete this")); private Callbacks mCallbacks; private int mExitIndex; private boolean mDeviceProvisioned; private int mMode; public ZenModeViewAdapter(Context context) { mContext = context; mResolver = mContext.getContentResolver(); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false, new SettingsObserver(mHandler)); mObserver = new SettingsObserver(mHandler); mObserver.init(); } @Override public boolean isApplicable() { return mDeviceProvisioned; } @Override public int getMode() { final int v = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_OFF); if (v == Settings.Global.ZEN_MODE_LIMITED) return MODE_LIMITED; if (v == Settings.Global.ZEN_MODE_FULL) return MODE_FULL; return MODE_OFF; return mMode; } @Override Loading Loading @@ -137,9 +140,34 @@ public class ZenModeViewAdapter implements ZenModeView.Adapter { super(handler); } public void init() { loadSettings(); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.ZEN_MODE), false, this); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), false, this); } @Override public void onChange(boolean selfChange) { loadSettings(); mChange.run(); // already on handler } private void loadSettings() { mDeviceProvisioned = Settings.Global.getInt(mResolver, Settings.Global.DEVICE_PROVISIONED, 0) != 0; mMode = getMode(); } private int getMode() { final int v = Settings.Global.getInt(mResolver, Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_OFF); if (v == Settings.Global.ZEN_MODE_LIMITED) return MODE_LIMITED; if (v == Settings.Global.ZEN_MODE_FULL) return MODE_FULL; return MODE_OFF; } } }