Fixing the crash when tapping the "Downloaded apps" in Accessibility page.
Root cause: When Accessibility settings parse the application which is from google play store, the settings have no check if the resource is valid before delivery the parameter into the corresponding fragment. Solution: Check if the resource is valid before creating the image uri. Bug: 190716289 Test: manual test Change-Id: I56eba2232ddf6ed5b2e526d4698479465a012e52
This commit is contained in:
@@ -78,10 +78,12 @@ public class LaunchAccessibilityActivityPreferenceFragment extends ToggleFeature
|
|||||||
// Settings animated image.
|
// Settings animated image.
|
||||||
final int animatedImageRes = arguments.getInt(
|
final int animatedImageRes = arguments.getInt(
|
||||||
AccessibilitySettings.EXTRA_ANIMATED_IMAGE_RES);
|
AccessibilitySettings.EXTRA_ANIMATED_IMAGE_RES);
|
||||||
|
if (animatedImageRes > 0) {
|
||||||
mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
||||||
.authority(mComponentName.getPackageName())
|
.authority(mComponentName.getPackageName())
|
||||||
.appendPath(String.valueOf(animatedImageRes))
|
.appendPath(String.valueOf(animatedImageRes))
|
||||||
.build();
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
// Settings html description.
|
// Settings html description.
|
||||||
mHtmlDescription = arguments.getCharSequence(AccessibilitySettings.EXTRA_HTML_DESCRIPTION);
|
mHtmlDescription = arguments.getCharSequence(AccessibilitySettings.EXTRA_HTML_DESCRIPTION);
|
||||||
|
@@ -396,10 +396,12 @@ public class ToggleAccessibilityServicePreferenceFragment extends
|
|||||||
// Settings animated image.
|
// Settings animated image.
|
||||||
final int animatedImageRes = arguments.getInt(
|
final int animatedImageRes = arguments.getInt(
|
||||||
AccessibilitySettings.EXTRA_ANIMATED_IMAGE_RES);
|
AccessibilitySettings.EXTRA_ANIMATED_IMAGE_RES);
|
||||||
|
if (animatedImageRes > 0) {
|
||||||
mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
mImageUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
||||||
.authority(mComponentName.getPackageName())
|
.authority(mComponentName.getPackageName())
|
||||||
.appendPath(String.valueOf(animatedImageRes))
|
.appendPath(String.valueOf(animatedImageRes))
|
||||||
.build();
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
// Get Accessibility service name.
|
// Get Accessibility service name.
|
||||||
mPackageName = getAccessibilityServiceInfo().getResolveInfo().loadLabel(
|
mPackageName = getAccessibilityServiceInfo().getResolveInfo().loadLabel(
|
||||||
|
Reference in New Issue
Block a user