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

Commit d22619e9 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Migrate UsageStats to Spa

The UsageStats page is for testing only, cannot entry through Settings
Home, but is accessible by enter *#*#4636#*#* in dialer.

Migrate UsageStats to Spa for both improving the UI & performance.

Fix: 244675756
Bug: 235727273
Test: Manual with Settings App
Change-Id: I6ec6e233075a3f79ac1231aecafabf2a71dac716
parent e68cf6df
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -2911,15 +2911,6 @@
            </intent-filter>
        </activity>

        <activity android:name="UsageStatsActivity"
                  android:exported="true"
                  android:label="@string/usage_stats_label">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
            </intent-filter>
        </activity>

        <activity
            android:name="Settings$PowerUsageSummaryActivity"
            android:label="@string/power_usage_summary_title"
@@ -4584,10 +4575,20 @@
            </intent-filter>
        </activity>

        <activity
            android:name="com.android.settings.spa.SpaActivity"
            android:exported="false">
        </activity>
        <activity android:name=".spa.SpaActivity" android:exported="false"/>
        <activity android:name=".spa.SpaBridgeActivity" android:exported="false"/>

        <activity-alias android:name="UsageStatsActivity"
                        android:exported="true"
                        android:label="@string/testing_usage_stats"
                        android:targetActivity=".spa.SpaBridgeActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
            </intent-filter>
            <meta-data android:name="com.android.settings.spa.DESTINATION"
                       android:value="UsageStats"/>
        </activity-alias>

        <!-- This is the longest AndroidManifest.xml ever. -->
    </application>

res/layout/usage_stats.xml

deleted100755 → 0
+0 −45
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:text="@string/display_order_text"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <Spinner
        android:id="@+id/typeSpinner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:entries="@array/usage_stats_display_order_types" />

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" > 
        <TextView
            android:text="@string/app_name_label"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:paddingEnd="6dip"
            android:layout_height="wrap_content" />
        <TextView
            android:text="@string/last_time_used_label"
            android:paddingEnd="6dip"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:text="@string/usage_time_label"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>
    <ListView android:id="@+id/pkg_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:drawSelectorOnTop="false" />
</LinearLayout>

res/layout/usage_stats_item.xml

deleted100755 → 0
+0 −50
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2008, 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.
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:minHeight="?android:attr/listPreferredItemHeight">

    <TextView android:id="@+id/package_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:paddingEnd="6dip"
        android:paddingStart="12dip"
        android:maxLines="1" />

    <TextView android:id="@+id/last_time_used"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:paddingEnd="6dip"
        android:paddingStart="12dip"
        android:maxLines="1" />

    <TextView android:id="@+id/usage_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:paddingEnd="6dip"
        android:paddingStart="12dip"
        android:maxLines="1" />
</LinearLayout>
+0 −7
Original line number Diff line number Diff line
@@ -343,13 +343,6 @@
        <item>Excellent</item>
    </string-array>

    <!-- Display options for UsageStats class -->
    <string-array name="usage_stats_display_order_types">
        <item>Usage time</item>
        <item>Last time used</item>
        <item>App name</item>
    </string-array>

    <!-- Phase 2 options for PEAP -->
    <string-array name="wifi_peap_phase2_entries">
        <item>MSCHAPV2</item>
+6 −7
Original line number Diff line number Diff line
@@ -4821,15 +4821,14 @@
    <!-- Text for checkbox that pops up when an app requests permission to bind a widget [CHAR LIMIT=NONE] -->
    <string name="allow_bind_app_widget_activity_always_allow_bind">Always allow <xliff:g id="widget_host_name">%1$s</xliff:g> to create widgets and access their data</string>
    <!-- XXX remove? Strings used for displaying usage statistics -->
    <string name="usage_stats_label">Usage statistics</string>
    <!-- In the Testing screen. The item title of the activity that shows usage statistics.  -->
    <string name="testing_usage_stats">Usage statistics</string>
    <!-- label for text to indicate sort options -->
    <string name="display_order_text">Sort by:</string>
    <!-- label for application name -->
    <string name="app_name_label">App</string>
    <!-- Spinner label to indicate sort by usage time. [CHAR LIMIT=30] -->
    <string name="usage_stats_sort_by_usage_time">Sort by usage time</string>
    <!-- Spinner label to indicate sort by last time used. [CHAR LIMIT=30] -->
    <string name="usage_stats_sort_by_last_time_used">Sort by last time used</string>
    <!-- Spinner label to indicate sort by app name. [CHAR LIMIT=30] -->
    <string name="usage_stats_sort_by_app_name">Sort by app name</string>
    <!-- label for last time used -->
    <string name="last_time_used_label">Last time used</string>
    <!-- label for usage time -->
Loading