Merge "Remove extra app info setting under specific condition" into sc-dev am: 6c0a701540 am: 220f6d734a am: ce308a645d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14788858

Change-Id: I8a4f9de00136bc7a2c482f34237eabec5a1b3fca
This commit is contained in:
Trevor Black
2021-06-02 18:59:28 +00:00
committed by Automerger Merge Worker
4 changed files with 76 additions and 1 deletions

View File

@@ -36,7 +36,12 @@ public interface ExtraAppInfoFeatureProvider {
void setPackageName(String packageName);
/**
* gets the summary name
* Checks if enabled
*/
boolean isEnabled(Context context);
/**
* Gets the summary name
*/
String getSummary(Context context);
}

View File

@@ -38,6 +38,11 @@ public class ExtraAppInfoFeatureProviderImpl implements
return;
}
@Override
public boolean isEnabled(Context context) {
return false;
}
@Override
public String getSummary(Context context) {
return "";

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.text.TextUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory;
@@ -55,6 +56,16 @@ public class ExtraAppInfoPreferenceController extends BasePreferenceController {
return mExtraAppInfoFeatureProvider.getSummary(mContext);
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
if (mExtraAppInfoFeatureProvider != null) {
final Preference preference = screen.findPreference(getPreferenceKey());
preference.setEnabled(mExtraAppInfoFeatureProvider.isEnabled(preference.getContext()));
}
}
/**
* Set the local package name
*/