use of android.os.HandlerExecutor in project android_packages_apps_Settings by omnirom.
the class NetworkRequestDialogActivity method onResume.
@Override
protected void onResume() {
super.onResume();
final WifiManager wifiManager = getSystemService(WifiManager.class);
if (wifiManager != null) {
wifiManager.registerNetworkRequestMatchCallback(new HandlerExecutor(mHandler), this);
}
// Sets time-out to stop scanning.
mHandler.sendEmptyMessageDelayed(MESSAGE_STOP_SCAN_WIFI_LIST, DELAY_TIME_STOP_SCAN_MS);
}
use of android.os.HandlerExecutor in project android_packages_apps_Settings by omnirom.
the class TetherSettings method onStart.
@Override
public void onStart() {
super.onStart();
if (mUnavailable) {
if (!isUiRestrictedByOnlyAdmin()) {
getEmptyTextView().setText(R.string.tethering_settings_not_available);
}
getPreferenceScreen().removeAll();
return;
}
mStartTetheringCallback = new OnStartTetheringCallback(this);
mTetheringEventCallback = new TetheringEventCallback();
mTm.registerTetheringEventCallback(new HandlerExecutor(mHandler), mTetheringEventCallback);
mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
registerReceiver();
mEthernetListener = new EthernetListener();
if (mEm != null)
mEm.addListener(mEthernetListener);
updateUsbState();
updateBluetoothAndEthernetState();
}
use of android.os.HandlerExecutor in project android_packages_apps_Settings by omnirom.
the class UsbDefaultFragment method startTethering.
private void startTethering() {
Log.d(TAG, "startTethering()");
mIsStartTethering = true;
mTetheringManager.startTethering(TETHERING_USB, new HandlerExecutor(mHandler), mOnStartTetheringCallback);
}
use of android.os.HandlerExecutor in project android_packages_apps_Settings by omnirom.
the class UsbDetailsFunctionsController method onRadioButtonClicked.
@Override
public void onRadioButtonClicked(RadioButtonPreference preference) {
final long function = UsbBackend.usbFunctionsFromString(preference.getKey());
final long previousFunction = mUsbBackend.getCurrentFunctions();
if (DEBUG) {
Log.d(TAG, "onRadioButtonClicked() function : " + function + ", toString() : " + UsbManager.usbFunctionsToString(function) + ", previousFunction : " + previousFunction + ", toString() : " + UsbManager.usbFunctionsToString(previousFunction));
}
if (function != previousFunction && !Utils.isMonkeyRunning() && !isClickEventIgnored(function, previousFunction)) {
mPreviousFunction = previousFunction;
// Update the UI in advance to make it looks smooth
final RadioButtonPreference prevPref = (RadioButtonPreference) mProfilesContainer.findPreference(UsbBackend.usbFunctionsToString(mPreviousFunction));
if (prevPref != null) {
prevPref.setChecked(false);
preference.setChecked(true);
}
if (function == UsbManager.FUNCTION_RNDIS || function == UsbManager.FUNCTION_NCM) {
// We need to have entitlement check for usb tethering, so use API in
// TetheringManager.
mTetheringManager.startTethering(TetheringManager.TETHERING_USB, new HandlerExecutor(mHandler), mOnStartTetheringCallback);
} else {
mUsbBackend.setCurrentFunctions(function);
}
}
}
use of android.os.HandlerExecutor in project android_packages_apps_Settings by omnirom.
the class TetherEnabler method onStart.
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onStart() {
mDataSaverBackend.addListener(this);
mSwitchWidgetController.setListener(this);
mSwitchWidgetController.startListening();
final IntentFilter filter = new IntentFilter(TetheringManager.ACTION_TETHER_STATE_CHANGED);
filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
mContext.registerReceiver(mTetherChangeReceiver, filter);
mTetheringEventCallback = new TetheringManager.TetheringEventCallback() {
@Override
public void onTetheredInterfacesChanged(List<String> interfaces) {
updateState(interfaces.toArray(new String[interfaces.size()]));
}
};
mTetheringManager.registerTetheringEventCallback(new HandlerExecutor(mMainThreadHandler), mTetheringEventCallback);
mOnStartTetheringCallback = new OnStartTetheringCallback(this);
updateState(null);
}
Aggregations