Search in sources :

Example 1 with OnLifecycleEvent

use of androidx.lifecycle.OnLifecycleEvent in project android_packages_apps_Settings by omnirom.

the class SmartAutoRotateController method onStart.

@OnLifecycleEvent(ON_START)
public void onStart() {
    mContext.registerReceiver(mReceiver, new IntentFilter(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED));
    if (mRotationPolicyListener == null) {
        mRotationPolicyListener = new RotationPolicy.RotationPolicyListener() {

            @Override
            public void onChange() {
                updateState(mPreference);
            }
        };
    }
    RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener);
}
Also used : IntentFilter(android.content.IntentFilter) RotationPolicy(com.android.internal.view.RotationPolicy) OnLifecycleEvent(androidx.lifecycle.OnLifecycleEvent)

Example 2 with OnLifecycleEvent

use of androidx.lifecycle.OnLifecycleEvent in project android_packages_apps_Settings by omnirom.

the class CategoryMixin method onResume.

/**
 * Resume Lifecycle event
 */
@OnLifecycleEvent(ON_RESUME)
public void onResume() {
    final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
    filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
    filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
    filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
    filter.addDataScheme(DATA_SCHEME_PKG);
    mContext.registerReceiver(mPackageReceiver, filter);
    updateCategories();
}
Also used : IntentFilter(android.content.IntentFilter) OnLifecycleEvent(androidx.lifecycle.OnLifecycleEvent)

Example 3 with OnLifecycleEvent

use of androidx.lifecycle.OnLifecycleEvent in project android_packages_apps_Settings by omnirom.

the class SimStatusDialogController method onResume.

/**
 * OnResume lifecycle event, resume listening for phone state or subscription changes.
 */
@OnLifecycleEvent(Event.ON_RESUME)
public void onResume() {
    if (mSubscriptionInfo == null) {
        return;
    }
    mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubscriptionInfo.getSubscriptionId());
    mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(), mTelephonyCallback);
    mSubscriptionManager.addOnSubscriptionsChangedListener(mContext.getMainExecutor(), mOnSubscriptionsChangedListener);
    registerImsRegistrationCallback(mSubscriptionInfo.getSubscriptionId());
    if (mShowLatestAreaInfo) {
        updateAreaInfoText();
        mContext.registerReceiver(mAreaInfoReceiver, new IntentFilter(CellBroadcastIntents.ACTION_AREA_INFO_UPDATED));
    }
    mIsRegisteredListener = true;
}
Also used : IntentFilter(android.content.IntentFilter) OnLifecycleEvent(androidx.lifecycle.OnLifecycleEvent)

Example 4 with OnLifecycleEvent

use of androidx.lifecycle.OnLifecycleEvent in project android_packages_apps_Settings by omnirom.

the class NetworkProviderSimListController method onResume.

@OnLifecycleEvent(ON_RESUME)
public void onResume() {
    mChangeListener.start();
    IntentFilter filter = new IntentFilter();
    filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
    mContext.registerReceiver(mDataSubscriptionChangedReceiver, filter);
    update();
}
Also used : IntentFilter(android.content.IntentFilter) OnLifecycleEvent(androidx.lifecycle.OnLifecycleEvent)

Example 5 with OnLifecycleEvent

use of androidx.lifecycle.OnLifecycleEvent in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AccessibilityHearingAidPreferenceController method onResume.

@OnLifecycleEvent(Event.ON_RESUME)
public void onResume() {
    if (mHearingAidProfileSupported) {
        IntentFilter filter = new IntentFilter();
        filter.addAction(BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED);
        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
        mContext.registerReceiver(mHearingAidChangedReceiver, filter);
    }
}
Also used : IntentFilter(android.content.IntentFilter) OnLifecycleEvent(androidx.lifecycle.OnLifecycleEvent)

Aggregations

OnLifecycleEvent (androidx.lifecycle.OnLifecycleEvent)12 IntentFilter (android.content.IntentFilter)10 TetheringManager (android.net.TetheringManager)1 Handler (android.os.Handler)1 HandlerExecutor (android.os.HandlerExecutor)1 Window (android.view.Window)1 WindowManager (android.view.WindowManager)1 RotationPolicy (com.android.internal.view.RotationPolicy)1 MobileDataContentObserver (com.android.settings.network.MobileDataContentObserver)1 SubscriptionsChangeListener (com.android.settings.network.SubscriptionsChangeListener)1