返回提示词目录第 1349 页

安卓应用运行风险与发布就绪审计

追踪安卓应用生命周期、协程与数据持久化行为,整理可复现缺陷、回归测试和发布验证清单。

完整提示词

I want you to perform an exhaustive, systematic, evidence-first, and production-oriented analysis of the entire Android application.

This is not a routine code review.

Treat this task as a unified combination of:

- senior Android architecture review
- Kotlin idioms and correctness review
- lifecycle audit
- Jetpack Compose or Views audit
- Coroutines / Flow audit
- threading and concurrency audit
- Room / persistence audit
- networking audit
- offline-first audit
- performance audit
- ANR and crash audit
- security audit
- permission model audit
- background execution audit
- WorkManager audit
- media playback audit if present
- Android TV audit if present
- accessibility review
- release-readiness audit
- Google Play Store compliance audit
- test coverage audit
- cross-version Android compatibility audit

Main goal:

> Determine how the Android application truly operates across lifecycles, processes, threads, storage, networks, and user journeys, uncover genuine production hazards, and assess its readiness for stable production deployment.

Priority:

**correctness > lifecycle safety > data integrity > reliability > security > performance > architecture elegance**

Do not invent problems to artificially inflate audit length.

Do not report an Android best practice unless a concrete justification exists within this specific codebase.

---

# 0. IDENTIFY ACTUAL ANDROID STACK

Before deep analysis, determine:

- Android Gradle Plugin (AGP) version
- Gradle version
- Kotlin version
- `compileSdk`
- `targetSdk`
- `minSdk`
- JDK toolchain version
- Jetpack Compose vs XML Views
- Compose BOM version if used
- Navigation component version
- Lifecycle library versions
- Coroutines version
- Room version
- DataStore version
- WorkManager version
- Retrofit / OkHttp / Ktor or other networking client
- dependency injection framework
- Hilt
- Koin
- Dagger
- manual DI
- serialization library (kotlinx.serialization, Moshi, Gson)
- testing frameworks
- build variants
- product flavors
- release build configuration

Inspect at minimum:

- root `build.gradle` / `build.gradle.kts`
- app and feature module Gradle files
- version catalogs (`libs.versions.toml`)
- `AndroidManifest.xml`
- ProGuard / R8 rule configurations
- source sets
- build variants
- Compose / View layout hierarchies
- navigation graphs
- data layer architecture
- repository implementations
- local database layer
- network layer
- background workers
- services
- broadcast receivers
- automated test suites

Do not rely on obsolete Android platform assumptions.

If a conclusion hinges on a specific Android OS, API level, or library version, identify that exact version first.

---

# 1. MAP COMPLETE ARCHITECTURE

Before filing findings, map the full application topology.

Identify:

- Activities
- Fragments
- Compose screens
- Navigation graph
- ViewModels
- domain / use-case layer
- repositories
- local data sources
- remote data sources
- Room databases
- DataStore preferences
- files and directories
- local caches
- WorkManager workers
- background and foreground services
- broadcast receivers
- content providers
- media playback components
- notification builders
- deep link entry points

Trace the actual end-to-end flow:

```text
UI
↓
ViewModel
↓
Use Case / Repository
↓
Local / Remote Data Source
↓
Room / API
↓
StateFlow / LiveData
↓
UI
```

If the project uses an alternative architectural pattern, document that actual pattern faithfully.

---

# 2. MODULE BOUNDARIES

If the project is modularized across multiple Gradle modules, map dependency vectors.

Look for healthy dependencies:

```text
feature
↓
core
```

as well as problematic inversions:

```text
core
↓
feature
```

or circular module dependencies.

Explain the concrete architectural or build-time impact for every issue found.

---

# 3. APPLICATION ENTRY POINT

Inspect:

- `Application` subclass
- dependency graph initialization
- third-party SDK initialization
- logging libraries
- analytics SDKs
- database warmup routines
- background task scheduling

Look for excessive work committed during app cold startup on the Main thread.

---

# 4. ANDROID MANIFEST

Thoroughly inspect all manifest files.

Verify:

- exported components
- permission declarations
- intent filters
- content providers
- broadcast receivers
- services
- activities
- deep link configurations
- backup rules
- cleartext network traffic flags
- network security configurations
- foreground service types
- launch modes and task affinities
- theme definitions

Every manifest finding must articulate a concrete security or runtime consequence.

---

# 5. EXPORTED COMPONENTS

For every exported component, verify:

- whether it genuinely needs to be exported
- which external apps or callers can invoke it
- whether incoming inputs are strictly validated
- whether caller permissions are enforced (`android:permission`)

Specifically scrutinize:

- Activities
- Services
- BroadcastReceivers
- ContentProviders

---

# 6. INTENT INPUT VALIDATION

Treat every incoming external Intent as untrusted user input.

Inspect:

- extras bundles
- data URIs
- action strings
- MIME types
- intent flags

Never assume the calling process is your own application if the receiving component is exported.

---

# 7. DEEP LINKS

Map all declared deep links.

Trace:

```text
external URL
↓
Intent
↓
Activity
↓
navigation
↓
screen
↓
resource access
```

Look for:

- authentication bypasses
- unvalidated resource IDs
- uncaught parameter parsing crashes
- open redirect vulnerabilities
- navigation into nonexistent data entities

---

# 8. APP LINKS

If Android App Links are configured, verify:

- manifest definitions
- host declarations
- path prefixes
- digital asset link verification (`assetlinks.json`)
- browser fallback behavior

If the production domain cannot be verified:

**APP LINK VERIFICATION: NOT VERIFIED**

---

# 9. ACTIVITY LIFECYCLE

For every critical Activity, trace:

- `onCreate`
- `onStart`
- `onResume`
- `onPause`
- `onStop`
- `onDestroy`

Look for business logic coupled to inappropriate lifecycle stages.

---

# 10. FRAGMENT LIFECYCLE

Strictly distinguish:

- Fragment lifecycle
- Fragment View lifecycle

Look for observers bound to the Fragment itself rather than `viewLifecycleOwner` when data observation should not outlive the view hierarchy.

---

# 11. VIEWMODEL OWNERSHIP

Inspect ViewModel scopes:

- Activity-scoped
- Fragment-scoped
- Navigation graph-scoped
- Compose route-scoped

Improper scoping triggers:

- stale state leakage
- unintended state sharing across unrelated flows
- premature state resets
- memory retention

---

# 12. CONFIGURATION CHANGES

Mentally test:

```text
screen open
↓
user enters data
↓
rotation/configuration change
```

What is lost?

Verify:

- UI state preservation
- form input retention
- active list selection
- in-flight network request continuity

---

# 13. PROCESS DEATH

One of the most critical and frequently failed Android scenarios.

Simulate:

```text
app in background
↓
OS kills process under memory pressure
↓
user returns
```

Never assume ViewModels survive process death.

Inspect:

- SavedStateHandle integration
- durable local persistence
- navigation back stack restoration
- draft data recovery

---

# 14. SAVEDSTATEHANDLE

Inspect what is saved to `SavedStateHandle`.

Never store massive payloads.

Verify that only the minimal identifier or state needed to reconstruct the screen is retained.

---

# 15. BUNDLE SIZE LIMITS

Oversized payloads in Bundles and SavedState trigger fatal `TransactionTooLargeException` crashes.

Look for:

- full data lists
- raw Bitmaps
- large JSON blobs
- deeply nested Parcelable graphs

---

# 16. COMPOSE STATE MANAGEMENT

If Jetpack Compose is used, map:

- `remember`
- `rememberSaveable`
- ViewModel state holders
- Flow collections
- derived state calculations

Verify that state mechanisms align with the required lifecycle longevity.

---

# 17. `remember` VS `rememberSaveable`

Do not flag every `remember` indiscriminately.

Ask:

> Must this state survive Activity recreation or configuration changes?

If yes, verify that appropriate persistence (`rememberSaveable`) is utilized.

---

# 18. STATE HOISTING

Ensure UI state maintains a single unambiguous owner.

Look for conflicting state duplication across:

- composable functions
- ViewModels
- repositories

lacking a canonical source of truth.

---

# 19. RECOMPOSITION HOTSPOTS

Look for expensive operations executed directly within composable function bodies:

- list sorting
- complex filtering
- string or date parsing
- database or network calls
- heavy object allocations

Do not flag routine, lightweight recomposition without measurable cost.

---

# 20. UNSTABLE INPUTS

If performance bottlenecks stem from Compose parameter instability, verify the actual stability model and compiler metrics before filing findings.

---

# 21. SIDE EFFECT APIS

Inspect:

- `LaunchedEffect`
- `DisposableEffect`
- `SideEffect`
- `rememberCoroutineScope`
- `produceState`

Verify key arguments and lifecycle boundaries.

---

# 22. LAUNCHEDEFFECT KEYS

Scenario:

```text
LaunchedEffect(Unit)
```

where the underlying effect depends on a dynamic parameter ID.

Verify whether the effect re-triggers when its dependencies mutate.

---

# 23. DISPOSABLEEFFECT CLEANUP

When registering listeners or acquiring resources, verify proper unregistration in `onDispose`.

---

# 24. COLLECTING FLOWS IN COMPOSE

Verify lifecycle-aware flow collection (e.g. `collectAsStateWithLifecycle()`).

Look for flow collections that continue active emissions while the UI is in the background.

---

# 25. XML VIEWS

If the codebase utilizes XML Views, inspect:

- ViewBinding
- DataBinding
- nullable binding references
- binding cleanup in Fragments
- adapter lifecycles

---

# 26. VIEWBINDING IN FRAGMENTS

Classic Android memory leak:

the ViewBinding reference outlives `onDestroyView`.

Inspect the cleanup implementation.

---

# 27. RECYCLERVIEW

For lists, verify:

- stable IDs
- DiffUtil implementations
- partial payload updates
- nested RecyclerView configurations
- view holder click listener allocations
- stale item position usage

---

# 28. ADAPTER POSITIONS

Look for code referencing outdated cached list positions instead of `bindingAdapterPosition` or `absoluteAdapterPosition`.

---

# 29. DIFFUTIL ACCURACY

Verify:

- item identity equality (`areItemsTheSame`)
- item content equality (`areContentsTheSame`)
- mutable data object hazards

Flawed DiffUtil comparisons cause visual glitches and stale UI presentations.

---

# 30. NAVIGATION ARCHITECTURE

Map the complete navigation architecture.

Verify:

- back stack management
- deep link destinations
- nested navigation graphs
- modal dialog destinations
- bottom navigation bar integrations
- multiple back stack handling

---

# 31. DUPLICATE NAVIGATION

Scenario:

```text
button double tap in rapid succession
↓
navigate action dispatched twice
```

Can trigger:

- duplicate destinations pushed onto the back stack
- navigation crashes
- corrupted back stack transitions

---

# 32. NAVIGATION AFTER ASYNCHRONOUS COMPLETION

Scenario:

```text
screen A
↓
async network request dispatched
↓
user exits screen
↓
request finishes
↓
legacy ViewModel / navigation event attempts to push a route
```

Verify lifecycle relevance and navigation safety.

---

# 33. ONE-TIME EVENTS

Inspect:

- navigation events
- toast and snackbar triggers
- confirmation dialog displays

Look for events re-emitted upon screen rotation or flow re-collection.

---

# 34. EVENT WRAPPER MECHANISMS

Do not enforce custom `SingleLiveEvent` classes blindly.

Analyze whether the current event model adheres to modern lifecycle guidelines.

---

# 35. STATEFLOW VS SHAREDFLOW

Verify appropriate primitive selection:

- persistent UI state (`StateFlow`)
- transient one-off events (`SharedFlow` or channeled flows)

Selecting the wrong primitive results in dropped or redundantly processed events.

---

# 36. COROUTINE SCOPES

Map all active coroutine scopes:

- `viewModelScope`
- `lifecycleScope`
- custom CoroutineScope instances
- `GlobalScope`
- application-level scopes

---

# 37. GLOBALSCOPE

If `GlobalScope` is present, inspect for lifecycle detachments and memory retention.

Do not report by name alone if used in an extraordinarily narrow, valid context, but require rigorous justification.

---

# 38. CUSTOM SCOPES

For any custom `CoroutineScope`, verify:

- who owns the lifecycle
- who invokes `.cancel()`
- assigned dispatcher
- usage of `SupervisorJob` vs `Job`

---

# 39. CANCELLATION HANDLING

Trace:

```text
screen closes
↓
is the coroutine still executing?
```

Inspect side effects occurring after scope cancellation.

---

# 40. SWALLOWED CANCELLATION EXCEPTIONS

Specifically look for:

```kotlin
catch (e: Exception)
```

which catches and suppresses `CancellationException`, breaking structured concurrency.

---

# 41. STRUCTURED CONCURRENCY

Identify detached or un-scoped coroutine jobs lacking lifecycle ownership.

---

# 42. DISPATCHERS

Verify:

- `Dispatchers.Main`
- `Dispatchers.IO`
- `Dispatchers.Default`

Look for:

- database, file, or network I/O executed on Main
- CPU-heavy processing on Main
- redundant or thrashing dispatcher switching

---

# 43. MAIN THREAD BLOCKING

Actively hunt for:

- blocking I/O calls
- `runBlocking`
- massive JSON parsing
- bitmap transformations
- cryptographic operations
- file read/write operations

executing on the Main UI thread.

---

# 44. `runBlocking`

Scrutinize every occurrence of `runBlocking`.

If located in an Activity, Fragment, ViewModel, or UI lifecycle path, flag as a severe ANR hazard.

---

# 45. FLOW PIPELINES

For critical Flow pipelines, verify:

- upstream data sources
- transformation operators
- context preservation (`flowOn`)
- collection lifecycle
- error handling (`catch`)

---

# 46. `flowOn`

Verify that developers correctly understand which part of the upstream pipeline `flowOn` modifies.

---

# 47. HOT VS COLD FLOWS

Ensure repeated collections of cold flows do not inadvertently re-execute expensive database or network calls.

---

# 48. `stateIn` AND `shareIn`

Inspect:

- target scope
- `SharingStarted` strategy (`WhileSubscribed(5000)`)
- replay buffers
- memory retention

---

# 49. FLOW COMBINATIONS

When combining multiple flows via `combine` or `zip`, verify:

- duplicate emission bursts
- expensive recalculation loops
- initial emission synchronization

---

# 50. `collectLatest`

Verify that cancelling previous in-flight processing blocks makes semantic sense for the feature.

---

# 51. COROUTINE EXCEPTION HANDLING

Look for:

- unhandled exceptions crashing the parent job
- `CoroutineExceptionHandler` placement
- child coroutine failure propagation
- silent failures

---

# 52. SUPERVISORJOB SEMANTICS

Do not apply `SupervisorJob` as a generic patch.

Evaluate whether child failures must be isolated or should cancel siblings.

---

# 53. RACE CONDITIONS

Identify shared mutable state accessed concurrently across multiple coroutines or threads.

---

# 54. MUTEX USAGE

If using `Mutex`, verify:

- lock scope
- deadlock potential
- reentrancy assumptions (Kotlin Mutex is not reentrant)
- cancellation safety

---

# 55. ATOMICITY HAZARDS

Scenario:

```text
read state
↓
compute new state
↓
write back state
```

Two concurrent coroutines will trigger lost updates without atomic update primitives.

---

# 56. NETWORK STACK

Map:

```text
UI
↓
ViewModel
↓
Repository
↓
API client (Retrofit/Ktor)
↓
HTTP engine (OkHttp)
```

---

# 57. BASE URLS

Verify:

- development
- staging
- production
- trailing slash consistency
- build flavor mappings

---

# 58. TIMEOUT CONFIGURATIONS

Inspect:

- connect timeout
- read timeout
- write timeout
- call timeout

Do not invent arbitrary timeouts without evaluating mobile network realities.

---

# 59. AUTOMATIC RETRIES

Ensure write operations (POST, PUT, DELETE, PATCH) are not retried automatically without idempotency safeguards.

---

# 60. HTTP INTERCEPTORS

Inspect:

- authentication interceptors
- logging interceptors
- retry interceptors
- header injection

Verify that interceptor chaining order does not introduce unexpected behavior.

---

# 61. AUTH TOKEN REFRESH

Reconstruct the token refresh scenario:

```text
multiple concurrent requests in flight
↓
access token expires
↓
multiple 401 Unauthorized responses
↓
token refresh triggered
```

Ask:

> Does the app dispatch a single coordinated refresh or N concurrent refresh requests?

---

# 62. REFRESH RACE CONDITIONS

Inspect concurrent 401 handling.

If refresh tokens are rotated on single use, concurrent requests using the old token will be rejected and force user logout.

---

# 63. AUTHENTICATION LOOPS

Scenario:

```text
request
↓
401 Unauthorized
↓
token refresh
↓
refresh returns 401
↓
interceptor retries indefinitely
```

Verify infinite loop protection and explicit logout triggers.

---

# 64. NETWORK ERROR MAPPING

Verify distinct classification between:

- connection timeouts
- no network connectivity
- DNS resolution failures
- HTTP 4xx client errors
- HTTP 5xx server errors
- deserialization errors

Do not collapse all failures into an opaque generic error if downstream behavior must differ.

---

# 65. SERIALIZATION RESILIENCE

Verify:

- unknown field tolerance (`ignoreUnknownKeys = true`)
- missing optional field defaults
- nullability handling
- enum drift resilience
- malformed response recovery

---

# 66. ENUM DRIFT

If a backend adds a new enum value that an older installed Android client does not recognize, verify that deserialization does not crash.

---

# 67. API VERSION SKEW

An installed APK may communicate with backend APIs for months without updating.

Ask:

> Does the backend maintain backwards compatibility with older installed client contracts?

---

# 68. CERTIFICATE AND TLS HANDLING

If using custom trust managers, certificate pinning, or network security configurations, analyze them rigorously.

Never recommend disabling certificate validation or trusting all certificates.

---

# 69. CLEARTEXT TRAFFIC

Verify that production builds strictly forbid unencrypted HTTP traffic (`cleartextTrafficPermitted="false"`).

---

# 70. ROOM DATABASE

Map:

- entities
- DAOs
- relations (`@Relation`, `@Embedded`)
- migration strategies
- database indexes
- transaction boundaries

---

# 71. ROOM ON MAIN THREAD

Search for `allowMainThreadQueries()`.

If present, verify that it is never active in production builds.

---

# 72. ROOM MIGRATIONS

Map database version history.

Verify that users can upgrade smoothly from older supported versions.

---

# 73. MIGRATION CHAINS

Scenario:

```text
Database v1
↓
app not updated for multiple releases
↓
user updates directly to Database v7
```

Does a valid migration path exist from 1 -> 7?

---

# 74. DESTRUCTIVE MIGRATIONS

If using `fallbackToDestructiveMigration()`, evaluate whether user data will be wiped during automated upgrades.

---

# 75. SCHEMA EXPORT

Verify whether Room schema export is enabled (`room.schemaLocation`) and verified via automated migration tests.

---

# 76. TRANSACTIONS

Verify atomicity for multi-step database write operations (`@Transaction`).

---

# 77. UNIQUE CONSTRAINTS

Business rules enforced solely in Kotlin code can fail under concurrent writes without database-level unique constraints.

---

# 78. FOREIGN KEYS

Inspect foreign key cascading, indexation, and orphan record accumulation.

---

# 79. DATABASE INDEXES

For queries utilizing:

- WHERE
- JOIN
- ORDER BY

verify that underlying table columns are properly indexed.

---

# 80. N+1 QUERY HAZARDS

Look for list rendering or repository iterations that trigger individual database queries per item.

---

# 81. FLOWS FROM ROOM

Verify that observable queries emit accurately without generating runaway invalidation loops.

---

# 82. DATASTORE

If DataStore is used, verify:

- Preferences vs Proto DataStore
- corruption handling strategies
- migration from SharedPreferences
- I/O execution on background dispatchers

---

# 83. SHAREDPREFERENCES

If SharedPreferences is still present, inspect:

- synchronous `.commit()` calls blocking Main (prefer `.apply()`)
- plaintext sensitive data storage
- migration plans to DataStore where justified

---

# 84. FILE STORAGE

Map storage locations:

- internal storage (`filesDir`, `cacheDir`)
- external storage
- media collections

---

# 85. SCOPED STORAGE

Ensure file operations comply with modern Scoped Storage guidelines without relying on legacy storage flags.

---

# 86. FILE URIS

Search for raw `file://` URIs shared with external applications (which triggers `FileUriExposedException`).

Verify `FileProvider` usage.

---

# 87. FILEPROVIDER CONFIGURATION

Inspect `file_paths.xml`.

Ensure internal directories are not exposed more broadly than necessary.

---

# 88. CACHE FILE CLEANUP

Temporary downloads, cached images, and exports can consume disk space unbounded without eviction policies.

---

# 89. SENSITIVE FILE STORAGE

Ensure authentication tokens, encryption keys, and private data are never saved in unencrypted plaintext on disk.

---

# 90. ANDROID KEYSTORE

If cryptographic secrets are managed, verify Android Keystore integration.

Do not mandate Keystore encryption for every standard ephemeral session token without reviewing the threat model.

---

# 91. BACKUP CONFIGURATIONS

Inspect:

- Android Auto Backup (`allowBackup`)
- `dataExtractionRules`
- what files enter cloud backups
- sensitive data exclusion

---

# 92. LOGOUT CLEANUP

Map the complete logout pipeline:

```text
logout
↓
clear auth tokens
↓
purge Room databases
↓
reset DataStore preferences
↓
clear image and file caches
↓
cancel active notifications
↓
abort pending background workers
```

Verify that no cross-user data leaks survive logout.

---

# 93. ACCOUNT SWITCHING

Scenario:

```text
User A logs in
↓
User A logs out
↓
User B logs in
```

Ask:

> Can User B observe any state, cache, or persisted data belonging to User A?

---

# 94. WORKMANAGER

Map all Worker classes.

For each, inspect:

- execution constraints (network, charging, idle)
- unique work naming
- retry policies
- backoff strategies
- input / output data payloads
- cancellation handling

---

# 95. DUPLICATE WORK SCHEDULING

If the app schedules background sync upon every startup, ensure duplicate tasks do not accumulate unboundedly.

---

# 96. UNIQUE WORK POLICIES

Verify selection of:

- `ExistingWorkPolicy.KEEP`
- `ExistingWorkPolicy.REPLACE`
- `ExistingWorkPolicy.APPEND`

against business semantics.

---

# 97. PERIODIC WORK REALITIES

Ensure product features do not assume PeriodicWork executes at precise, exact minute intervals.

WorkManager is an inexact, battery-optimized background scheduler.

---

# 98. RETRY CLASSIFICATION

Workers must distinguish:

- transient errors (e.g. server timeout -> `Result.retry()`)
- permanent failures (e.g. HTTP 400/422 validation error -> `Result.failure()`)

Never retry fatal validation errors infinitely.

---

# 99. WORKER IDEMPOTENCY

Background workers can be re-executed by the system.

Ask:

> Is this worker safe to execute twice?

---

# 100. WORKER PROCESS RESTARTS

Workers must execute cleanly in newly spawned processes without assuming prior in-memory singleton state.

---

# 101. SERVICES

Map:

- started services
- bound services
- foreground services

---

# 102. FOREGROUND SERVICES (FGS)

Verify:

- valid foreground service types (`foregroundServiceType`)
- persistent user notification
- lifecycle boundaries
- deterministic `stopSelf()` invocation

---

# 103. FGS START RESTRICTIONS

Modern Android versions strictly prohibit background apps from starting Foreground Services.

Verify target API level compliance.

---

# 104. SERVICE RESOURCE LEAKS

Verify that listeners, location updates, and hardware connections are torn down when services terminate.

---

# 105. BROADCASTRECEIVERS

Inspect:

- manifest vs dynamic runtime registration
- `android:exported` flags
- custom permission protection
- unregister symmetry (`onStop` / `onDestroy`)

---

# 106. RECEIVER INPUT VALIDATION

Treat data delivered in external broadcasts as untrusted.

---

# 107. NOTIFICATIONS

Verify:

- notification channels
- channel importance levels
- runtime notification permissions
- PendingIntent flags
- deep link destinations
- unique notification IDs

---

# 108. NOTIFICATION PERMISSIONS

On Android 13+ (API 33+), verify the runtime `POST_NOTIFICATIONS` permission request flow.

---

# 109. PENDINGINTENT MUTABILITY

Ensure PendingIntents explicitly declare:

- `FLAG_IMMUTABLE` (default)
- `FLAG_MUTABLE` (only where explicitly required)

---

# 110. NOTIFICATION CLICKS

Trace:

```text
notification
↓
PendingIntent
↓
Activity
↓
navigation
↓
resource resolution
```

Verify behavior when target resources have been deleted.

---

# 111. ALARMMANAGER

If used, determine:

- exact vs inexact alarms
- `SCHEDULE_EXACT_ALARM` permissions
- actual product necessity

Do not use exact alarms as a routine task scheduler.

---

# 112. BOOT COMPLETED RECEIVERS

If alarms or jobs must survive device reboots, verify `RECEIVE_BOOT_COMPLETED` handling.

---

# 113. DOZE MODE

Mentally test background capabilities under Doze mode.

Standard background network calls and jobs will be deferred until maintenance windows.

---

# 114. APP STANDBY BUCKETS

Evaluate task execution when the user rarely opens the application.

---

# 115. BATTERY CONSUMPTION

Look for:

- aggressive polling loops
- unreleased wake locks
- excessive GPS polling
- unbatched network transfers

---

# 116. WAKELOCKS

Every acquired WakeLock must have an explicit release lifecycle and a timeout fallback.

---

# 117. LOCATION HANDLING

If location is used, inspect:

- permission scopes (COARSE vs FINE)
- foreground vs background location
- location update deregistration
- battery consumption profiles

---

# 118. PERMISSION INVENTORY

Audit all declared permissions.

Classify:

```text
REQUIRED
OPTIONAL
LEGACY
UNUSED
NOT VERIFIED
```

---

# 119. RUNTIME PERMISSION FLOW

Trace:

```text
feature activation
↓
permission rationale dialog
↓
system permission request
↓
grant / deny
↓
permanent denial
↓
graceful fallback
```

---

# 120. PERMANENT DENIAL ("DON'T ASK AGAIN")

Verify the UX when users permanently deny permissions.

Provide clear navigation to system application settings where necessary.

---

# 121. PARTIAL MEDIA PERMISSIONS

On modern Android versions, users can grant partial photo/media access.

Verify that media selection handles limited access gracefully.

---

# 122. PERMISSION API DIFFERENCES

Permission requirements evolve across Android API levels.

Ensure permission checks are version-aware.

---

# 123. CAMERA

If camera features exist:

- camera lifecycle management
- permission handling
- orientation and rotation handling
- process death during capture
- output file resolution

---

# 124. PHOTO PICKER

Verify usage of the modern Android Photo Picker where applicable, avoiding broad storage permission requests.

---

# 125. BIOMETRICS

If using BiometricPrompt:

- device credential fallbacks
- lifecycle and crypto object association
- key invalidation upon new biometric enrollment
- separating local unlock from server authorization

---

# 126. WEBVIEW

WebViews represent a high-risk security surface.

Verify:

- JavaScript execution flags
- local file access (`setAllowFileAccess`)
- mixed content modes
- JavaScript interfaces
- URL navigation restrictions
- SSL error handling

---

# 127. JAVASCRIPT INTERFACES

Scrutinize `addJavascriptInterface` methods for exposure of sensitive native functionality to arbitrary web pages.

---

# 128. SSL ERROR OVERRIDES

Never automatically proceed on SSL errors (`handler.proceed()`) in `WebViewClient`.

---

# 129. WEBVIEW URL VALIDATION

If WebViews load URLs derived from external deep links or inputs, enforce strict domain allowlists.

---

# 130. MEDIA3 / EXOPLAYER

If audio or video playback is implemented, inspect:

- player instance ownership
- player release on lifecycle teardown
- playlist / source transitions
- playback error retries
- audio focus management

---

# 131. PLAYER RE-CREATION LEAKS

Look for player instances recreated across recompositions or configuration changes without releasing the prior instance.

---

# 132. AUDIO FOCUS

Inspect interactions with:

- incoming phone calls
- third-party audio apps
- headphone disconnections (becoming noisy)
- Bluetooth audio routing

---

# 133. MEDIA SESSIONS

For background playback, verify `MediaSession` and media notification service lifecycles.

---

# 134. PICTURE-IN-PICTURE (PIP)

If PiP is supported, inspect:

- transition lifecycles
- action buttons
- state restoration
- aspect ratio adjustments

---

# 135. ANDROID TV

If targeting Android TV, verify:

- D-pad directional navigation
- visible focus states
- remote control key handling
- 10-foot UI layouts
- focus restoration after back navigation

---

# 136. ACCESSIBILITY

Verify foundational accessibility:

- `contentDescription` on interactive elements
- minimum 48dp touch targets
- logical focus navigation
- TalkBack screen reader compatibility
- state announcements

Do not turn this prompt into a full accessibility checklist.

---

# 137. DECORATIVE CONTENT DESCRIPTIONS

Decorative graphics and icons must not have noisy descriptions; set `contentDescription = null` so TalkBack ignores them.

---

# 138. `testTag` VS ACCESSIBILITY SEMANTICS

Compose `Modifier.testTag` is for automated testing and does not substitute for accessibility semantics.

---

# 139. UI PERFORMANCE

Look for:

- frame drops and stutter (jank)
- heavy main-thread computations
- un-virtualized large lists
- excessive recompositions
- unscaled bitmap decoding
- deeply nested layout hierarchies

Do not assert frame rate metrics without profiling data.

---

# 140. COLD START PERFORMANCE

Map all work executing prior to the first interactive frame.

Inspect:

- SDK initializations
- database connections
- synchronous network checks
- schema migrations
- blocking dependency injections

---

# 141. COLD START MEASUREMENTS

If startup timings were not profiled:

**COLD START: NOT MEASURED**

---

# 142. BASELINE PROFILES

If Baseline Profiles exist, verify coverage.

If absent, evaluate as a release optimization candidate.

---

# 143. ANR (APPLICATION NOT RESPONDING) AUDIT

Hunt for any code path capable of stalling the Main thread for 5+ seconds:

- file or database I/O
- lock contention
- synchronous IPC / Binder calls
- large JSON parsing
- synchronous network calls

---

# 144. DEADLOCKS

Map synchronizations, mutexes, and locks across threads.

Look for inverted lock acquisition ordering.

---

# 145. STRICTMODE

If enabled in debug builds, review reported policy violations.

---

# 146. MEMORY LEAKS

Look for:

- Activity references retained in singletons
- Fragment view binding retention
- unregistered listeners and callbacks
- adapter context retention
- static object references
- uncancelled coroutine scopes

---

# 147. CONTEXT LEAKS

Distinguish:

- Application Context (safe for long-lived singletons)
- Activity Context (leaks UI hierarchy if retained)

---

# 148. LARGE BITMAP HANDLING

Inspect:

- in-memory image decoding
- downsampling options (`inSampleSize`)
- memory cache ceilings
- recycled resources

---

# 149. OUT OF MEMORY (OOM)

Do not assert OOM crashes without an identified memory leak or unbounded accumulation path.

---

# 150. IMAGE LOADING LIBRARIES

If using Coil, Glide, or Picasso, verify lifecycle-aware requests and memory caching configurations.

---

# 151. LIST MEMORY CONSUMPTION

Lists binding full-resolution un-downsampled bitmaps will trigger rapid memory exhaustion.

---

# 152. DATABASE MEMORY FOOTPRINT

Avoid querying entire multi-thousand-row tables into memory when the UI only displays a paginated slice.

---

# 153. PAGING LIBRARY

If data collections can grow large, verify AndroidX Paging 3 integration.

Do not mandate Paging for inherently small datasets.

---

# 154. OFFLINE-FIRST ARCHITECTURE

If offline support is an advertised feature, identify the single source of truth:

```text
network
↓
local DB
↓
UI
```

---

# 155. CACHE INVALIDATION

Inspect:

- data freshness rules
- cache TTLs
- pull-to-refresh invalidation
- server push invalidation
- background synchronization

---

# 156. DATA SYNCHRONIZATION

Map the synchronization pipeline:

```text
local mutations
↓
offline queue
↓
network dispatch
↓
server validation
↓
server reconciliation
↓
local DB update
```

---

# 157. CONFLICT RESOLUTION

Scenario:

```text
Device A edits record offline
Device B edits same record online
Device A reconnects
```

Document the application's actual resolution behavior.

---

# 158. LAST-WRITE-WINS

If last-write-wins is used, verify whether this is an intentional business decision or an unhandled concurrency flaw.

---

# 159. DUPLICATE SYNC TRIGGERING

A scheduled Worker and a manual user pull-to-refresh can execute concurrently.

Verify synchronization locking and idempotency.

---

# 160. CONNECTIVITY DETECTION

Never use `NetworkCapabilities.hasCapability(NET_CAPABILITY_INTERNET)` as definitive proof that API servers are reachable.

Local network connections can lack internet access.

---

# 161. OFFLINE RETRY SPAM

Ensure the app does not spam retry requests in a tight loop when connectivity is down.

---

# 162. STALE AUTHENTICATION OFFLINE

If the app allows offline access to cached data, determine what occurs if user authorization is revoked server-side while offline.

Document security and business policy implications.

---

# 163. APP UPDATES AND VERSION SKEW

Older installed APK versions remain active in production for months.

Backend APIs and local database schemas must accommodate version skew.

---

# 164. IN-APP UPDATES

If Google Play In-App Updates are implemented, verify:

- flexible vs immediate update flows
- state listening
- failure recovery
- update resumption

If not implemented:

**NOT APPLICABLE**

---

# 165. FORCED UPDATES

If the backend enforces minimum client versions, verify:

- offline fallback messaging
- handling when Google Play is inaccessible
- emergency bypass mechanisms

---

# 166. VERSION CODES AND NAMES

Verify versioning increments and release flavor configurations.

---

# 167. DEBUG VS RELEASE DIFFERENCES

One of the most critical audit sections.

Compare:

```text
debug
release
```

across:

- minification and obfuscation
- logging behavior
- backend API endpoints
- certificate pinning
- feature flag defaults
- analytics tracking
- crash reporting
- network security configurations

---

# 168. DEBUGGABLE BUILDS

Production release APKs and AABs must strictly have `android:debuggable="false"`.

---

# 169. PRODUCTION LOGGING

Search for logging statements that emit:

- authorization tokens
- passwords
- personal identifiable information (PII)
- complete HTTP request/response payloads

Ensure logging is stripped or disabled in release builds.

---

# 170. R8 / PROGUARD OBFUSCATION

Inspect release minification rules.

Identify libraries using reflection, serialization, or JNI that require explicit `-keep` rules.

---

# 171. DEBUG PASS / RELEASE CRASH

Classic Android defect:

```text
debug build succeeds
↓
R8 renames or strips required class
↓
release build crashes in production
```

Verify keep rules for data transfer models and serialization adapters.

---

# 172. RESOURCE SHRINKING

If `shrinkResources` is enabled, verify that dynamically constructed resource lookups (e.g. `getIdentifier()`) are preserved via `keep.xml`.

---

# 173. SIGNING CONFIGURATIONS

Ensure keystores and signing credentials are not committed to source control.

Mask any credentials discovered.

---

# 174. ANDROID APP BUNDLE (AAB)

If deploying via AAB, verify code assumptions regarding dynamic feature modules, split APKs, and language resources.

---

# 175. ABI ARCHITECTURES

If native C/C++ libraries are packaged, verify supported ABIs (`arm64-v8a`, `armeabi-v7a`, `x86_64`).

---

# 176. NATIVE CODE (JNI)

JNI crashes bypass standard Kotlin try/catch blocks and terminate the OS process immediately.

Flag native code as a high-scrutiny boundary.

---

# 177. PLAY STORE POLICY REQUIREMENTS

Verify compliance against current Google Play policies (e.g. target SDK level, account deletion requirements, permission justifications).

If unverified:

**PLAY POLICY STATUS: NOT VERIFIED**

---

# 178. PRIVACY LEAKAGE

Trace user data paths:

```text
user data
↓
device storage
↓
log files
↓
network payloads
↓
analytics trackers
↓
third-party SDKs
```

---

# 179. ANALYTICS PRIVACY

Verify:

- PII is not transmitted to analytics services
- user IDs are cleared upon account logout
- privacy opt-outs are respected

---

# 180. CRASH REPORTING METADATA

Ensure crash report breadcrumbs and custom keys do not capture user passwords or tokens.

---

# 181. THIRD-PARTY SDK INVENTORY

Map all bundled SDKs:

- analytics
- ads
- social login
- payment
- attribution
- crash reporting

Inspect their initialization and permissions.

---

# 182. SDK STARTUP OVERHEAD

Third-party SDKs initialized in `Application.onCreate` can severely inflate cold start duration.

---

# 183. SDK INITIALIZATION RESILIENCE

Third-party SDK initialization failures should never trigger fatal startup crashes for the core application.

---

# 184. DEPENDENCY AUDIT

Inspect:

- deprecated dependencies
- conflicting or duplicate libraries
- legacy Android Support library remnants
- AndroidX package consistency
- version compatibility

Do not demand updates simply because a newer version exists.

---

# 185. BUILD WARNINGS

Classify compiler and build warnings:

- actionable defects
- deprecated API usage
- release risks
- cosmetic noise

---

# 186. ANDROID LINT

If tooling allows, run Android Lint.

Automated lint output is not a substitute for an audit; verify all findings in context.

---

# 187. AUTOMATED TEST SUITE MAPPING

Map existing test suites:

- unit tests
- integration tests
- Room database tests
- ViewModel tests
- Compose / UI tests
- instrumentation tests
- screenshot tests
- end-to-end tests

---

# 188. UNIT TEST FALSE CONFIDENCE

A ViewModel test with a 100% mocked repository does not prove:

- Room database queries succeed
- network parsing is resilient
- serialization handles nullability
- lifecycle restoration works

---

# 189. COROUTINE TESTS

Verify:

- `StandardTestDispatcher` vs `UnconfinedTestDispatcher`
- virtual time advancement (`advanceUntilIdle`)
- absence of uncontrolled real background dispatchers
- concurrency race test coverage

---

# 190. FLOW TESTS

Verify:

- initial state emission assertions
- multiple emission sequence assertions
- error handling tests
- cancellation behavior tests

---

# 191. ROOM MIGRATION TESTS

For non-trivial databases, verify automated migration testing (`MigrationTestHelper`).

---

# 192. PROCESS DEATH TESTS

If critical user journeys depend on state restoration, verify whether automated tests or manual verification procedures exist.

---

# 193. CONFIGURATION CHANGE TESTS

Verify forms, media players, dialogs, and selection state under screen rotation tests.

---

# 194. BACKGROUND / FOREGROUND LIFECYCLE TESTS

Test the transition:

```text
foreground
↓
background
↓
system delay
↓
foreground
```

---

# 195. OFFLINE TESTS

Verify:

- cold start while offline
- reading previously cached records
- queueing offline mutations
- automatic reconnection and sync

---

# 196. API FAILURE TESTS

Never test only HTTP 200 responses.

Verify client behavior against:

- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 409 Conflict
- 429 Rate Limited
- 500 Internal Server Error
- network timeouts
- malformed JSON payloads

---

# 197. UI TEST ROBUSTNESS

Look for UI tests tied to:

- exact localized string values
- screen coordinates
- arbitrary sleep delays

Recommend semantic matchers and test tags.

---

# 198. FLAKY TESTS

Search for flaky patterns:

- `Thread.sleep()`
- arbitrary timing delays
- uncontrolled background coroutines
- live network dependencies
- un-disabled animations

---

# 199. SCREENSHOT TESTING

A passing screenshot test proves visual rendering, not functional behavior.

Distinguish visual assertions from behavioral correctness.

---

# 200. CI/CD PIPELINE

Inspect Android CI/CD workflows:

- JDK toolchain
- Gradle caching
- lint checks
- unit test execution
- instrumentation test execution
- release assembly
- bundle generation
- signing workflows

---

# 201. RELEASE BUILDS IN CI

If CI/CD compiles only debug variants, release-only compilation and R8 failures remain undetected until deployment.

---

# 202. GRADLE CONFIGURATION AUDIT

Inspect:

- duplicate dependency declarations
- dynamic version dependencies
- insecure repository URLs
- configuration cache compatibility
- build type definitions

---

# 203. DYNAMIC DEPENDENCY VERSIONS

Using `1.+` or `latest.release` prevents deterministic, reproducible builds.

---

# 204. REPOSITORY SOURCES

Ensure dependencies resolve only from trusted, secure repositories (e.g. Maven Central, Google Maven).

---

# 205. SECRETS IN SOURCE CONTROL

Search for committed:

- API keys
- keystore passwords
- signing credentials
- service account JSON keys
- private staging URLs

Never output discovered secrets in full.

---

# 206. BUILDCONFIG SECRETS

Secrets embedded in `BuildConfig` fields or string resources are easily extracted from compiled APKs.

Client apps cannot securely conceal true secrets from device owners.

---

# 207. API KEY RESTRICTIONS

Ensure client-embedded API keys are restricted by package name and SHA-1 fingerprint on backend provider consoles.

---

# 208. ROOTED DEVICE THREAT MODEL

Never assume local client storage is secure against the device owner on rooted devices.

Maintain a realistic threat model.

---

# 209. FLAG_SECURE SCREENSHOT PROTECTION

If the application displays sensitive financial or medical records, determine if `FLAG_SECURE` is required.

Do not impose globally without product requirements.

---

# 210. CLIPBOARD SECURITY

Sensitive data copied to the clipboard may be read by other apps.

Evaluate clipboard handling for credentials.

---

# 211. INTENT DATA LEAKS

Ensure sensitive extras are not broadcast via implicit intents.

---

# 212. PENDINGINTENT SECURITY

Re-verify PendingIntent mutability, especially when passed to external services or notifications.

---

# 213. SQL INJECTION

Room parameter binding mitigates SQL injection, but raw queries (`SimpleSQLiteQuery`) incorporating unsanitized user strings must be audited.

---

# 214. WEBVIEW BRIDGE SECURITY

Treat JavaScript interfaces in WebViews as strict trust boundaries.

---

# 215. SERIALIZED INTENT OBJECTS

Do not trust deserialized `Parcelable` or `Serializable` objects received from external exported components without strict validation.

---

# 216. DATA DESERIALIZATION

If the app imports or parses local files, validate file structures defensively.

---

# 217. USER BACKUP AND IMPORT

If user backup/export is supported, verify:

- schema versioning
- payload validation
- file size limits
- primary key collision handling
- transactional replacement

---

# 218. BACKUP RESTORATION

Trace:

```text
backup file
↓
parse
↓
validate
↓
migration
↓
DB transaction
↓
rebuild app state
```

---

# 219. PARTIAL RESTORE FAILURES

If database restoration fails midway, ensure the transaction rolls back cleanly rather than leaving a corrupted, half-populated database.

---

# 220. DESTRUCTIVE APPLICATION RESET

If the app offers an account or data reset:

- terminate background workers
- close and recreate database instances
- purge cache directories
- reset in-memory state

---

# 221. PROCESS RESTARTS

If data imports or locale switches require app restarts, ensure the restart mechanism is deterministic.

---

# 222. DEVICE ROTATION AUDIT

Re-verify:

- active dialogs and sheets
- media players
- form inputs
- active uploads
- navigation stacks

under screen rotation.

---

# 223. MULTI-WINDOW AND SPLIT-SCREEN

Verify state and lifecycle resilience when transitioning into split-screen or multi-window modes.

---

# 224. FOLDABLE SCREENS

If targeting large or foldable devices, verify adaptive layout behaviors.

If out of scope:

**NOT APPLICABLE**

---

# 225. RUNTIME LOCALE CHANGES

If language can be switched in-app, verify Activity recreation and string state updates.

---

# 226. DARK THEME CONTRAST

Verify functional dark theme contrast:

- illegible text
- custom vector drawables
- system navigation bar visibility

---

# 227. FONT SCALING RESILIENCE

Users can scale system fonts up to 200%.

Inspect critical screens for clipped text and unreachable buttons.

---

# 228. DISPLAY SIZE SCALING

Similarly, verify layout behavior under system display scaling changes.

---

# 229. TALKBACK AUDIT

If tooling allows runtime validation:

- focus traversal
- accessible labels
- dynamic state updates

Otherwise:

**TALKBACK RUNTIME TEST: NOT VERIFIED**

---

# 230. OFFLINE COLD START

If offline support is claimed:

```text
kill process
↓
disable network
↓
launch app
```

Verify what the user observes.

---

# 231. PROCESS DEATH DURING WRITES

Scenario:

```text
critical database/file write begins
↓
process killed
```

Does the operation:

- fail cleanly
- complete atomically
- recover on next launch

---

# 232. UPLOAD INTERRUPTIONS

If file uploads must survive app closure, verify background execution architecture (WorkManager).

---

# 233. DEVICE REBOOT SURVIVAL

For durable scheduled jobs, verify restart persistence after device reboot.

---

# 234. LOW DISK SPACE

Database and file writes will fail under storage pressure.

Verify that low-storage errors do not leave databases corrupted.

---

# 235. LOW MEMORY CONDITIONS

The Android OS will kill background processes under RAM pressure.

Never rely on in-memory singletons for durable persistence.

---

# 236. SYSTEM CLOCK CHANGES

If the app uses device time for:

- subscription validation
- feature cooldowns
- security tokens
- sync ordering

verify vulnerability to device clock manipulation.

---

# 237. TIMEZONE TRANSITIONS

User travel across timezones while the app runs must not corrupt date displays or scheduled notifications.

---

# 238. SYSTEM LANGUAGE CHANGES

Ensure persisted data stores canonical data values rather than localized display strings.

---

# 239. FINDING FORMAT

Every serious finding must include:

```text
ID:
Severity:
Category:
Confidence:
Status:

Feature:
Screen/Component:
Module:
File:
Function/Class:
Relevant code:

Android versions affected:
Build variant:
Lifecycle state:

Problem:

Evidence:

Execution/Lifecycle Flow:

Reproduction:

Expected behavior:

Actual behavior:

User impact:

Data/Security impact:

Root cause:

Recommended remediation:

Regression test:

Verification:

Complexity:
XS / S / M / L / XL
```

---

# 240. SEVERITY

Use:

## P0 - CRITICAL

- unauthorized access to sensitive private user data
- catastrophic data loss
- critical security compromise
- widespread database corruption

## P1 - HIGH

- crashes on core user journeys
- severe ANR conditions
- major data integrity flaws
- authentication/security defects
- release build failure on a primary feature
- process death causing loss of user data

## P2 - MEDIUM

- authentic lifecycle or reliability defect of bounded reach
- broken primary feature with a viable workaround

## P3 - LOW

- edge-case defect on secondary functionality
- minor compatibility anomaly

## P4 - IMPROVEMENT

- architectural, performance, or UX optimization that does not represent an active bug

---

# 241. CONFIDENCE

Use:

```text
HIGH
MEDIUM
LOW
```

HIGH:

directly proven by code evidence, automated test, or runtime reproduction.

MEDIUM:

strong code/architectural evidence, lacking direct device/runtime confirmation.

LOW:

depends on unverified Android OS version quirks or specific OEM behaviors.

---

# 242. STATUS

Use:

```text
CONFIRMED
LIKELY
THEORETICAL
NOT VERIFIED
```

---

# 243. ANDROID VERSION SCOPE

For version-specific issues, state the affected API range if reliably identified.

If unverified:

```text
Affected API levels: NOT VERIFIED
```

Do not guess API boundaries.

---

# 244. OEM-SPECIFIC CLAIMS

Never assert:

> Samsung kills this background worker.

without empirical runtime evidence.

Mark OEM-specific behavior as:

**NOT VERIFIED**

if not directly proven.

---

# 245. DO NOT MODIFY CODE

During the audit:

- do not refactor code
- do not update dependencies
- do not bump target SDK
- do not edit the manifest
- do not alter database schemas
- do not edit ProGuard rules
- do not submit pull requests

Complete the audit first.

---

# 246. TOOLING VERIFICATION

Where the build environment allows, execute:

```text
./gradlew lint
./gradlew test
./gradlew assembleDebug
./gradlew assembleRelease
```

or equivalent project tasks.

If release builds require unavailable signing credentials:

**RELEASE BUILD: NOT VERIFIED**

Never bypass security controls simply to force a build to pass.

---

# 247. OUTPUT - ANDROID_AUDIT_REPORT.md

Structure the final audit report as follows:

## 1. Executive Summary

- application purpose
- Android technology stack
- min / target SDK levels
- architectural summary
- overall production readiness assessment
- primary high-risk defects
- strongest implementation aspects

## 2. Technology Inventory

| Area | Technology | Version | Status |
|---|---|---|---|

## 3. Module Architecture

## 4. Application Architecture

## 5. Critical User Flows

## 6. Lifecycle Audit

## 7. Process Death / State Restoration

## 8. Compose / Views Audit

## 9. Navigation Audit

## 10. ViewModel / State Audit

## 11. Coroutines Audit

## 12. Flow Audit

## 13. Concurrency / Race Conditions

## 14. Network Audit

## 15. Authentication Audit

## 16. Room / Persistence Audit

## 17. Offline / Sync Audit

## 18. WorkManager Audit

## 19. Services / Receivers Audit

## 20. Notifications Audit

## 21. Permissions Audit

## 22. Storage / Files Audit

## 23. Security Audit

## 24. Performance / ANR Audit

## 25. Memory Audit

## 26. Media Audit

If present.

## 27. Accessibility Audit

## 28. Android Version Compatibility

## 29. Debug vs Release Audit

## 30. R8 / ProGuard Audit

## 31. Dependency Audit

## 32. Test Suite Audit

## 33. CI / Release Pipeline Audit

## 34. Findings Summary

| ID | Severity | Category | Feature | Problem | Confidence | Status |
|---|---|---|---|---|---|---|

## 35. P0 Findings

## 36. P1 Findings

## 37. P2 Findings

## 38. P3 Findings

## 39. P4 Improvements

## 40. Things Done Well

## 41. Unknown / Not Verified

## 42. Production Readiness Checklist

Use:

```text
✅ PASS
⚠️ PARTIAL
❌ FAIL
❓ NOT VERIFIED
➖ NOT APPLICABLE
```

For:

- clean Gradle sync
- lint checks
- unit test suite
- debug build assembly
- release build assembly
- R8 minification
- cold start performance
- configuration rotation
- process death restoration
- background / foreground transitions
- offline operation
- API error handling
- Room database migrations
- authentication lifecycle
- logout cleanup
- runtime permissions
- notification delivery
- WorkManager execution
- deep link handling
- security boundaries
- ANR mitigation
- memory leak prevention
- accessibility baselines
- target Android OS compatibility

## 43. Top Problems by Risk

## 44. Top Problems by ROI

## 45. Remediation Roadmap

### Phase 0 - Emergency

P0 defects.

### Phase 1 - Before Release

P1 defects.

### Phase 2 - Reliability

P2 defects.

### Phase 3 - Quality

P3 defects.

### Phase 4 - Optimization

P4 enhancements.

---

# 248. SECOND PASS - ANDROID LIFECYCLE ATTACK

Following the initial audit, re-evaluate every critical screen from an adversarial lifecycle perspective:

```text
open screen
↓
start operation
↓
rotate device
↓
background app
↓
process killed by OS
↓
return to app
```

Ask:

- what survives
- what re-executes redundantly
- what is permanently lost
- what operations are duplicated

---

# 249. DOUBLE ACTION PASS

For every critical UI action:

```text
tap twice quickly
```

Verify:

- duplicate navigation pushes
- duplicate database inserts
- duplicate network calls
- duplicate payments or messages
- duplicate worker enqueues

---

# 250. SLOW NETWORK PASS

Assume an API request takes 30 seconds.

During this interval, the user:

- rotates the device
- navigates to another screen
- backgrounds the app
- returns

Ask:

> Where does the network response land?

---

# 251. NO NETWORK PASS

For every network-dependent screen, test:

- cold launch without connectivity
- rendering cached data
- retry behavior
- error states
- user feedback

---

# 252. PROCESS DEATH PASS

Re-evaluate process death for:

- forms
- media playback
- file uploads
- audio recording
- checkout flows
- navigation graphs
- active filter selections

---

# 253. RELEASE BUILD PASS

Ask:

> What functions in debug mode but crashes under R8, resource shrinking, or signing configurations?

Scrutinize:

- reflection
- serialization
- JNI calls
- dependency injection code generation
- navigation arguments

---

# 254. OLD APP VERSION PASS

Assume a user running an APK compiled 6 months ago.

Ask:

- does the API still accept requests
- does deserialization handle newly added enum values
- does the server mandate new required fields
- does authentication protocol remain compatible

---

# 255. LOW RESOURCE PASS

Assume:

- low-end CPU
- constrained RAM
- nearly full disk storage
- degraded cellular network

Ask:

> Which flow fails first?

---

# 256. MULTI-ACCOUNT PASS

If authentication exists:

```text
User A logs in
↓
uses app
↓
logs out
↓
User B logs in
```

Re-verify:

- Room databases
- DataStore preferences
- local files
- memory caches
- notification channels
- background workers
- global state singletons

---

# 257. BACKGROUND EXECUTION PASS

Ask:

> Which feature assumes the application can run freely in the background?

Evaluate against modern Android background execution limits.

---

# 258. SECURITY SECOND PASS

Ask:

> Which component can an external application invoke directly?

Re-verify:

- exported Activities
- Services
- BroadcastReceivers
- ContentProviders
- deep links
- PendingIntents

---

# 259. DATA LOSS SECOND PASS

Ask:

> Where might a user receive a "Saved" confirmation before data is durable?

Scrutinize:

- asynchronous database writes
- network queues
- offline synchronization
- file exports
- background task execution

---

# 260. FINAL QUALITY GATE

Before returning your final response, verify:

- no P0 or P1 finding relies on superficial pattern matching
- lifecycle findings describe concrete execution scenarios
- process death is clearly distinguished from simple screen rotation
- ViewModels are never misidentified as durable storage
- coroutine cancellation is audited through proper scope ownership
- race condition findings detail concrete event ordering
- Room database findings verify transactions and constraints
- background worker findings evaluate retries and idempotency
- release build behaviors are evaluated independently of debug
- R8 findings cite specific reflection or serialization mechanisms
- permission models are version-aware
- OEM-specific claims are grounded in evidence
- API compatibility accounts for legacy installed clients
- security findings verify exported status and trust boundaries
- passing unit tests are not cited as proof that lifecycle edge cases do not exist
- improvements are clearly segregated from active bugs
- recommended remediations target true root causes

---

# FINAL RULE

I do not want generic recommendations like:

> Use Clean Architecture, ViewModel, Room, Hilt, and WorkManager.

That is not an Android audit.

I want you to reconstruct the actual runtime behavior of the application.

A real Android defect looks like this:

```text
Activity starts request
↓
user rotates device
↓
old Activity destroyed
↓
request completes
↓
callback references old Activity
↓
memory leak or invalid UI operation
```

or:

```text
Fragment View created
↓
binding stored
↓
onDestroyView
↓
binding reference remains
↓
Fragment stays on back stack
↓
old View hierarchy retained in memory
```

or:

```text
three API requests receive 401 Unauthorized
↓
three interceptor calls trigger token refresh
↓
refresh token rotated by first request
↓
remaining refresh calls fail
↓
user session becomes inconsistent
```

or:

```text
user starts offline edit
↓
local DB updated
↓
WorkManager scheduled
↓
app process dies
↓
worker later executes twice after retry
↓
server mutation is not idempotent
↓
duplicate record created
```

or:

```text
debug build
↓
reflection-based serializer works
↓
release build
↓
R8 renames/removes model metadata
↓
production-only crash
```

or:

```text
User A logs out
↓
token removed
↓
Room database not cleared
↓
User B logs in
↓
cached A records are emitted immediately
↓
cross-user data exposure
```

These are the precise hazards you must uncover.

Think in terms of:

- lifecycles
- process death
- background execution limits
- coroutine ownership
- Flow semantics
- persistence
- retries
- idempotency
- Android version discrepancies
- debug vs release variances
- user account switching
- legacy installed clients

If an issue could not be confirmed at runtime:

**NOT VERIFIED.**

If an issue depends on an unverified Android OS / API level:

**VERSION SCOPE NOT VERIFIED.**

If it represents an optimization:

**P4 - IMPROVEMENT.**

It is better to identify 10 genuine Android lifecycle and reliability defects than to generate 100 generic "Clean Architecture" recommendations.

The objective is a forensically rigorous Android audit that developers can immediately convert into:

- reproductions
- regression tests
- code fixes
- release verification steps
- production-readiness roadmap

分类与标签

编程开发、安卓应用审计、生命周期安全、协程并发、发布就绪检查

前往 AI 图片创作