fix(settings): accept a permission mode only for photos

Merged
IM
5d ago
+91-21

Summary

Every mobile settings permission target accepted the full|limited modes. So an app id typed where --app belongs (settings permission deny notifications com.example.app) was refused as a bad mode, and when the output was discarded the change silently never happened. Only iOS photos honours a mode, and the runtimes already refuse one for every other target.

Now:

  • photos has its own form with the modes.
  • Other targets refuse a fourth positional with "takes no mode".
  • On app-scoped targets, a value that looks like a bundle or package id is refused with reason: setting_permission_app_positional, dispatched: no, the app in details.app, and the hint Pass the app with --app <id>.
  • The code stays INVALID_ARGS.

Before / after

Android emulator (Pixel 9 AVD, Android 16):

$ settings permission deny notifications com.android.chrome
base a4f2dcad0: INVALID_ARGS: settings permission mode must be full|limited.
head 1f9f64e1d: INVALID_ARGS: settings permission notifications takes no mode. Not dispatched. Next: Pass the app with --app com.android.chrome.
$ settings permission grant notifications --app com.android.chrome
head: Updated setting: permission
$ settings permission grant accessibility com.android.chrome     # macOS-only target, so no --app hint
head: INVALID_ARGS: settings permission accessibility takes no mode.

Validation

  • Head 1f9f64e1d, check:affected --run --head, exactCommit: true (same result at 0bac0145b). Format, lint, typecheck, layering, fallow, build and vitest-related pass. unit fails only on upload-http-deadline and committed-source-tree, which fail the same way on clean main on this macOS host.
  • The new settings.test.ts cases fail at base.