Refactor Utils.startWithFragment to SubSettingLauncher
- Use the new launcher in AccountTypePrefernce for now. Will migrate the rest in follow up CLs. Change-Id: I67aa49f54b39ecea4ecfdc32ccbd827d21fc79b8 Bug: 73250851 Test: robotest
This commit is contained in:
@@ -23,9 +23,7 @@ import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.KeyguardManager;
|
||||
@@ -34,7 +32,6 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -52,9 +49,6 @@ import android.graphics.Canvas;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.icu.text.RelativeDateTimeFormatter;
|
||||
import android.icu.text.RelativeDateTimeFormatter.RelativeUnit;
|
||||
import android.icu.util.ULocale;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.Network;
|
||||
@@ -107,7 +101,6 @@ import com.android.settings.wrapper.DevicePolicyManagerWrapper;
|
||||
import com.android.settings.wrapper.FingerprintManagerWrapper;
|
||||
import com.android.settingslib.core.instrumentation.VisibilityLoggerMixin;
|
||||
|
||||
import com.android.settingslib.utils.StringUtil;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -237,16 +230,6 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default link's IP addresses, if any, taking into account IPv4 and IPv6 style
|
||||
* addresses.
|
||||
* @return the formatted and newline-separated IP addresses, or null if none.
|
||||
*/
|
||||
public static String getDefaultIpAddresses(ConnectivityManager cm) {
|
||||
LinkProperties prop = cm.getActiveLinkProperties();
|
||||
return formatIpAddresses(prop);
|
||||
}
|
||||
|
||||
private static String formatIpAddresses(LinkProperties prop) {
|
||||
if (prop == null) return null;
|
||||
Iterator<InetAddress> iter = prop.getAllAddresses().iterator();
|
||||
@@ -400,23 +383,6 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/** Not global warming, it's global change warning. */
|
||||
public static Dialog buildGlobalChangeWarningDialog(final Context context, int titleResId,
|
||||
final Runnable positiveAction) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(titleResId);
|
||||
builder.setMessage(R.string.global_change_warning);
|
||||
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
positiveAction.run();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static boolean hasMultipleUsers(Context context) {
|
||||
return ((UserManager) context.getSystemService(Context.USER_SERVICE))
|
||||
.getUsers().size() > 1;
|
||||
@@ -477,20 +443,11 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
* @param resultTo Option fragment that should receive the result of the activity launch.
|
||||
* @param resultRequestCode If resultTo is non-null, this is the request code in which
|
||||
* to report the result.
|
||||
* @param titleResPackageName Optional package name for the resource id of the title.
|
||||
* @param titleResId resource id for the String to display for the title of this set
|
||||
* of preferences.
|
||||
* @param title String to display for the title of this set of preferences.
|
||||
* @param metricsCategory The current metricsCategory for logging source when fragment starts
|
||||
*/
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
|
||||
CharSequence title, int metricsCategory) {
|
||||
startWithFragment(context, fragmentName, args, resultTo, resultRequestCode,
|
||||
titleResPackageName, titleResId, title, false /* not a shortcut */,
|
||||
metricsCategory);
|
||||
}
|
||||
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleResId,
|
||||
CharSequence title, boolean isShortcut, int metricsCategory) {
|
||||
@@ -511,7 +468,6 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
|
||||
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
|
||||
CharSequence title, boolean isShortcut, int metricsCategory, int flags) {
|
||||
|
Reference in New Issue
Block a user