Merge "Use preference for about phone page instead of injection."

This commit is contained in:
Fan Zhang
2018-11-09 18:47:22 +00:00
committed by Android (Google) Code Review
8 changed files with 123 additions and 38 deletions

View File

@@ -79,12 +79,7 @@ public class DeviceModelPreferenceController extends BasePreferenceController {
}
public static String getDeviceModel() {
FutureTask<String> msvSuffixTask = new FutureTask<String>(new Callable<String>() {
@Override
public String call() {
return DeviceInfoUtils.getMsvSuffix();
}
});
FutureTask<String> msvSuffixTask = new FutureTask<>(() -> DeviceInfoUtils.getMsvSuffix());
msvSuffixTask.run();
try {

View File

@@ -181,25 +181,6 @@ public class MyDeviceInfoFragment extends DashboardFragment
controller.updateDeviceName(confirm);
}
private static class SummaryProvider implements SummaryLoader.SummaryProvider {
private final SummaryLoader mSummaryLoader;
public SummaryProvider(SummaryLoader summaryLoader) {
mSummaryLoader = summaryLoader;
}
@Override
public void setListening(boolean listening) {
if (listening) {
mSummaryLoader.setSummary(this, DeviceModelPreferenceController.getDeviceModel());
}
}
}
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
= (activity, summaryLoader) -> new SummaryProvider(summaryLoader);
/**
* For Search.
*/

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2018 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.aboutphone;
import android.content.Context;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
public class TopLevelAboutDevicePreferenceController extends BasePreferenceController {
public TopLevelAboutDevicePreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@Override
public int getAvailabilityStatus() {
return AVAILABLE;
}
@Override
public CharSequence getSummary() {
return DeviceModelPreferenceController.getDeviceModel();
}
}