What is the android:exported default value for a Service that has NO intent-filter in its manifest declaration, targeting Android 12?
- A.A. false - a Service without an intent-filter defaults to exported=false and is only accessible to components within the same app
- B.B. true - all Services are exported by default to enable system services to bind to them
- C.C. undefined - the developer must always explicitly set exported; omitting it causes an install-time crash on Android 12
- D.D. false only if the Service uses the isolated process flag; otherwise it defaults to true
Why A is correct
For components without intent-filters, Android's default has always been exported=false. The Android 12 change only made the attribute required (non-optional) for components that DO have intent-filters, because those components previously defaulted to exported=true implicitly. A Service with no intent-filter still defaults to exported=false and can be omitted in the manifest without a build error on API 31 targets.
Know someone studying for Mobile Security Fundamentals? Send them this one.