Fix UsbResolverActivity SuperNotCalledException (pt2)

Instead of calling the normal path, this change creates
a path to call Activity#onCreate directly and avoid
initializing state when the activity is about to self
finish()

Bug: 201719995
Test: adb shell am start -n
      com.android.systemui/com.android.systemui.usb.UsbResolverActivity
Change-Id: I40ee792e341b828a3e288b1fc713f6df13728b4a
This commit is contained in:
Mark Renouf
2021-10-04 11:28:25 -04:00
parent c1512c20e5
commit 46abffb3de
2 changed files with 11 additions and 4 deletions

View File

@@ -314,6 +314,15 @@ public class ResolverActivity extends Activity implements
return intent;
}
/**
* Call {@link Activity#onCreate} without initializing anything further. This should
* only be used when the activity is about to be immediately finished to avoid wasting
* initializing steps and leaking resources.
*/
protected void super_onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// Use a specialized prompt when we're handling the 'Home' app startActivity()