Clean up FeatureFactory.getFeature()

Bug: 286764889
Test: m Settings
Change-Id: I7e472e6b0ca6b7a735c1b92742ddf06c545176fc
This commit is contained in:
Chaohui Wang
2023-08-04 15:42:43 +08:00
parent 0062308347
commit 8e2ae547d6
220 changed files with 282 additions and 306 deletions

View File

@@ -148,7 +148,7 @@ public class UsageAccessDetails extends AppInfoWithHeader implements OnPreferenc
int logCategory = newState ? SettingsEnums.APP_SPECIAL_PERMISSION_USAGE_VIEW_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_USAGE_VIEW_DENY;
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
metricsFeatureProvider.action(
metricsFeatureProvider.getAttribution(getActivity()),
logCategory,

View File

@@ -59,7 +59,7 @@ public class AppSettingPreferenceController extends AppInfoPreferenceControllerB
if (intent == null) {
return false;
}
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider()
.action(SettingsEnums.PAGE_UNKNOWN,
SettingsEnums.ACTION_OPEN_APP_SETTING,
mParent.getMetricsCategory(),

View File

@@ -121,7 +121,7 @@ public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenc
int logCategory = newState ? SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_APPDRAW_DENY;
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
metricsFeatureProvider.action(
metricsFeatureProvider.getAttribution(getActivity()),
logCategory,

View File

@@ -63,7 +63,7 @@ public class InstantAppButtonDialogFragment extends InstrumentedDialogFragment i
public void onClick(DialogInterface dialog, int which) {
final Context context = getContext();
final PackageManager packageManager = context.getPackageManager();
FeatureFactory.getFactory(context).getMetricsFeatureProvider()
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider()
.action(context, SettingsEnums.ACTION_SETTINGS_CLEAR_INSTANT_APP, mPackageName);
packageManager.deletePackageAsUser(mPackageName, null, 0, UserHandle.myUserId());
}

View File

@@ -67,7 +67,7 @@ public class ManageExternalStorageDetails extends AppInfoWithHeader implements
mSwitchPref.setOnPreferenceChangeListener(this);
mMetricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
}
@Override

View File

@@ -89,7 +89,7 @@ public class WriteSettingsDetails extends AppInfoWithHeader implements OnPrefere
void logSpecialPermissionChange(boolean newState, String packageName) {
int logCategory = newState ? SettingsEnums.APP_SPECIAL_PERMISSION_SETTINGS_CHANGE_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_SETTINGS_CHANGE_DENY;
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider().action(getContext(),
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider().action(getContext(),
logCategory, packageName);
}

View File

@@ -246,7 +246,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
public void onClick(View v) {
CloneBackend cloneBackend = CloneBackend.getInstance(context);
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(context).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
String packageName = entry.info.packageName;

View File

@@ -573,7 +573,7 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
void logSpecialPermissionChange(boolean allow, String packageName) {
int logCategory = allow ? SettingsEnums.APP_SPECIAL_PERMISSION_ADMIN_ALLOW :
SettingsEnums.APP_SPECIAL_PERMISSION_ADMIN_DENY;
FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider().action(
SettingsEnums.PAGE_UNKNOWN,
logCategory,
SettingsEnums.PAGE_UNKNOWN,

View File

@@ -104,7 +104,7 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
mPackageManager = mContext.getPackageManager();
mIPackageManager = AppGlobals.getPackageManager();
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
}
@Override

View File

@@ -135,7 +135,7 @@ public class ApprovalPreferenceController extends BasePreferenceController {
void logSpecialPermissionChange(boolean enable, String packageName) {
final int logCategory = enable ? SettingsEnums.APP_SPECIAL_PERMISSION_NOTIVIEW_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_NOTIVIEW_DENY;
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider().action(mContext,
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider().action(mContext,
logCategory, packageName);
}
}

View File

@@ -124,7 +124,7 @@ public class PictureInPictureDetails extends AppInfoWithHeader
? SettingsEnums.APP_PICTURE_IN_PICTURE_ALLOW
: SettingsEnums.APP_PICTURE_IN_PICTURE_DENY;
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
metricsFeatureProvider.action(
metricsFeatureProvider.getAttribution(getActivity()),
logCategory,

View File

@@ -126,7 +126,7 @@ public class PremiumSmsAccess extends EmptyTextSettings
if (category != SmsManager.PREMIUM_SMS_CONSENT_UNKNOWN) {
// TODO(117860032): Category is wrong. It should be defined in SettingsEnums.
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
metricsFeatureProvider.action(
metricsFeatureProvider.getAttribution(getActivity()),
category,

View File

@@ -69,7 +69,7 @@ public class VrListenerSettings extends ManagedServiceSettings {
int logCategory = enable ? SettingsEnums.APP_SPECIAL_PERMISSION_VRHELPER_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_VRHELPER_DENY;
final MetricsFeatureProvider metricsFeatureProvider =
FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider();
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
metricsFeatureProvider.action(
metricsFeatureProvider.getAttribution(getActivity()),
logCategory,

View File

@@ -23,7 +23,6 @@ import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.ParceledListSlice;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.util.ArraySet;
import android.util.Log;
@@ -110,7 +109,7 @@ public class ZenAccessController extends BasePreferenceController {
static void logSpecialPermissionChange(boolean enable, String packageName, Context context) {
int logCategory = enable ? SettingsEnums.APP_SPECIAL_PERMISSION_DND_ALLOW
: SettingsEnums.APP_SPECIAL_PERMISSION_DND_DENY;
FeatureFactory.getFactory(context).getMetricsFeatureProvider().action(context,
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider().action(context,
logCategory, packageName);
}
}