Support apply override feature in SupportPreferenceController
- Let SupportPreferenceController call SupportFeatureProvider#applyOverrides to override Support preference. Bug: 397691102 Change-Id: I16fefe3058d5f3f318ed4a5aa6aa4868012be505 Test: MANUAL Flag: EXEMPT no-op new APIs for partner override
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
package com.android.settings.overlay;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
/**
|
||||
* Feature provider for support tab.
|
||||
@@ -29,4 +33,13 @@ public interface SupportFeatureProvider {
|
||||
* @param activity Calling activity.
|
||||
*/
|
||||
void startSupport(Activity activity);
|
||||
|
||||
/**
|
||||
* Applies overrides to the support preference, if needed.
|
||||
*
|
||||
* @param context Preference controller context.
|
||||
* @param pref The support preference.
|
||||
*/
|
||||
default void applyOverrides(@NonNull Context context, @NonNull Preference pref) {
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,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;
|
||||
@@ -56,4 +57,13 @@ public class SupportPreferenceController extends BasePreferenceController {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
Preference pref = screen.findPreference(mPreferenceKey);
|
||||
if (pref != null && mSupportFeatureProvider != null) {
|
||||
mSupportFeatureProvider.applyOverrides(mContext, pref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user