diff options
author | Fan Zhang <zhfan@google.com> | 2018-05-14 14:06:23 -0700 |
---|---|---|
committer | Fan Zhang <zhfan@google.com> | 2018-05-16 10:51:31 -0700 |
commit | e2346643c7de1a8d371e3bfba32a40d533303c72 (patch) | |
tree | c2098ae1444ca5d1f70479706189c1afa5d602cf /src/com/android/settings/widget/EntityHeaderController.java | |
parent | b976044f57c5bac41debba52b42875f968e8d3ad (diff) |
Move app setting link from Entity header to pref controller
Change-Id: I13a27486a9c9b4c4fb358715d678473e63c1b624
Fixes: 79688822
Test: robotest
Diffstat (limited to 'src/com/android/settings/widget/EntityHeaderController.java')
-rw-r--r-- | src/com/android/settings/widget/EntityHeaderController.java | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java index eeb8b7929c..05d2be1feb 100644 --- a/src/com/android/settings/widget/EntityHeaderController.java +++ b/src/com/android/settings/widget/EntityHeaderController.java @@ -18,7 +18,6 @@ package com.android.settings.widget; import static com.android.internal.logging.nano.MetricsProto.MetricsEvent .ACTION_OPEN_APP_NOTIFICATION_SETTING; -import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_OPEN_APP_SETTING; import android.annotation.IdRes; import android.annotation.UserIdInt; @@ -28,7 +27,6 @@ import android.app.Fragment; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; -import android.content.pm.ResolveInfo; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -59,15 +57,13 @@ import java.lang.annotation.RetentionPolicy; public class EntityHeaderController { @IntDef({ActionType.ACTION_NONE, - ActionType.ACTION_APP_PREFERENCE, ActionType.ACTION_NOTIF_PREFERENCE, ActionType.ACTION_EDIT_PREFERENCE,}) @Retention(RetentionPolicy.SOURCE) public @interface ActionType { int ACTION_NONE = 0; - int ACTION_APP_PREFERENCE = 1; - int ACTION_NOTIF_PREFERENCE = 2; - int ACTION_EDIT_PREFERENCE = 3; + int ACTION_NOTIF_PREFERENCE = 1; + int ACTION_EDIT_PREFERENCE = 2; } public static final String PREF_KEY_APP_HEADER = "pref_app_header"; @@ -298,9 +294,9 @@ public class EntityHeaderController { @Override public void onClick(View v) { AppInfoBase.startAppInfoFragment( - AppInfoDashboardFragment.class, R.string.application_info_label, - mPackageName, mUid, mFragment, 0 /* request */, - mMetricsCategory); + AppInfoDashboardFragment.class, R.string.application_info_label, + mPackageName, mUid, mFragment, 0 /* request */, + mMetricsCategory); } }); return; @@ -372,27 +368,6 @@ public class EntityHeaderController { } return; } - case ActionType.ACTION_APP_PREFERENCE: { - final Intent intent = resolveIntent( - new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName)); - if (intent == null) { - button.setImageDrawable(null); - button.setVisibility(View.GONE); - return; - } - button.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - FeatureFactory.getFactory(mAppContext).getMetricsFeatureProvider() - .actionWithSource(mAppContext, mMetricsCategory, - ACTION_OPEN_APP_SETTING); - mFragment.startActivity(intent); - } - }); - button.setImageResource(R.drawable.ic_settings_24dp); - button.setVisibility(View.VISIBLE); - return; - } case ActionType.ACTION_NONE: { button.setVisibility(View.GONE); return; @@ -400,14 +375,6 @@ public class EntityHeaderController { } } - private Intent resolveIntent(Intent i) { - ResolveInfo result = mAppContext.getPackageManager().resolveActivity(i, 0); - if (result != null) { - return new Intent(i.getAction()) - .setClassName(result.activityInfo.packageName, result.activityInfo.name); - } - return null; - } private void setText(@IdRes int id, CharSequence text) { TextView textView = mHeader.findViewById(id); |