Search in sources :

Example 1 with RegistrantList

use of android.os.RegistrantList in project android_frameworks_opt_telephony by LineageOS.

the class CarrierActionAgent method registerForCarrierAction.

/**
 * Register with CAA for a specific event.
 * @param action which carrier action registrant is interested in
 * @param notifyNow if carrier action has once set, notify registrant right after
 *                  registering, so that registrants will get the latest carrier action.
 */
public void registerForCarrierAction(int action, Handler h, int what, Object obj, boolean notifyNow) {
    Boolean carrierAction = getCarrierActionEnabled(action);
    if (carrierAction == null) {
        throw new IllegalArgumentException("invalid carrier action: " + action);
    }
    RegistrantList list = getRegistrantsFromAction(action);
    Registrant r = new Registrant(h, what, obj);
    list.add(r);
    if (notifyNow) {
        r.notifyRegistrant(new AsyncResult(null, carrierAction, null));
    }
}
Also used : RegistrantList(android.os.RegistrantList) Registrant(android.os.Registrant) AsyncResult(android.os.AsyncResult)

Example 2 with RegistrantList

use of android.os.RegistrantList in project android_frameworks_opt_telephony by LineageOS.

the class CarrierActionAgent method unregisterForCarrierAction.

/**
 * Unregister with CAA for a specific event. Callers will no longer be notified upon such event.
 * @param action which carrier action caller is no longer interested in
 */
public void unregisterForCarrierAction(Handler h, int action) {
    RegistrantList list = getRegistrantsFromAction(action);
    if (list == null) {
        throw new IllegalArgumentException("invalid carrier action: " + action);
    }
    list.remove(h);
}
Also used : RegistrantList(android.os.RegistrantList)

Aggregations

RegistrantList (android.os.RegistrantList)2 AsyncResult (android.os.AsyncResult)1 Registrant (android.os.Registrant)1