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:
12
src/com/android/settings/spa/SpaBridgeActivity.kt
Executable file → Normal file
12
src/com/android/settings/spa/SpaBridgeActivity.kt
Executable file → Normal 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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user