Loading res/xml/app_info_settings.xml +8 −1 Original line number Diff line number Diff line Loading @@ -161,10 +161,17 @@ </PreferenceCategory> <Preference android:key="app_settings_link" android:title="@string/app_settings_link" settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController" settings:allowDividerAbove="true" /> <Preference android:key="app_version" android:selectable="false" android:order="9999" settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController" /> settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController" settings:allowDividerAbove="true" /> </PreferenceScreen> No newline at end of file src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public class AppHeaderViewPreferenceController extends BasePreferenceController mEntityHeaderController = EntityHeaderController .newInstance(activity, mParent, mHeader.findViewById(R.id.entity_header)) .setPackageName(mPackageName) .setButtonActions(EntityHeaderController.ActionType.ACTION_APP_PREFERENCE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE) .bindHeaderButtons(); } Loading src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,9 @@ public class AppInfoDashboardFragment extends DashboardFragment use(AppOpenByDefaultPreferenceController.class).setParentFragment(this); use(AppPermissionPreferenceController.class).setParentFragment(this); use(AppPermissionPreferenceController.class).setPackageName(packageName); use(AppSettingPreferenceController.class) .setPackageName(packageName) .setParentFragment(this); use(AppStoragePreferenceController.class).setParentFragment(this); use(AppVersionPreferenceController.class).setParentFragment(this); use(InstantAppDomainsPreferenceController.class).setParentFragment(this); Loading src/com/android/settings/applications/appinfo/AppSettingPreferenceController.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.applications.appinfo; import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_OPEN_APP_SETTING; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.support.v7.preference.Preference; import android.text.TextUtils; import com.android.settings.overlay.FeatureFactory; public class AppSettingPreferenceController extends AppInfoPreferenceControllerBase { private String mPackageName; public AppSettingPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); } public AppSettingPreferenceController setPackageName(String packageName) { mPackageName = packageName; return this; } @Override public int getAvailabilityStatus() { if (TextUtils.isEmpty(mPackageName) || mParent == null) { return CONDITIONALLY_UNAVAILABLE; } final Intent intent = resolveIntent( new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName)); return intent != null ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } final Intent intent = resolveIntent( new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName)); if (intent == null) { return false; } FeatureFactory.getFactory(mContext).getMetricsFeatureProvider() .actionWithSource(mContext, mParent.getMetricsCategory(), ACTION_OPEN_APP_SETTING); mContext.startActivity(intent); return true; } private Intent resolveIntent(Intent i) { ResolveInfo result = mContext.getPackageManager().resolveActivity(i, 0); if (result != null) { return new Intent(i.getAction()) .setClassName(result.activityInfo.packageName, result.activityInfo.name); } return null; } } src/com/android/settings/widget/EntityHeaderController.java +5 −38 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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_DND_RULE_PREFERENCE,}) @Retention(RetentionPolicy.SOURCE) public @interface ActionType { int ACTION_NONE = 0; int ACTION_APP_PREFERENCE = 1; int ACTION_NOTIF_PREFERENCE = 2; int ACTION_DND_RULE_PREFERENCE = 3; int ACTION_NOTIF_PREFERENCE = 1; int ACTION_DND_RULE_PREFERENCE = 2; } public static final String PREF_KEY_APP_HEADER = "pref_app_header"; Loading Loading @@ -371,27 +367,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; Loading @@ -399,14 +374,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); Loading Loading
res/xml/app_info_settings.xml +8 −1 Original line number Diff line number Diff line Loading @@ -161,10 +161,17 @@ </PreferenceCategory> <Preference android:key="app_settings_link" android:title="@string/app_settings_link" settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController" settings:allowDividerAbove="true" /> <Preference android:key="app_version" android:selectable="false" android:order="9999" settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController" /> settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController" settings:allowDividerAbove="true" /> </PreferenceScreen> No newline at end of file
src/com/android/settings/applications/appinfo/AppHeaderViewPreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public class AppHeaderViewPreferenceController extends BasePreferenceController mEntityHeaderController = EntityHeaderController .newInstance(activity, mParent, mHeader.findViewById(R.id.entity_header)) .setPackageName(mPackageName) .setButtonActions(EntityHeaderController.ActionType.ACTION_APP_PREFERENCE, .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE) .bindHeaderButtons(); } Loading
src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,9 @@ public class AppInfoDashboardFragment extends DashboardFragment use(AppOpenByDefaultPreferenceController.class).setParentFragment(this); use(AppPermissionPreferenceController.class).setParentFragment(this); use(AppPermissionPreferenceController.class).setPackageName(packageName); use(AppSettingPreferenceController.class) .setPackageName(packageName) .setParentFragment(this); use(AppStoragePreferenceController.class).setParentFragment(this); use(AppVersionPreferenceController.class).setParentFragment(this); use(InstantAppDomainsPreferenceController.class).setParentFragment(this); Loading
src/com/android/settings/applications/appinfo/AppSettingPreferenceController.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.applications.appinfo; import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_OPEN_APP_SETTING; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.support.v7.preference.Preference; import android.text.TextUtils; import com.android.settings.overlay.FeatureFactory; public class AppSettingPreferenceController extends AppInfoPreferenceControllerBase { private String mPackageName; public AppSettingPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); } public AppSettingPreferenceController setPackageName(String packageName) { mPackageName = packageName; return this; } @Override public int getAvailabilityStatus() { if (TextUtils.isEmpty(mPackageName) || mParent == null) { return CONDITIONALLY_UNAVAILABLE; } final Intent intent = resolveIntent( new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName)); return intent != null ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { return false; } final Intent intent = resolveIntent( new Intent(Intent.ACTION_APPLICATION_PREFERENCES).setPackage(mPackageName)); if (intent == null) { return false; } FeatureFactory.getFactory(mContext).getMetricsFeatureProvider() .actionWithSource(mContext, mParent.getMetricsCategory(), ACTION_OPEN_APP_SETTING); mContext.startActivity(intent); return true; } private Intent resolveIntent(Intent i) { ResolveInfo result = mContext.getPackageManager().resolveActivity(i, 0); if (result != null) { return new Intent(i.getAction()) .setClassName(result.activityInfo.packageName, result.activityInfo.name); } return null; } }
src/com/android/settings/widget/EntityHeaderController.java +5 −38 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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_DND_RULE_PREFERENCE,}) @Retention(RetentionPolicy.SOURCE) public @interface ActionType { int ACTION_NONE = 0; int ACTION_APP_PREFERENCE = 1; int ACTION_NOTIF_PREFERENCE = 2; int ACTION_DND_RULE_PREFERENCE = 3; int ACTION_NOTIF_PREFERENCE = 1; int ACTION_DND_RULE_PREFERENCE = 2; } public static final String PREF_KEY_APP_HEADER = "pref_app_header"; Loading Loading @@ -371,27 +367,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; Loading @@ -399,14 +374,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); Loading