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

Commit 43db6d26 authored by Matthew Ng's avatar Matthew Ng
Browse files

Android Recents implementation for low ram devices

For now the implementation is set behind the ActivityManager flag if the
device has low memory.

This implementation has a linear list of tasks and less functionality
such as removing split screen and reducing the amount of tasks shown to
9. For more information please check out the bug.

Bug: 62251652
Test: manual
Change-Id: I8e0a822a865089df1e8bef55ca61ed30978748d0
parent d57fcca8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2017 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.
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

      <corners android:radius="@dimen/borderless_button_radius" />

      <solid android:color="#CC000000" />

</shape>
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2017 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.
  -->
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingStart="26dp"
    android:paddingEnd="26dp"
    android:paddingTop="17dp"
    android:paddingBottom="17dp"
    android:text="@string/recents_stack_action_button_label"
    android:textSize="14sp"
    android:textColor="#FFFFFF"
    android:textAllCaps="true"
    android:fontFamily="sans-serif-medium"
    android:background="@drawable/recents_low_ram_stack_button_background"
    android:visibility="invisible"
    android:forceHasOverlappingRendering="false"
    style="?attr/clearAllStyle" />
+1 −1
Original line number Diff line number Diff line
@@ -204,8 +204,8 @@ public class Recents extends SystemUI
    public void start() {
        sDebugFlags = new RecentsDebugFlags(mContext);
        sSystemServicesProxy = SystemServicesProxy.getInstance(mContext);
        sTaskLoader = new RecentsTaskLoader(mContext);
        sConfiguration = new RecentsConfiguration(mContext);
        sTaskLoader = new RecentsTaskLoader(mContext);
        mHandler = new Handler();
        mImpl = new RecentsImpl(mContext);

+11 −0
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package com.android.systemui.recents;

import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;

import android.os.SystemProperties;

import com.android.systemui.R;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.TaskStack;
@@ -84,6 +86,13 @@ public class RecentsConfiguration {
    // Recents will layout task views in a grid mode when there's enough space in the screen.
    public boolean isGridEnabled;

    // Support for Android Recents for low ram devices. If this field is set to true, then Recents
    // will use the alternative layout.
    public boolean isLowRamDevice;

    // Enable drag and drop split from Recents. Disabled for low ram devices.
    public boolean dragToSplitEnabled;

    private final Context mAppContext;

    public RecentsConfiguration(Context context) {
@@ -95,6 +104,8 @@ public class RecentsConfiguration {
        fakeShadows = res.getBoolean(R.bool.config_recents_fake_shadows);
        svelteLevel = res.getInteger(R.integer.recents_svelte_level);
        isGridEnabled = SystemProperties.getBoolean("ro.recents.grid", false);
        isLowRamDevice = ActivityManager.isLowRamDeviceStatic();
        dragToSplitEnabled = !isLowRamDevice;

        float screenDensity = context.getResources().getDisplayMetrics().density;
        smallestWidth = ssp.getDeviceSmallestWidth();
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ public class RecentsDebugFlags implements TunerService.Tunable {
        private static final boolean EnableFastToggleTimeout = false;
        // Overrides the Tuner flags and enables the paging via the Recents button
        private static final boolean EnablePaging = false;
        // Disables enter and exit transitions for other tasks for low ram devices
        public static final boolean DisableRecentsLowRamEnterExitAnimation = false;

        // Enables us to create mock recents tasks
        public static final boolean EnableMockTasks = false;
Loading