Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have been trying to do this as well, and I can get pretty close! but I suspect this action is not actually allowed. We can launch the account preferences screen, but then an error pops up with a forced-close notification.</p> <p>We only need to start the following intent to launch the settings for a specific account:</p> <pre><code>Intent i = new Intent(Intent.ACTION_MAIN); ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.SubSettings"); i.setComponent(cn); </code></pre> <p>Basically, when ActivityManager starts the activity, via manually clicking on the account, the intent is:</p> <pre><code>01-17 11:28:39.738: I/ActivityManager(72): START {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 708 </code></pre> <p>Compare this with the Intent sent by our approach:</p> <pre><code>01-17 11:23:39.740: D/SetupSync(1359): Intent { act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings } </code></pre> <p>HOWEVER, here's the caveat: then Android shows a forced close notification, and we can see in the logs:</p> <pre><code>01-17 11:23:39.767: E/AndroidRuntime(1359): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings } from ProcessRecord{415415b8 1359:org.mozilla.gecko/10044} (pid=1359, uid=10044) not exported from uid 1000 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.os.Parcel.readException(Parcel.java:1327) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.os.Parcel.readException(Parcel.java:1281) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1624) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.Activity.startActivityForResult(Activity.java:3190) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.Activity.startActivity(Activity.java:3297) 01-17 11:23:39.767: E/AndroidRuntime(1359): at org.mozilla.gecko.sync.setup.activities.SetupSyncActivity.onResume(SetupSyncActivity.java:148) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.Activity.performResume(Activity.java:4539) 01-17 11:23:39.767: E/AndroidRuntime(1359): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2433) 01-17 11:23:39.767: E/AndroidRuntime(1359): ... 12 more </code></pre> <p>So, what you can do is try/catch the RuntimeException, so it doesn't pop up. Seems a little sketchy, but if you want a hack, well, this achieves the desired result...</p> <p><strong>TL;DR: We can launch the settings for a specific account, but then the scary sorry-this-app-had-to-close dialogue pops up.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload