Show Settings bugreport handler only when developer option is enabled

Bug: 147264243
Test: Flash device and check that the bugreport handler is not shown by sending intent when developer option is disabled
Change-Id: I11ed82394e164032c2201d19460ea94f3e4441c2
This commit is contained in:
Paul Chang
2020-01-08 22:19:49 +08:00
parent 4b7bdb0dfb
commit fa53c7447a

View File

@@ -37,6 +37,7 @@ import com.android.settings.Utils;
import com.android.settings.applications.defaultapps.DefaultAppPickerFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.applications.DefaultAppInfo;
import com.android.settingslib.development.DevelopmentSettingsEnabler;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.FooterPreference;
@@ -75,6 +76,14 @@ public class BugReportHandlerPicker extends DefaultAppPickerFragment {
return handlerApp + "#" + handlerUser;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (!DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context)) {
getActivity().finish();
}
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.bug_report_handler_settings;