DeviceInfo: move more prefereces in PreferenceController
Bug: 34774945 Test: make RunSettingsRoboTests Change-Id: Ie5e113a6df85bab5be50c947bd7b91cfacdccb7f
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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.deviceinfo;
|
||||
|
||||
import android.app.Fragment;
|
||||
@@ -11,15 +26,25 @@ import com.android.settingslib.DeviceInfoUtils;
|
||||
|
||||
public class FeedbackPreferenceController extends PreferenceController {
|
||||
private static final String KEY_DEVICE_FEEDBACK = "device_feedback";
|
||||
|
||||
private final Fragment mHost;
|
||||
private final Intent intent;
|
||||
|
||||
public FeedbackPreferenceController(Fragment host, Context context) {
|
||||
super(context);
|
||||
this.mHost = host;
|
||||
intent = new Intent("android.intent.action.BUG_REPORT");
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
return !TextUtils.isEmpty(DeviceInfoUtils.getFeedbackReporterPackage(this.mContext));
|
||||
return !TextUtils.isEmpty(DeviceInfoUtils.getFeedbackReporterPackage(mContext));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
intent.setPackage(DeviceInfoUtils.getFeedbackReporterPackage(mContext));
|
||||
preference.setIntent(intent);
|
||||
}
|
||||
|
||||
public String getPreferenceKey() {
|
||||
@@ -33,9 +58,7 @@ public class FeedbackPreferenceController extends PreferenceController {
|
||||
if (!this.isAvailable()) {
|
||||
return false;
|
||||
}
|
||||
String reporterPackage = DeviceInfoUtils.getFeedbackReporterPackage(this.mContext);
|
||||
Intent intent = new Intent("android.intent.action.BUG_REPORT");
|
||||
intent.setPackage(reporterPackage);
|
||||
|
||||
this.mHost.startActivityForResult(intent, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user