private void pokeGpsExploit(final HardwareCallback callback, final int index) {
    Timeout.clearTimeout(gpsEventTimeout);

    // exploit a bug in the power manager widget
    final Intent poke = new Intent();
    poke.setClassName(
        "com.android.settings",
        "com.android.settings.widget.SettingsAppWidgetProvider"); //$NON-NLS-1$//$NON-NLS-2$
    poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
    poke.setData(Uri.parse("3")); // $NON-NLS-1$
    mContext.sendBroadcast(poke);

    // sit & wait for event, otherwise trigger backup safety time-out
    gpsEventTimeout =
        Timeout.setTimeout(
            new Runnable() {
              public void run() {
                gpsEventTimeout = -1;
                unbindGps();
                callback.hardwareFailedToEnable(
                    index, HardwareCallback.REASON_GPS_TOGGLE_EXPLOIT_ATTEMPT);
              }
            },
            5000);
  }
Esempio n. 2
0
 @Override
 public Timeout clearTimeout() {
   return delegate.clearTimeout();
 }