use of android.os.ResultReceiver in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TetherService method fireCallbacksForType.
private void fireCallbacksForType(int type, int result) {
List<ResultReceiver> callbacksForType = mPendingCallbacks.get(type);
if (callbacksForType == null) {
return;
}
int errorCode = result == RESULT_OK ? ConnectivityManager.TETHER_ERROR_NO_ERROR : ConnectivityManager.TETHER_ERROR_PROVISION_FAILED;
for (ResultReceiver callback : callbacksForType) {
if (DEBUG)
Log.d(TAG, "Firing result: " + errorCode + " to callback");
callback.send(errorCode, null);
}
callbacksForType.clear();
}
use of android.os.ResultReceiver in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TetherService method onCreate.
@Override
public void onCreate() {
super.onCreate();
if (DEBUG)
Log.d(TAG, "Creating TetherService");
String provisionResponse = getResources().getString(com.android.internal.R.string.config_mobile_hotspot_provision_response);
registerReceiver(mReceiver, new IntentFilter(provisionResponse), android.Manifest.permission.CONNECTIVITY_INTERNAL, null);
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
mCurrentTethers = stringToTethers(prefs.getString(KEY_TETHERS, ""));
mCurrentTypeIndex = 0;
mPendingCallbacks = new ArrayMap<>(3);
mPendingCallbacks.put(ConnectivityManager.TETHERING_WIFI, new ArrayList<ResultReceiver>());
mPendingCallbacks.put(ConnectivityManager.TETHERING_USB, new ArrayList<ResultReceiver>());
mPendingCallbacks.put(ConnectivityManager.TETHERING_BLUETOOTH, new ArrayList<ResultReceiver>());
if (mUsageManagerWrapper == null) {
mUsageManagerWrapper = new UsageStatsManagerWrapper(this);
}
}
use of android.os.ResultReceiver in project android_frameworks_base by ResurrectionRemix.
the class ExitTransitionCoordinator method notifyComplete.
protected void notifyComplete() {
if (isReadyToNotify()) {
if (!mSharedElementNotified) {
mSharedElementNotified = true;
delayCancel();
if (mListener == null) {
mResultReceiver.send(MSG_TAKE_SHARED_ELEMENTS, mSharedElementBundle);
notifyExitComplete();
} else {
final ResultReceiver resultReceiver = mResultReceiver;
final Bundle sharedElementBundle = mSharedElementBundle;
mListener.onSharedElementsArrived(mSharedElementNames, mSharedElements, new OnSharedElementsReadyListener() {
@Override
public void onSharedElementsReady() {
resultReceiver.send(MSG_TAKE_SHARED_ELEMENTS, sharedElementBundle);
notifyExitComplete();
}
});
}
} else {
notifyExitComplete();
}
}
}
use of android.os.ResultReceiver in project android_frameworks_base by ResurrectionRemix.
the class Pm method runShellCommand.
private int runShellCommand(String serviceName, String[] args) {
final HandlerThread handlerThread = new HandlerThread("results");
handlerThread.start();
try {
ServiceManager.getService(serviceName).shellCommand(FileDescriptor.in, FileDescriptor.out, FileDescriptor.err, args, new ResultReceiver(new Handler(handlerThread.getLooper())));
return 0;
} catch (RemoteException e) {
e.printStackTrace();
} finally {
handlerThread.quitSafely();
}
return -1;
}
use of android.os.ResultReceiver in project android_frameworks_base by crdroidandroid.
the class BatteryService method dumpInternal.
private void dumpInternal(FileDescriptor fd, PrintWriter pw, String[] args) {
synchronized (mLock) {
if (args == null || args.length == 0 || "-a".equals(args[0])) {
pw.println("Current Battery Service state:");
if (mUpdatesStopped) {
pw.println(" (UPDATES STOPPED -- use 'reset' to restart)");
}
pw.println(" AC powered: " + mBatteryProps.chargerAcOnline);
pw.println(" USB powered: " + mBatteryProps.chargerUsbOnline);
pw.println(" Wireless powered: " + mBatteryProps.chargerWirelessOnline);
pw.println(" Max charging current: " + mBatteryProps.maxChargingCurrent);
pw.println(" Max charging voltage: " + mBatteryProps.maxChargingVoltage);
pw.println(" Charge counter: " + mBatteryProps.batteryChargeCounter);
pw.println(" status: " + mBatteryProps.batteryStatus);
pw.println(" health: " + mBatteryProps.batteryHealth);
pw.println(" present: " + mBatteryProps.batteryPresent);
pw.println(" level: " + mBatteryProps.batteryLevel);
pw.println(" scale: " + BATTERY_SCALE);
pw.println(" voltage: " + mBatteryProps.batteryVoltage);
pw.println(" temperature: " + mBatteryProps.batteryTemperature);
pw.println(" technology: " + mBatteryProps.batteryTechnology);
} else {
Shell shell = new Shell();
shell.exec(mBinderService, null, fd, null, args, new ResultReceiver(null));
}
}
}
Aggregations