Fix the wrong package name to return the wrong resources.

It should pass mSuspendingPackage instead of mSuspendedPackage as the
parameter of the getResourcesForApplication.

Root cause: The intellij is very smart to provide the autocomplete
    options and the developer choose the wrong option.
Solution:
    * Add file_pattern in TEST_MAPPING to trigger the CTS tests.
    * The developer should take the autocomplete option very
      carefully especially the options are very alike.

Fixes: 171835218
Fixes: 171779738
Test: atest CtsSuspendAppsTestCases
Test: atest -p frameworks/base/core/java/com/android/internal/app
Change-Id: I0a213e5fcbf207b89f203e25cf1ace1b8406a879
This commit is contained in:
Felka Chang
2020-10-29 13:59:32 +08:00
parent 68e9f0229d
commit d168885c07
2 changed files with 8 additions and 2 deletions

View File

@@ -193,7 +193,7 @@ public class SuspendedAppActivity extends AlertActivity
try {
mSuspendingAppResources = createContextAsUser(
UserHandle.of(mUserId), /* flags */ 0).getPackageManager()
.getResourcesForApplication(mSuspendedPackage);
.getResourcesForApplication(mSuspendingPackage);
} catch (PackageManager.NameNotFoundException ne) {
Slog.e(TAG, "Could not find resources for " + mSuspendingPackage, ne);
}

View File

@@ -1,4 +1,10 @@
{
"presubmit": [
{
"name": "CtsSuspendAppsTestCases",
"file_patterns": ["(/|^)SuspendedAppActivity\\.java"]
}
],
"postsubmit": [
{
"name": "FrameworksCoreTests",
@@ -17,4 +23,4 @@
]
}
]
}
}