FileDocCategorySizeDatePackage
NextAlarmController.javaAPI DocAndroid 5.1 API2883Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar.policy

NextAlarmController

public class NextAlarmController extends android.content.BroadcastReceiver

Fields Summary
private final ArrayList
mChangeCallbacks
private android.app.AlarmManager
mAlarmManager
private AlarmManager.AlarmClockInfo
mNextAlarm
Constructors Summary
public NextAlarmController(android.content.Context context)


       
        mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_USER_SWITCHED);
        filter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
        context.registerReceiverAsUser(this, UserHandle.ALL, filter, null, null);
        updateNextAlarm();
    
Methods Summary
public voidaddStateChangedCallback(com.android.systemui.statusbar.policy.NextAlarmController$NextAlarmChangeCallback cb)

        mChangeCallbacks.add(cb);
        cb.onNextAlarmChanged(mNextAlarm);
    
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        pw.println("NextAlarmController state:");
        pw.print("  mNextAlarm="); pw.println(mNextAlarm);
    
private voidfireNextAlarmChanged()

        int n = mChangeCallbacks.size();
        for (int i = 0; i < n; i++) {
            mChangeCallbacks.get(i).onNextAlarmChanged(mNextAlarm);
        }
    
public voidonReceive(android.content.Context context, android.content.Intent intent)

        final String action = intent.getAction();
        if (action.equals(Intent.ACTION_USER_SWITCHED)
                || action.equals(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED)) {
            updateNextAlarm();
        }
    
public voidremoveStateChangedCallback(com.android.systemui.statusbar.policy.NextAlarmController$NextAlarmChangeCallback cb)

        mChangeCallbacks.remove(cb);
    
private voidupdateNextAlarm()

        mNextAlarm = mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT);
        fireNextAlarmChanged();