2

I want to open settings screen from my app.

I have made app exported = true in Manifest

Besides that I made sure that I pick correct configuration app while running

from this post -> Android - java.lang.SecurityException: Permission Denial: starting Intent

But still got this error

    java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.settings/.SubSettings } from ProcessRecord{a973751 21451:com.myapp.android.main/u0a157} (pid=21451, uid=10157) not exported from uid 1000

My code of launching the activity is

 val intentTwo = Intent()
        intentTwo.setClassName("com.android.settings",
            "com.android.settings.SubSettings")
        startActivity(intentTwo)

I have also tried this one

val intentOne = Intent()
        intentOne.setComponent(ComponentName("com.android.settings",
            "com.android.settings.SubSettings"))
        startActivity(intentOne)

Any ideas on that?

Bob Redity
  • 529
  • 5
  • 14
  • 1
    I think the error here is that subSettings is not exported to you, also I don't think it's possible to open that screen as "subSettings" can refer to many different things. Are you trying to open a specific page of the settings app or are you trying to open the settings app in general? – Dan Baruch Oct 19 '22 at 12:25
  • @DanBaruch yes. You are right. I am able to open the specific screen from the settings app. To open the settings I could try `Settings.ACTION_SOMETHING_HERE` but that's not what I want. I am trying to open specific screen which is `SubSettings` <- that's the name of the activity – Bob Redity Oct 19 '22 at 12:29
  • It's possible to open specific settings pages with either adb and such. Can you tell me exactly what screen are you trying to open? If I were to navigate to it manually, what would I have to open? – Dan Baruch Oct 19 '22 at 12:57
  • @DanBaruch sure. Its `TalkBack` screen from `Accessibility` options – Bob Redity Oct 19 '22 at 13:47

1 Answers1

0

SubSettings is not exported from the Settings app, at least for AOSP and Android 13. For any device configured this way, you cannot start this activity.

Also, please bear in mind that the system Settings app frequently gets modified by device manufacturers. As a result, there is no requirement for any device to even have SubSettings, let alone have it available to be started by external apps.

And, note that SubSettings does not seem to do much.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • From what I've seen by navigating through a lot of screen, SubSettings seems like a stub as in, you can navigate to several inner settings pages but if you would look up it's "path" in adb or something you'll end up getting subSetting at the end so I don't think there's a need to open "subSettings" specifically, since I think it's just a stub way for android to either hide the activities or prevent the "path" being too long – Dan Baruch Oct 19 '22 at 13:01
  • @DanBaruch ye. I agree. Maybe `SubSettings` is just a layer on top of other internal settings screens that we don't have an access to – Bob Redity Oct 19 '22 at 13:48
  • @DanBaruch is there a way to get the real activity name then? Ive tried through adb command but its never shows anything besides the actual `SubSettings` one – Bob Redity Oct 19 '22 at 13:49
  • @BobRedity unfortunately I haven't found a way around it 100%. I did find that if you find the Manifest.xml source of the Settings apk you can find many settings name and a lot of them can be opened directly via adb commands. I think TalkBack is not one of them though, if I remember correctly – Dan Baruch Oct 19 '22 at 17:08