Search in sources :

Example 66 with ResultReceiver

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();
}
Also used : ResultReceiver(android.os.ResultReceiver)

Example 67 with ResultReceiver

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);
    }
}
Also used : IntentFilter(android.content.IntentFilter) SharedPreferences(android.content.SharedPreferences) ResultReceiver(android.os.ResultReceiver)

Example 68 with ResultReceiver

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();
        }
    }
}
Also used : Bundle(android.os.Bundle) OnSharedElementsReadyListener(android.app.SharedElementCallback.OnSharedElementsReadyListener) ResultReceiver(android.os.ResultReceiver)

Example 69 with ResultReceiver

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;
}
Also used : HandlerThread(android.os.HandlerThread) Handler(android.os.Handler) RemoteException(android.os.RemoteException) ResultReceiver(android.os.ResultReceiver)

Example 70 with ResultReceiver

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));
        }
    }
}
Also used : ResultReceiver(android.os.ResultReceiver)

Aggregations

ResultReceiver (android.os.ResultReceiver)70 Bundle (android.os.Bundle)38 RemoteException (android.os.RemoteException)11 Handler (android.os.Handler)9 HandlerThread (android.os.HandlerThread)6 OnSharedElementsReadyListener (android.app.SharedElementCallback.OnSharedElementsReadyListener)5 Intent (android.content.Intent)5 Parcel (android.os.Parcel)5 Parcelable (android.os.Parcelable)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 JSONArray (org.json.JSONArray)5 JSONException (org.json.JSONException)5 ParcelFileDescriptor (android.os.ParcelFileDescriptor)4 File (java.io.File)4 SharedPreferences (android.content.SharedPreferences)3 IOException (java.io.IOException)3 Point (android.graphics.Point)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2 IResultReceiver (com.android.internal.os.IResultReceiver)2 JSONObject (org.json.JSONObject)2