Define "Add network" preference in XML.
Move the definition from Java to XML, so that SearchIndexProvider can include it in the getXmlResourcesToIndex(). Also update getNonIndexableKeys() to return the corresponding key when the preference is hidden. If the Internet settings are restricted, "Add network" still appears on search. When clicked, it opens the Internet settings page in restricted mode, so that users can know that the settings are restricted. Bug: 224421762 Fix: 224421762 Test: atest SettingsRoboTests:NetworkProviderSettingsTest Change-Id: Ie9ea58070843a390844b461ce766f0ce29e64fab
This commit is contained in:
@@ -20,10 +20,12 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -40,8 +42,11 @@ public class AddWifiNetworkPreference extends RestrictedPreference {
|
||||
private final Drawable mScanIconDrawable;
|
||||
|
||||
public AddWifiNetworkPreference(Context context) {
|
||||
super(context);
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AddWifiNetworkPreference(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setLayoutResource(com.android.settingslib.R.layout.preference_access_point);
|
||||
setWidgetLayoutResource(R.layout.wifi_button_preference_widget);
|
||||
setIcon(R.drawable.ic_add_24dp);
|
||||
|
Reference in New Issue
Block a user