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

Commit e0b65fce authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove code that check for dashboard feature."

parents 2437d3c6 f2cf2aea
Loading
Loading
Loading
Loading
+0 −76
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:id="@+id/all_details"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:orientation="vertical">

    <!-- App snippet with buttons -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:paddingTop="5dip"
        android:paddingBottom="10dip"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <FrameLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1">
                <!-- Application snippet label, version and icon -->
                <include
                    layout="@layout/app_item"
                    android:id="@+id/app_snippet" />
            </FrameLayout>

            <ImageView
                android:id="@+id/gear"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:layout_gravity="center_vertical"
                android:padding="12dp"
                android:src="@drawable/ic_settings_24dp"
                android:tint="?android:attr/colorAccent"
                android:clickable="true"
                android:background="?android:attr/selectableItemBackground" />

        </LinearLayout>

        <Space
            android:layout_width="match_parent"
            android:layout_height="5dp" />

        <!-- Force stop and uninstall buttons -->
        <include
            layout="@layout/two_buttons_panel"
            android:id="@+id/control_buttons_panel"/>

    </LinearLayout>
</LinearLayout>

res/xml/installed_app_details.xml

deleted100644 → 0
+0 −60
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                  android:title="@string/application_info_label">
    <com.android.settings.applications.LayoutPreference
        android:key="header_view"
        android:layout="@layout/installed_app_details"
        android:selectable="false" />

    <Preference
        android:key="storage_settings"
        android:title="@string/storage_settings"
        android:selectable="true" />

    <Preference
        android:key="data_settings"
        android:title="@string/data_usage_summary_title"
        android:selectable="true" />

    <Preference
        android:key="permission_settings"
        android:title="@string/permissions_label"
        android:selectable="true" />

    <Preference
        android:key="notification_settings"
        android:title="@string/notifications_label"
        android:selectable="true" />

    <Preference
        android:key="preferred_settings"
        android:title="@string/launch_by_default"
        android:selectable="true" />

    <Preference
        android:key="battery"
        android:title="@string/power_usage_summary_title"
        android:selectable="true" />

    <Preference
        android:key="memory"
        android:title="@string/memory_settings_title"
        android:enabled="false"
        android:selectable="true" />

</PreferenceScreen>
+0 −83
Original line number Diff line number Diff line
@@ -16,21 +16,9 @@

package com.android.settings;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.applications.AppInfoBase;
import com.android.settings.applications.InstalledAppDetails;

public class AppHeader {

@@ -38,77 +26,6 @@ public class AppHeader {
    // constant value that can be used to check return code from sub activity.
    private static final int INSTALLED_APP_DETAILS = 1;

    public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
            CharSequence label, String pkgName, int uid) {
        createAppHeader(fragment, icon, label, pkgName, uid, 0, null);
    }

    public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
            CharSequence label, String pkgName, int uid, Intent externalSettings) {
        createAppHeader(fragment, icon, label, pkgName, uid, 0, externalSettings);
    }

    public static void createAppHeader(Activity activity, Drawable icon, CharSequence label,
            String pkgName, int uid, ViewGroup pinnedHeader) {
        final View bar = activity.getLayoutInflater().inflate(R.layout.app_header,
                pinnedHeader, false);
        setupHeaderView(activity, icon, label, pkgName, uid, false, 0, bar, null);
        pinnedHeader.addView(bar);
    }

    public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
            CharSequence label, String pkgName, int uid, int tintColorRes) {
        createAppHeader(fragment, icon, label, pkgName, uid, tintColorRes, null);
    }

    public static void createAppHeader(SettingsPreferenceFragment fragment, Drawable icon,
            CharSequence label, String pkgName, int uid, int tintColorRes,
            Intent externalSettings) {
        View bar = fragment.setPinnedHeaderView(R.layout.app_header);
        setupHeaderView(fragment.getActivity(), icon, label, pkgName, uid, includeAppInfo(fragment),
                tintColorRes, bar, externalSettings);
    }

    public static View setupHeaderView(final Activity activity, Drawable icon, CharSequence label,
            final String pkgName, final int uid, final boolean includeAppInfo, int tintColorRes,
            View bar, final Intent externalSettings) {
        final ImageView appIcon = (ImageView) bar.findViewById(R.id.app_icon);
        appIcon.setImageDrawable(icon);
        if (tintColorRes != 0) {
            appIcon.setImageTintList(ColorStateList.valueOf(activity.getColor(tintColorRes)));
        }

        final TextView appName = (TextView) bar.findViewById(R.id.app_name);
        appName.setText(label);

        if (pkgName != null && !pkgName.equals(Utils.OS_PKG)) {
            bar.setClickable(true);
            bar.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (includeAppInfo) {
                        AppInfoBase.startAppInfoFragment(InstalledAppDetails.class,
                                R.string.application_info_label, pkgName, uid, activity,
                                INSTALLED_APP_DETAILS, MetricsProto.MetricsEvent.VIEW_UNKNOWN);
                    } else {
                        activity.finish();
                    }
                }
            });
            if (externalSettings != null) {
                final View appSettings = bar.findViewById(R.id.app_settings);
                appSettings.setVisibility(View.VISIBLE);
                appSettings.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        activity.startActivity(externalSettings);
                    }
                });
            }
        }
        return bar;
    }

    public static boolean includeAppInfo(final Fragment fragment) {
        Bundle args = fragment.getArguments();
        boolean showInfo = true;
+25 −30
Original line number Diff line number Diff line
@@ -359,7 +359,6 @@ public class SecuritySettings extends SettingsPreferenceFragment

        PreferenceGroup securityStatusPreferenceGroup =
                (PreferenceGroup) root.findPreference(KEY_SECURITY_STATUS);
        if (mDashboardFeatureProvider.isEnabled()) {
        final List<Preference> tilePrefs = mDashboardFeatureProvider.getPreferencesForCategory(
            getActivity(), getPrefContext(), getMetricsCategory(),
            CategoryKey.CATEGORY_SECURITY);
@@ -388,9 +387,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
                mDashboardFeatureProvider.getTilesForCategory(
                    CategoryKey.CATEGORY_SECURITY));
        }
        } else {
            root.removePreference(root.findPreference(KEY_SECURITY_STATUS));
        }

        for (int i = 0; i < SWITCH_PREFERENCE_KEYS.length; i++) {
            final Preference pref = findPreference(SWITCH_PREFERENCE_KEYS[i]);
@@ -1202,8 +1198,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
                    Settings.Secure.PACKAGE_VERIFIER_STATE, 0);
            DashboardFeatureProvider dashboardFeatureProvider =
                    FeatureFactory.getFactory(mContext).getDashboardFeatureProvider(mContext);
            if (dashboardFeatureProvider.isEnabled()
                    && (packageVerifierState == PACKAGE_VERIFIER_STATE_ENABLED)) {
            if (packageVerifierState == PACKAGE_VERIFIER_STATE_ENABLED) {
                // Calling the feature provider could potentially be slow, so do this on a separate
                // thread so as to not block the loading of Settings.
                Executors.newSingleThreadExecutor().execute(new Runnable() {
+0 −4
Original line number Diff line number Diff line
@@ -49,9 +49,7 @@ import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.core.lifecycle.LifecycleObserver;
import com.android.settings.core.lifecycle.events.OnPause;
import com.android.settings.core.lifecycle.events.OnResume;
import com.android.settings.dashboard.DashboardFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.Index;
import com.android.settings.search.SearchIndexableRaw;
import com.android.settings.search2.SearchFeatureProviderImpl;
import com.android.settingslib.RestrictedPreference;
@@ -89,7 +87,6 @@ public class AccountPreferenceController extends PreferenceController
    private SettingsPreferenceFragment mParent;
    private int mAccountProfileOrder = ORDER_ACCOUNT_PROFILES;
    private AccountRestrictionHelper mHelper;
    private DashboardFeatureProvider mDashboardFeatureProvider;
    private MetricsFeatureProvider mMetricsFeatureProvider;

    /**
@@ -138,7 +135,6 @@ public class AccountPreferenceController extends PreferenceController
            mAuthoritiesCount = mAuthorities.length;
        }
        final FeatureFactory featureFactory = FeatureFactory.getFactory(mContext);
        mDashboardFeatureProvider = featureFactory.getDashboardFeatureProvider(mContext);
        mMetricsFeatureProvider = featureFactory.getMetricsFeatureProvider();
        mHelper = helper;
    }
Loading