Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac9d8769 authored by Fan Zhang's avatar Fan Zhang
Browse files

Use preference for about phone page instead of injection.

It's faster than tile injection. The fragment comes from Settings
itself, we don't have to use to injection.

Bug: 118168552
Test: robotest
Change-Id: If6a79dd73f8a51dbb21338a40f22dc8b8f8c8cb8
parent 08d8ed80
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -922,14 +922,6 @@
                <action android:name="android.intent.action.MAIN" />
                <category android:name="com.android.settings.SHORTCUT" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.settings.action.SETTINGS" />
            </intent-filter>
            <meta-data android:name="com.android.settings.order" android:value="20"/>
            <meta-data android:name="com.android.settings.category"
                       android:value="com.android.settings.category.ia.homepage" />
            <meta-data android:name="com.android.settings.title"
                       android:resource="@string/about_settings" />
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+9 −0
Original line number Diff line number Diff line
@@ -124,6 +124,15 @@
        android:order="10"
        android:fragment="com.android.settings.system.SystemDashboardFragment"/>

    <Preference
        android:key="top_level_about_device"
        android:title="@string/about_settings"
        android:summary="@string/summary_placeholder"
        android:icon="@drawable/ic_homepage_about"
        android:order="20"
        android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
        settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>

    <Preference
        android:key="top_level_support"
        android:summary="@string/support_summary"
+1 −6
Original line number Diff line number Diff line
@@ -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 {
+0 −19
Original line number Diff line number Diff line
@@ -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.
     */
+39 −0
Original line number Diff line number Diff line
/*
 * 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();
    }
}
Loading