Add SpaAppBridgeActivity for application usage

This requires the user to pass into the package name, which enabling
the feature of navigating to app info pages.

Bug: 263553430
Test: Manually with Settings
Change-Id: I9405e3732d99f78cd87e62d73b0c9519a8e2d71f
This commit is contained in:
Chaohui Wang
2022-12-23 16:48:40 +08:00
parent fec083b2cd
commit a9c624b0d3
5 changed files with 138 additions and 9 deletions

12
src/com/android/settings/spa/SpaBridgeActivity.kt Executable file → Normal file
View File

@@ -33,17 +33,17 @@ class SpaBridgeActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
getDestination()?.let { destination ->
startSpaActivity(this, destination)
startSpaActivity(destination)
}
finish()
}
private fun getDestination(): String? =
packageManager.getActivityInfo(
componentName, ComponentInfoFlags.of(PackageManager.GET_META_DATA.toLong())
).metaData.getString(META_DATA_KEY_DESTINATION)
companion object {
fun Activity.getDestination(): String? =
packageManager.getActivityInfo(
componentName, ComponentInfoFlags.of(PackageManager.GET_META_DATA.toLong())
).metaData.getString(META_DATA_KEY_DESTINATION)
private const val META_DATA_KEY_DESTINATION = "com.android.settings.spa.DESTINATION"
}
}