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

Commit 5aa95b73 authored by AdrianDC's avatar AdrianDC Committed by Adrian DC
Browse files

Settings: Apps started on boot shortcut in memory settings



 * Implement an intent extra to retrieve a tab target
 * Use a tab identifer from apps_ops_categories_cm
    to make sure the selection is correct or ignored

Change-Id: I79d963ecbadc624dc45a398387a348691318b6be
Signed-off-by: default avatarAdrianDC <radian.dc@gmail.com>
parent 7554a810
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2012-2015 The CyanogenMod Project
     Copyright (C) 2012-2016 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -885,6 +885,9 @@
    <string name="autoperf_summary">Automatically choose an appropriate battery mode for various apps</string>
    <string name="perf_profile_title">Battery mode</string>

    <!-- Memory -->
    <string name="memory_startup_apps_title">Apps started on boot</string>

    <!-- Sound & notification > Sound section: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
    <string name="notification_ringtone_title_cm">Notification tone</string>

+7 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 The Android Open Source Project
<!--
     Copyright (C) 2015 The Android Open Source Project
     Copyright (C) 2015-2016 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -57,4 +59,8 @@
        android:key="apps_list"
        android:title="@string/memory_usage_apps" />

    <Preference
        android:key="apps_startup"
        android:title="@string/memory_startup_apps_title" />

</PreferenceScreen>
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (C) 2016 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
+12 −1
Original line number Diff line number Diff line
/**
 * Copyright (C) 2013 The Android Open Source Project
 * Copyright (C) 2016 The CyanogenMod 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
@@ -39,6 +40,7 @@ import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.android.internal.logging.MetricsLogger;
@@ -132,10 +134,19 @@ public class AppOpsSummary extends InstrumentedFragment {

        mPageNames = getResources().getTextArray(R.array.app_ops_categories_cm);

        int defaultTab = -1;
        Bundle bundle = getArguments();
        if (bundle != null) {
            defaultTab = Arrays.asList(mPageNames).indexOf(bundle.getString("appops_tab", ""));
        }

        mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
        mAdapter = new MyPagerAdapter(getChildFragmentManager(),
                filterTemplates(AppOpsState.ALL_TEMPLATES));
        mViewPager.setAdapter(mAdapter);
        if (defaultTab >= 0) {
            mViewPager.setCurrentItem(defaultTab);
        }
        mViewPager.setOnPageChangeListener(mAdapter);
        PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);

+18 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 * Copyright (C) 2016 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -15,7 +16,9 @@
 */
package com.android.settings.applications;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
@@ -26,6 +29,7 @@ import android.widget.TextView;

import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.Settings.AppOpsSummaryActivity;
import com.android.settings.Utils;
import com.android.settings.applications.ProcStatsData.MemInfo;

@@ -38,6 +42,9 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
    private static final String KEY_AVERAGY_USED = "average_used";
    private static final String KEY_FREE = "free";
    private static final String KEY_APP_LIST = "apps_list";
    private static final String KEY_APP_STARTUP = "apps_startup";

    private Activity mActivity;

    private LinearColorBar mColors;
    private LayoutPreference mHeader;
@@ -48,11 +55,14 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
    private Preference mAverageUsed;
    private Preference mFree;
    private Preference mAppListPreference;
    private Preference mAppStartupPreference;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        mActivity = getActivity();

        addPreferencesFromResource(R.xml.process_stats_summary);
        mHeader = (LayoutPreference) findPreference(KEY_STATUS_HEADER);
        mMemStatus = (TextView) mHeader.findViewById(R.id.memory_state);
@@ -64,6 +74,8 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
        mFree = findPreference(KEY_FREE);
        mAppListPreference = findPreference(KEY_APP_LIST);
        mAppListPreference.setOnPreferenceClickListener(this);
        mAppStartupPreference = findPreference(KEY_APP_STARTUP);
        mAppStartupPreference.setOnPreferenceClickListener(this);
    }

    @Override
@@ -119,6 +131,12 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
            startFragment(this, ProcessStatsUi.class.getName(), R.string.app_list_memory_use, 0,
                    args);
            return true;
        } else if (preference == mAppStartupPreference) {
            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.putExtra("appops_tab", getString(R.string.app_ops_categories_bootup));
            intent.setClass(mActivity, AppOpsSummaryActivity.class);
            mActivity.startActivity(intent);
            return true;
        }
        return false;
    }