1

I'd like to know the Intent for the AdvancedConnectedDeviceDashboardFragment. On API 28 this page can be reached through: Settings > Connected Devices > Connection Preferences.

This fragment contains all the advanced connection preferences(i.e, Bluetooth, NFC, USB..)

The logcat of the manual interaction:

D/SettingsActivity: Switching to fragment com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment
D/SubSettings: Launching fragment com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment

Launching it through SubSettings doesn't work:

try {
    Intent intent = new Intent();
    intent.setClassName("com.android.settings", "com.android.settings.SubSettings");
    getActivity().startActivity(intent);
} catch (ActivityNotFoundException e) {
    Log.e(LOG_TAG, e.getMessage());
}

Because it is not set exported="true" it gives me:

.SecurityException: Permission Denial: starting Intent { cmp=com.android.settings/.SubSettings (has extras) } from ProcessRecord{75bbdbc 11970:com.acme.application.debug/u0a460} (pid=11970, uid=10460) not exported from uid 1000

Is there a chance to start it through the parent SettingsActivity with Intent extras?

Martin Zeitler
  • 1
  • 19
  • 155
  • 216

1 Answers1

0

While browsing com.android.settings.Settings I've found the name of the SettingsActivity:

ConnectedDeviceDashboardActivity extends SettingsActivity
AdvancedConnectedDeviceActivity extends SettingsActivity

And so I've wrote a simple wrapper method, which still throws:

public void showSettings(@NonNull String activityName) throws ActivityNotFoundException {
    Intent intent = new Intent();
    intent.setClassName("com.android.settings", "com.android.settings.Settings$" + activityName);
    getActivity().startActivity(intent);
}

It can be used alike this:

try {
    showSettings("AdvancedConnectedDeviceActivity");
} catch (ActivityNotFoundException e) {
    Log.e(LOG_TAG, e.getMessage());
}

See Settings.java for further SettingsActivity names to use.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216