Loading src/com/android/settings/slices/SliceBuilderUtils.java +13 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.settings.slices.SettingsSliceProvider.EXTRA_SLICE_KEY; import android.annotation.ColorInt; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; Loading @@ -47,6 +48,7 @@ import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.SubSettings; import com.android.settings.Utils; import com.android.settings.accessibility.AccessibilitySlicePreferenceController; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SliderPreferenceController; import com.android.settings.core.SubSettingLauncher; Loading Loading @@ -448,7 +450,17 @@ public class SliceBuilderUtils { iconResource = R.drawable.ic_settings_accent; } try { // LINT.IfChange(createA11yIcon) if (AccessibilitySlicePreferenceController.class.getName().equals( data.getPreferenceController())) { ComponentName serviceComponent = ComponentName.unflattenFromString(data.getKey()); return IconCompat.createWithResource( context.createPackageContext(serviceComponent.getPackageName(), 0), iconResource); // LINT.ThenChange() } else { return IconCompat.createWithResource(context, iconResource); } } catch (Exception e) { Log.w(TAG, "Falling back to settings icon because there is an error getting slice icon " + data.getUri(), e); Loading src/com/android/settings/slices/SliceDataConverter.java +7 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,12 @@ class SliceDataConverter { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; final String packageName = serviceInfo.packageName; final ComponentName componentName = new ComponentName(packageName, serviceInfo.name); // If we change the flattenedName that is used to be set as a key of the Slice, we // need to make corresponding change in SliceBuilderUtils, since we rely on the // the A11y Service Slice's key to be a ComponentName to get the correct package name // to grab the icon belongs to that package. // LINT.IfChange final String flattenedName = componentName.flattenToString(); if (!a11yServiceNames.contains(flattenedName)) { Loading @@ -287,6 +293,7 @@ class SliceDataConverter { } sliceDataBuilder.setKey(flattenedName) // LINT.ThenChange(SliceBuilderUtils.java:createA11yIcon) .setTitle(title) .setUri(new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) Loading Loading
src/com/android/settings/slices/SliceBuilderUtils.java +13 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.settings.slices.SettingsSliceProvider.EXTRA_SLICE_KEY; import android.annotation.ColorInt; import android.app.PendingIntent; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; Loading @@ -47,6 +48,7 @@ import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.SubSettings; import com.android.settings.Utils; import com.android.settings.accessibility.AccessibilitySlicePreferenceController; import com.android.settings.core.BasePreferenceController; import com.android.settings.core.SliderPreferenceController; import com.android.settings.core.SubSettingLauncher; Loading Loading @@ -448,7 +450,17 @@ public class SliceBuilderUtils { iconResource = R.drawable.ic_settings_accent; } try { // LINT.IfChange(createA11yIcon) if (AccessibilitySlicePreferenceController.class.getName().equals( data.getPreferenceController())) { ComponentName serviceComponent = ComponentName.unflattenFromString(data.getKey()); return IconCompat.createWithResource( context.createPackageContext(serviceComponent.getPackageName(), 0), iconResource); // LINT.ThenChange() } else { return IconCompat.createWithResource(context, iconResource); } } catch (Exception e) { Log.w(TAG, "Falling back to settings icon because there is an error getting slice icon " + data.getUri(), e); Loading
src/com/android/settings/slices/SliceDataConverter.java +7 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,12 @@ class SliceDataConverter { final ServiceInfo serviceInfo = resolveInfo.serviceInfo; final String packageName = serviceInfo.packageName; final ComponentName componentName = new ComponentName(packageName, serviceInfo.name); // If we change the flattenedName that is used to be set as a key of the Slice, we // need to make corresponding change in SliceBuilderUtils, since we rely on the // the A11y Service Slice's key to be a ComponentName to get the correct package name // to grab the icon belongs to that package. // LINT.IfChange final String flattenedName = componentName.flattenToString(); if (!a11yServiceNames.contains(flattenedName)) { Loading @@ -287,6 +293,7 @@ class SliceDataConverter { } sliceDataBuilder.setKey(flattenedName) // LINT.ThenChange(SliceBuilderUtils.java:createA11yIcon) .setTitle(title) .setUri(new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) Loading