What is the core purpose of the android:permission attribute declared on an individual Activity (not on the manifest application element)?
- A.A. It requires any external caller to hold the specified permission before the system will allow startActivity() to succeed for that Activity; callers lacking the permission receive a SecurityException
- B.B. The permission attribute on an Activity grants the app elevated system privileges when that Activity is running
- C.C. It specifies which permissions the Activity will request from the user during its onCreate() method automatically
- D.D. android:permission on an Activity controls which apps can see the Activity in launcher queries via PackageManager.queryIntentActivities()
Why A is correct
The android:permission attribute on a component-level declaration restricts which callers can invoke that component. For an Activity, the system enforces the permission before delivering the startActivity() Intent. This is declarative access control enforced by the framework, complementing but not replacing runtime checks inside the Activity. It does not grant system privileges (B), auto-request permissions (C), or filter launcher queries (D) - queryIntentActivities respects exported status.
Know someone studying for Mobile Security Fundamentals? Send them this one.