Fields Summary |
---|
private static final String | TAG |
private static final boolean | DEBUG |
private final ArrayList | mCallbacks |
private final android.content.Context | mContext |
private final com.android.systemui.qs.GlobalSetting | mModeSetting |
private final com.android.systemui.qs.GlobalSetting | mConfigSetting |
private final android.app.INotificationManager | mNoMan |
private final LinkedHashMap | mConditions |
private final android.app.AlarmManager | mAlarmManager |
private final SetupObserver | mSetupObserver |
private int | mUserId |
private boolean | mRequesting |
private boolean | mRegistered |
private final android.service.notification.IConditionListener | mListener |
private final android.content.BroadcastReceiver | mReceiver |
Methods Summary |
---|
public void | addCallback(Callback callback)
mCallbacks.add(callback);
|
private void | fireConditionsChanged(android.service.notification.Condition[] conditions)
for (Callback cb : mCallbacks) {
cb.onConditionsChanged(conditions);
}
|
private void | fireEffectsSuppressorChanged()
for (Callback cb : mCallbacks) {
cb.onEffectsSupressorChanged();
}
|
private void | fireExitConditionChanged()
final Condition exitCondition = getExitCondition();
if (DEBUG) Slog.d(TAG, "exitCondition changed: " + exitCondition);
for (Callback cb : mCallbacks) {
cb.onExitConditionChanged(exitCondition);
}
|
private void | fireNextAlarmChanged()
for (Callback cb : mCallbacks) {
cb.onNextAlarmChanged();
}
|
private void | fireZenAvailableChanged(boolean available)
for (Callback cb : mCallbacks) {
cb.onZenAvailableChanged(available);
}
|
private void | fireZenChanged(int zen)
for (Callback cb : mCallbacks) {
cb.onZenChanged(zen);
}
|
public android.content.ComponentName | getEffectsSuppressor()
return NotificationManager.from(mContext).getEffectsSuppressor();
|
public android.service.notification.Condition | getExitCondition()
try {
final ZenModeConfig config = mNoMan.getZenModeConfig();
if (config != null) {
return config.exitCondition;
}
} catch (RemoteException e) {
// noop
}
return null;
|
public long | getNextAlarm()
final AlarmManager.AlarmClockInfo info = mAlarmManager.getNextAlarmClock(mUserId);
return info != null ? info.getTriggerTime() : 0;
|
public int | getZen()
return mModeSetting.getValue();
|
public boolean | isZenAvailable()
return mSetupObserver.isDeviceProvisioned() && mSetupObserver.isUserSetup();
|
public void | removeCallback(Callback callback)
mCallbacks.remove(callback);
|
public void | requestConditions(boolean request)
mRequesting = request;
try {
mNoMan.requestZenModeConditions(mListener, request ? Condition.FLAG_RELEVANT_NOW : 0);
} catch (RemoteException e) {
// noop
}
if (!mRequesting) {
mConditions.clear();
}
|
public void | setExitCondition(android.service.notification.Condition exitCondition)
try {
mNoMan.setZenModeCondition(exitCondition);
} catch (RemoteException e) {
// noop
}
|
public void | setUserId(int userId)
mUserId = userId;
if (mRegistered) {
mContext.unregisterReceiver(mReceiver);
}
final IntentFilter filter = new IntentFilter(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
filter.addAction(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED);
mContext.registerReceiverAsUser(mReceiver, new UserHandle(mUserId), filter, null, null);
mRegistered = true;
mSetupObserver.register();
|
public void | setZen(int zen)
mModeSetting.setValue(zen);
|
private void | updateConditions(android.service.notification.Condition[] conditions)
if (conditions == null || conditions.length == 0) return;
for (Condition c : conditions) {
if ((c.flags & Condition.FLAG_RELEVANT_NOW) == 0) continue;
mConditions.put(c.id, c);
}
fireConditionsChanged(
mConditions.values().toArray(new Condition[mConditions.values().size()]));
|