Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168 Test: rebuild Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
This commit is contained in:
@@ -20,7 +20,6 @@ import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
|
@@ -18,17 +18,17 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.FeatureFlagUtils;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||
@@ -119,7 +119,7 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.BLUETOOTH_DEVICE_DETAILS;
|
||||
return SettingsEnums.BLUETOOTH_DEVICE_DETAILS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -34,7 +35,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.GearPreference;
|
||||
@@ -203,18 +203,18 @@ public final class BluetoothDevicePreference extends GearPreference implements
|
||||
|
||||
if (mCachedDevice.isConnected()) {
|
||||
metricsFeatureProvider.action(context,
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
|
||||
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
|
||||
askDisconnect();
|
||||
} else if (bondState == BluetoothDevice.BOND_BONDED) {
|
||||
metricsFeatureProvider.action(context,
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT);
|
||||
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT);
|
||||
mCachedDevice.connect(true);
|
||||
} else if (bondState == BluetoothDevice.BOND_NONE) {
|
||||
metricsFeatureProvider.action(context,
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_PAIR);
|
||||
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_PAIR);
|
||||
if (!mCachedDevice.hasHumanReadableName()) {
|
||||
metricsFeatureProvider.action(context,
|
||||
MetricsEvent.ACTION_SETTINGS_BLUETOOTH_PAIR_DEVICES_WITHOUT_NAMES);
|
||||
SettingsEnums.ACTION_SETTINGS_BLUETOOTH_PAIR_DEVICES_WITHOUT_NAMES);
|
||||
}
|
||||
pair();
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -23,7 +24,6 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BluetoothDeviceRenamePreferenceController extends
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (TextUtils.equals(getPreferenceKey(), preference.getKey()) && mFragment != null) {
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
MetricsProto.MetricsEvent.ACTION_BLUETOOTH_RENAME);
|
||||
SettingsEnums.ACTION_BLUETOOTH_RENAME);
|
||||
LocalDeviceNameDialogFragment.newInstance()
|
||||
.show(mFragment.getFragmentManager(), LocalDeviceNameDialogFragment.TAG);
|
||||
return true;
|
||||
|
@@ -19,7 +19,6 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -23,7 +24,6 @@ import android.content.pm.PackageManager;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
@@ -69,7 +69,7 @@ public class BluetoothFilesPreferenceController extends BasePreferenceController
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (KEY_RECEIVED_FILES.equals(preference.getKey())) {
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
MetricsProto.MetricsEvent.ACTION_BLUETOOTH_FILES);
|
||||
SettingsEnums.ACTION_BLUETOOTH_FILES);
|
||||
Intent intent = new Intent(ACTION_OPEN_FILES);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra(EXTRA_DIRECTION, 1 /* DIRECTION_INBOUND */);
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
@@ -27,7 +28,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
|
||||
@@ -114,7 +114,7 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.BLUETOOTH_PAIRING;
|
||||
return SettingsEnums.BLUETOOTH_PAIRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,6 +16,7 @@
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
@@ -37,7 +38,6 @@ import android.widget.TextView;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.BLUETOOTH_DIALOG_FRAGMENT;
|
||||
return SettingsEnums.BLUETOOTH_DIALOG_FRAGMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -33,9 +33,6 @@ import androidx.preference.Preference;
|
||||
import com.android.internal.app.AlertActivity;
|
||||
import com.android.internal.app.AlertController;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
|
||||
/**
|
||||
* BluetoothPermissionActivity shows a dialog for accepting incoming
|
||||
|
@@ -19,6 +19,7 @@ import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
|
||||
|
||||
import android.annotation.ColorInt;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -32,7 +33,6 @@ import androidx.slice.builders.ListBuilder;
|
||||
import androidx.slice.builders.ListBuilder.RowBuilder;
|
||||
import androidx.slice.builders.SliceAction;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SubSettings;
|
||||
import com.android.settings.connecteddevice.BluetoothDashboardFragment;
|
||||
@@ -98,7 +98,7 @@ public class BluetoothSliceBuilder {
|
||||
SettingsSlicesContract.KEY_BLUETOOTH).build();
|
||||
return SliceBuilderUtils.buildSearchResultPageIntent(context,
|
||||
BluetoothDashboardFragment.class.getName(), null /* key */, screenTitle,
|
||||
MetricsProto.MetricsEvent.SETTINGS_CONNECTED_DEVICE_CATEGORY)
|
||||
SettingsEnums.SETTINGS_CONNECTED_DEVICE_CATEGORY)
|
||||
.setClassName(context.getPackageName(), SubSettings.class.getName())
|
||||
.setData(contentUri);
|
||||
}
|
||||
|
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.location.ScanningSettings;
|
||||
@@ -67,7 +66,7 @@ public class BluetoothSwitchPreferenceController
|
||||
mBluetoothEnabler = new BluetoothEnabler(context,
|
||||
switchController,
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider(),
|
||||
MetricsEvent.ACTION_SETTINGS_MASTER_SWITCH_BLUETOOTH_TOGGLE,
|
||||
SettingsEnums.ACTION_SETTINGS_MASTER_SWITCH_BLUETOOTH_TOGGLE,
|
||||
mRestrictionUtils);
|
||||
mBluetoothEnabler.setToggleCallback(this);
|
||||
}
|
||||
@@ -96,7 +95,7 @@ public class BluetoothSwitchPreferenceController
|
||||
// send users to scanning settings if they click on the link in the summary text
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(ScanningSettings.class.getName())
|
||||
.setSourceMetricsCategory(MetricsProto.MetricsEvent.BLUETOOTH_FRAGMENT)
|
||||
.setSourceMetricsCategory(SettingsEnums.BLUETOOTH_FRAGMENT)
|
||||
.launch();
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothDevicePicker;
|
||||
@@ -30,7 +31,6 @@ import android.view.MenuInflater;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
@@ -75,7 +75,7 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.BLUETOOTH_DEVICE_PICKER;
|
||||
return SettingsEnums.BLUETOOTH_DEVICE_PICKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -26,7 +27,6 @@ import android.os.Bundle;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
@@ -58,7 +58,7 @@ public class ForgetDeviceDialogFragment extends InstrumentedDialogFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.DIALOG_BLUETOOTH_PAIRED_DEVICE_FORGET;
|
||||
return SettingsEnums.DIALOG_BLUETOOTH_PAIRED_DEVICE_FORGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -23,7 +24,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
|
||||
/** Provides a dialog for changing the advertised name of the local bluetooth adapter. */
|
||||
@@ -71,7 +71,7 @@ public class LocalDeviceNameDialogFragment extends BluetoothNameDialogFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.DIALOG_BLUETOOTH_RENAME;
|
||||
return SettingsEnums.DIALOG_BLUETOOTH_RENAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,13 +16,13 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
@@ -58,7 +58,7 @@ public class RemoteDeviceNameDialogFragment extends BluetoothNameDialogFragment
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.DIALOG_BLUETOOTH_PAIRED_DEVICE_RENAME;
|
||||
return SettingsEnums.DIALOG_BLUETOOTH_PAIRED_DEVICE_RENAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.Context;
|
||||
@@ -27,7 +28,6 @@ import android.widget.Toast;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
@@ -90,15 +90,10 @@ public final class Utils {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
// TODO: wire this up to show connection errors...
|
||||
static void showConnectingError(Context context, String name) {
|
||||
showConnectingError(context, name, getLocalBtManager(context));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static void showConnectingError(Context context, String name, LocalBluetoothManager manager) {
|
||||
FeatureFactory.getFactory(context).getMetricsFeatureProvider().visible(context,
|
||||
MetricsEvent.VIEW_UNKNOWN, MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT_ERROR);
|
||||
SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT_ERROR);
|
||||
showError(context, name, R.string.bluetooth_connecting_error_message, manager);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user