Clean up unused Sliceable.copy()
Sliceable.isCopyableSlice() is not set to true for any controller, so this function is not used. Usage is removed in Change: I81474aed994678c42d73cc59e169573880de1378 Bug: 227722942 Test: robotest & manual Change-Id: I86e23aa8ad43f60b5017ff0a278e20e3f727706c
This commit is contained in:
@@ -106,12 +106,6 @@ public class SettingsSliceProvider extends SliceProvider {
|
||||
public static final String ACTION_SLIDER_CHANGED =
|
||||
"com.android.settings.slice.action.SLIDER_CHANGED";
|
||||
|
||||
/**
|
||||
* Action passed for copy data for the Copyable Slices.
|
||||
*/
|
||||
public static final String ACTION_COPY =
|
||||
"com.android.settings.slice.action.COPY";
|
||||
|
||||
/**
|
||||
* Intent Extra passed for the key identifying the Setting Slice.
|
||||
*/
|
||||
|
@@ -19,7 +19,6 @@ package com.android.settings.slices;
|
||||
import static com.android.settings.bluetooth.BluetoothSliceBuilder.ACTION_BLUETOOTH_SLICE_CHANGED;
|
||||
import static com.android.settings.network.telephony.Enhanced4gLteSliceHelper.ACTION_ENHANCED_4G_LTE_CHANGED;
|
||||
import static com.android.settings.notification.zen.ZenModeSliceBuilder.ACTION_ZEN_MODE_SLICE_CHANGED;
|
||||
import static com.android.settings.slices.SettingsSliceProvider.ACTION_COPY;
|
||||
import static com.android.settings.slices.SettingsSliceProvider.ACTION_SLIDER_CHANGED;
|
||||
import static com.android.settings.slices.SettingsSliceProvider.ACTION_TOGGLE_CHANGED;
|
||||
import static com.android.settings.slices.SettingsSliceProvider.EXTRA_SLICE_KEY;
|
||||
@@ -100,9 +99,6 @@ public class SliceBroadcastReceiver extends BroadcastReceiver {
|
||||
.getNewWifiCallingSliceHelper(context)
|
||||
.handleWifiCallingPreferenceChanged(intent);
|
||||
break;
|
||||
case ACTION_COPY:
|
||||
handleCopyAction(context, sliceUri, key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,29 +167,6 @@ public class SliceBroadcastReceiver extends BroadcastReceiver {
|
||||
context.getContentResolver().notifyChange(sliceUri, null /* observer */);
|
||||
}
|
||||
|
||||
private void handleCopyAction(Context context, Uri sliceUri, String key) {
|
||||
if (TextUtils.isEmpty(key)) {
|
||||
throw new IllegalArgumentException("No key passed to Intent for controller");
|
||||
}
|
||||
|
||||
final BasePreferenceController controller = getPreferenceController(context, key);
|
||||
|
||||
if (!(controller instanceof Sliceable)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Copyable action passed for a non-copyable key:" + key);
|
||||
}
|
||||
|
||||
if (!controller.isAvailable()) {
|
||||
Log.w(TAG, "Can't update " + key + " since the setting is unavailable");
|
||||
if (!controller.hasAsyncUpdate()) {
|
||||
context.getContentResolver().notifyChange(sliceUri, null /* observer */);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
controller.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log Slice value update events into MetricsFeatureProvider. The logging schema generally
|
||||
* follows the pattern in SharedPreferenceLogger.
|
||||
|
@@ -94,10 +94,6 @@ public class SliceBuilderUtils {
|
||||
return buildUnavailableSlice(context, sliceData);
|
||||
}
|
||||
|
||||
if (controller.isCopyableSlice()) {
|
||||
return buildCopyableSlice(context, sliceData, controller);
|
||||
}
|
||||
|
||||
switch (sliceData.getSliceType()) {
|
||||
case SliceData.SliceType.INTENT:
|
||||
return buildIntentSlice(context, sliceData, controller);
|
||||
@@ -350,32 +346,6 @@ public class SliceBuilderUtils {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static Slice buildCopyableSlice(Context context, SliceData sliceData,
|
||||
BasePreferenceController controller) {
|
||||
final SliceAction copyableAction = getCopyableAction(context, sliceData);
|
||||
final PendingIntent contentIntent = getContentPendingIntent(context, sliceData);
|
||||
final IconCompat icon = getSafeIcon(context, sliceData);
|
||||
final SliceAction primaryAction = SliceAction.createDeeplink(contentIntent, icon,
|
||||
ListBuilder.ICON_IMAGE,
|
||||
sliceData.getTitle());
|
||||
final CharSequence subtitleText = getSubtitleText(context, controller, sliceData);
|
||||
@ColorInt final int color = Utils.getColorAccentDefaultColor(context);
|
||||
final Set<String> keywords = buildSliceKeywords(sliceData);
|
||||
final RowBuilder rowBuilder = new RowBuilder()
|
||||
.setTitle(sliceData.getTitle())
|
||||
.setPrimaryAction(primaryAction)
|
||||
.addEndItem(copyableAction);
|
||||
if (!Utils.isSettingsIntelligence(context)) {
|
||||
rowBuilder.setSubtitle(subtitleText);
|
||||
}
|
||||
|
||||
return new ListBuilder(context, sliceData.getUri(), ListBuilder.INFINITY)
|
||||
.setAccentColor(color)
|
||||
.addRow(rowBuilder)
|
||||
.setKeywords(keywords)
|
||||
.build();
|
||||
}
|
||||
|
||||
static BasePreferenceController getPreferenceController(Context context,
|
||||
String controllerClassName, String controllerKey) {
|
||||
try {
|
||||
@@ -398,14 +368,6 @@ public class SliceBuilderUtils {
|
||||
return getActionIntent(context, SettingsSliceProvider.ACTION_SLIDER_CHANGED, sliceData);
|
||||
}
|
||||
|
||||
private static SliceAction getCopyableAction(Context context, SliceData sliceData) {
|
||||
final PendingIntent intent = getActionIntent(context,
|
||||
SettingsSliceProvider.ACTION_COPY, sliceData);
|
||||
final IconCompat icon = IconCompat.createWithResource(context,
|
||||
R.drawable.ic_content_copy_grey600_24dp);
|
||||
return SliceAction.create(intent, icon, ListBuilder.ICON_IMAGE, sliceData.getTitle());
|
||||
}
|
||||
|
||||
private static boolean isValidSummary(Context context, CharSequence summary) {
|
||||
if (summary == null || TextUtils.isEmpty(summary.toString().trim())) {
|
||||
return false;
|
||||
|
@@ -88,20 +88,6 @@ public interface Sliceable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the key slice information to the clipboard.
|
||||
* It is highly recommended to show the toast to notify users when implemented this function.
|
||||
*/
|
||||
default void copy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not it's a copyable slice.
|
||||
*/
|
||||
default boolean isCopyableSlice() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not summary comes from something dynamic (ie, not hardcoded in xml)
|
||||
*/
|
||||
|
Reference in New Issue
Block a user