Merge "Import BackupFileBuilder"
diff --git a/Android.bp b/Android.bp
index d5fc957..6fc233c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -244,8 +244,9 @@
},
required: [
- // TODO: remove gps_debug when the build system propagates "required" properly.
+ // TODO: remove gps_debug and protolog.conf.json when the build system propagates "required" properly.
"gps_debug.conf",
+ "protolog.conf.json.gz",
],
}
diff --git a/api/current.txt b/api/current.txt
index d688220..140b6e0 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -8,6 +8,7 @@
public static final class Manifest.permission {
ctor public Manifest.permission();
field public static final String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER";
+ field public static final String ACCESSIBILITY_SHORTCUT_TARGET = "android.permission.ACCESSIBILITY_SHORTCUT_TARGET";
field public static final String ACCESS_BACKGROUND_LOCATION = "android.permission.ACCESS_BACKGROUND_LOCATION";
field public static final String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES";
field public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
@@ -45013,6 +45014,7 @@
field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
field public static final int DEFAULT_SUBSCRIPTION_ID = 2147483647; // 0x7fffffff
+ field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
field public static final int INVALID_SIM_SLOT_INDEX = -1; // 0xffffffff
field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
diff --git a/api/system-current.txt b/api/system-current.txt
index d31bfeb..ced3b3c 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1382,6 +1382,7 @@
field public static final String STATS_MANAGER = "stats";
field public static final String STATUS_BAR_SERVICE = "statusbar";
field public static final String SYSTEM_UPDATE_SERVICE = "system_update";
+ field public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
field public static final String VR_SERVICE = "vrmanager";
field @Deprecated public static final String WIFI_RTT_SERVICE = "rttmanager";
field public static final String WIFI_SCANNING_SERVICE = "wifiscanner";
@@ -4722,7 +4723,7 @@
method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
- method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
+ method @Deprecated @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void forget(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(@Nullable java.util.List<android.net.wifi.ScanResult>);
@@ -5681,6 +5682,14 @@
}
+package android.os.telephony {
+
+ public class TelephonyRegistryManager {
+ method public void notifyCarrierNetworkChange(boolean);
+ }
+
+}
+
package android.permission {
public final class PermissionControllerManager {
@@ -8225,6 +8234,7 @@
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
method public static long getMaxNumberVerificationTimeoutMillis();
+ method @NonNull public String getNetworkCountryIso(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
diff --git a/api/test-current.txt b/api/test-current.txt
index 51b569f..61bdc96 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -925,6 +925,10 @@
field public static final int SESSION_OPERATION_MODE_VENDOR_START = 32768; // 0x8000
}
+ public final class CameraManager {
+ method public String[] getCameraIdListNoLazy() throws android.hardware.camera2.CameraAccessException;
+ }
+
}
package android.hardware.display {
@@ -2908,6 +2912,7 @@
method public int checkCarrierPrivilegesForPackage(String);
method public int getCarrierIdListVersion();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
+ method @NonNull public String getNetworkCountryIso(int);
method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
diff --git a/config/preloaded-classes b/config/preloaded-classes
index e117e68..8d91144 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -4838,7 +4838,6 @@
com.android.internal.telephony.PhoneConstants$DataState
com.android.internal.telephony.PhoneConstants$State
com.android.internal.telephony.PhoneFactory
-com.android.internal.telephony.PhoneInternalInterface$DataActivityState
com.android.internal.telephony.PhoneInternalInterface
com.android.internal.telephony.PhoneNotifier
com.android.internal.telephony.PhoneStateIntentReceiver
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index e4fd566..0499337 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -152,6 +152,7 @@
import android.os.image.DynamicSystemManager;
import android.os.image.IDynamicSystemService;
import android.os.storage.StorageManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.permission.PermissionControllerManager;
import android.permission.PermissionManager;
import android.print.IPrintManager;
@@ -606,6 +607,13 @@
return new TelephonyManager(ctx.getOuterContext());
}});
+ registerService(Context.TELEPHONY_REGISTRY_SERVICE, TelephonyRegistryManager.class,
+ new CachedServiceFetcher<TelephonyRegistryManager>() {
+ @Override
+ public TelephonyRegistryManager createService(ContextImpl ctx) {
+ return new TelephonyRegistryManager();
+ }});
+
registerService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, SubscriptionManager.class,
new CachedServiceFetcher<SubscriptionManager>() {
@Override
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index b612f1c..802c1a0a 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -4708,6 +4708,14 @@
public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system";
/**
+ * Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.os.telephony.TelephonyRegistryManager}.
+ * @hide
+ */
+ @SystemApi
+ public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
+
+ /**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.
*
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 24ee213..3e4649f 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -334,11 +334,11 @@
* <p>
* @param userId the user
* @param intent the intent that triggered the grant
- * @param callingAppId The app ID of the calling application
+ * @param callingUid The uid of the calling application
* @param targetAppId The app ID of the target application
*/
public abstract void grantImplicitAccess(
- @UserIdInt int userId, Intent intent, @AppIdInt int callingAppId,
+ @UserIdInt int userId, Intent intent, int callingUid,
@AppIdInt int targetAppId);
public abstract boolean isInstantAppInstallerComponent(ComponentName component);
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index c8276b2..fc90096 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -21,6 +21,7 @@
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.content.Context;
import android.hardware.CameraInfo;
import android.hardware.CameraStatus;
@@ -47,6 +48,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
@@ -109,6 +111,21 @@
}
/**
+ * Similar to getCameraIdList(). However, getCamerIdListNoLazy() necessarily communicates with
+ * cameraserver in order to get the list of camera ids. This is to faciliate testing since some
+ * camera ids may go 'offline' without callbacks from cameraserver because of changes in
+ * SYSTEM_CAMERA permissions (though this is not a changeable permission, tests may call
+ * adopt(drop)ShellPermissionIdentity() and effectively change their permissions). This call
+ * affects the camera ids returned by getCameraIdList() as well. Tests which do adopt shell
+ * permission identity should not mix getCameraIdList() and getCameraListNoLazyCalls().
+ */
+ /** @hide */
+ @TestApi
+ public String[] getCameraIdListNoLazy() throws CameraAccessException {
+ return CameraManagerGlobal.get().getCameraIdListNoLazy();
+ }
+
+ /**
* Register a callback to be notified about camera device availability.
*
* <p>Registering the same callback again will replace the handler with the
@@ -995,35 +1012,27 @@
// Camera service is now down, leave mCameraService as null
}
}
-
- /**
- * Get a list of all camera IDs that are at least PRESENT; ignore devices that are
- * NOT_PRESENT or ENUMERATING, since they cannot be used by anyone.
- */
- public String[] getCameraIdList() {
+ private String[] extractCameraIdListLocked() {
String[] cameraIds = null;
- synchronized(mLock) {
- // Try to make sure we have an up-to-date list of camera devices.
- connectCameraServiceLocked();
-
- int idCount = 0;
- for (int i = 0; i < mDeviceStatus.size(); i++) {
- int status = mDeviceStatus.valueAt(i);
- if (status == ICameraServiceListener.STATUS_NOT_PRESENT ||
- status == ICameraServiceListener.STATUS_ENUMERATING) continue;
- idCount++;
- }
- cameraIds = new String[idCount];
- idCount = 0;
- for (int i = 0; i < mDeviceStatus.size(); i++) {
- int status = mDeviceStatus.valueAt(i);
- if (status == ICameraServiceListener.STATUS_NOT_PRESENT ||
- status == ICameraServiceListener.STATUS_ENUMERATING) continue;
- cameraIds[idCount] = mDeviceStatus.keyAt(i);
- idCount++;
- }
+ int idCount = 0;
+ for (int i = 0; i < mDeviceStatus.size(); i++) {
+ int status = mDeviceStatus.valueAt(i);
+ if (status == ICameraServiceListener.STATUS_NOT_PRESENT
+ || status == ICameraServiceListener.STATUS_ENUMERATING) continue;
+ idCount++;
}
-
+ cameraIds = new String[idCount];
+ idCount = 0;
+ for (int i = 0; i < mDeviceStatus.size(); i++) {
+ int status = mDeviceStatus.valueAt(i);
+ if (status == ICameraServiceListener.STATUS_NOT_PRESENT
+ || status == ICameraServiceListener.STATUS_ENUMERATING) continue;
+ cameraIds[idCount] = mDeviceStatus.keyAt(i);
+ idCount++;
+ }
+ return cameraIds;
+ }
+ private static void sortCameraIds(String[] cameraIds) {
// The sort logic must match the logic in
// libcameraservice/common/CameraProviderManager.cpp::getAPI1CompatibleCameraDeviceIds
Arrays.sort(cameraIds, new Comparator<String>() {
@@ -1054,6 +1063,89 @@
return s1.compareTo(s2);
}
}});
+
+ }
+
+ public static boolean cameraStatusesContains(CameraStatus[] cameraStatuses, String id) {
+ for (CameraStatus c : cameraStatuses) {
+ if (c.cameraId.equals(id)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String[] getCameraIdListNoLazy() {
+ CameraStatus[] cameraStatuses;
+ ICameraServiceListener.Stub testListener = new ICameraServiceListener.Stub() {
+ @Override
+ public void onStatusChanged(int status, String id) throws RemoteException {
+ }
+ @Override
+ public void onTorchStatusChanged(int status, String id) throws RemoteException {
+ }
+ @Override
+ public void onCameraAccessPrioritiesChanged() {
+ }};
+
+ String[] cameraIds = null;
+ synchronized (mLock) {
+ connectCameraServiceLocked();
+ try {
+ // The purpose of the addListener, removeListener pair here is to get a fresh
+ // list of camera ids from cameraserver. We do this since for in test processes,
+ // changes can happen w.r.t non-changeable permissions (eg: SYSTEM_CAMERA
+ // permissions can be effectively changed by calling
+ // adopt(drop)ShellPermissionIdentity()).
+ // Camera devices, which have their discovery affected by these permission
+ // changes, will not have clients get callbacks informing them about these
+ // devices going offline (in real world scenarios, these permissions aren't
+ // changeable). Future calls to getCameraIdList() will reflect the changes in
+ // the camera id list after getCameraIdListNoLazy() is called.
+ cameraStatuses = mCameraService.addListener(testListener);
+ mCameraService.removeListener(testListener);
+ for (CameraStatus c : cameraStatuses) {
+ onStatusChangedLocked(c.status, c.cameraId);
+ }
+ Set<String> deviceCameraIds = mDeviceStatus.keySet();
+ ArrayList<String> deviceIdsToRemove = new ArrayList<String>();
+ for (String deviceCameraId : deviceCameraIds) {
+ // Its possible that a device id was removed without a callback notifying
+ // us. This may happen in case a process 'drops' system camera permissions
+ // (even though the permission isn't a changeable one, tests may call
+ // adoptShellPermissionIdentity() and then dropShellPermissionIdentity().
+ if (!cameraStatusesContains(cameraStatuses, deviceCameraId)) {
+ deviceIdsToRemove.add(deviceCameraId);
+ }
+ }
+ for (String id : deviceIdsToRemove) {
+ onStatusChangedLocked(ICameraServiceListener.STATUS_NOT_PRESENT, id);
+ }
+ } catch (ServiceSpecificException e) {
+ // Unexpected failure
+ throw new IllegalStateException("Failed to register a camera service listener",
+ e);
+ } catch (RemoteException e) {
+ // Camera service is now down, leave mCameraService as null
+ }
+ cameraIds = extractCameraIdListLocked();
+ }
+ sortCameraIds(cameraIds);
+ return cameraIds;
+ }
+
+ /**
+ * Get a list of all camera IDs that are at least PRESENT; ignore devices that are
+ * NOT_PRESENT or ENUMERATING, since they cannot be used by anyone.
+ */
+ public String[] getCameraIdList() {
+ String[] cameraIds = null;
+ synchronized (mLock) {
+ // Try to make sure we have an up-to-date list of camera devices.
+ connectCameraServiceLocked();
+ cameraIds = extractCameraIdListLocked();
+ }
+ sortCameraIds(cameraIds);
return cameraIds;
}
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java
index a809b28..2cf2a65 100644
--- a/core/java/android/net/MacAddress.java
+++ b/core/java/android/net/MacAddress.java
@@ -85,6 +85,9 @@
private static final long OUI_MASK = MacAddress.fromString("ff:ff:ff:0:0:0").mAddr;
private static final long NIC_MASK = MacAddress.fromString("0:0:0:ff:ff:ff").mAddr;
private static final MacAddress BASE_GOOGLE_MAC = MacAddress.fromString("da:a1:19:0:0:0");
+ /** Default wifi MAC address used for a special purpose **/
+ private static final MacAddress DEFAULT_MAC_ADDRESS =
+ MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS);
// Internal representation of the MAC address as a single 8 byte long.
// The encoding scheme sets the two most significant bytes to 0. The 6 bytes of the
@@ -361,16 +364,7 @@
* @hide
*/
public static @NonNull MacAddress createRandomUnicastAddress() {
- SecureRandom r = new SecureRandom();
- long addr = r.nextLong() & VALID_LONG_MASK;
- addr |= LOCALLY_ASSIGNED_MASK;
- addr &= ~MULTICAST_MASK;
- MacAddress mac = new MacAddress(addr);
- // WifiInfo.DEFAULT_MAC_ADDRESS is being used for another purpose, so do not use it here.
- if (mac.toString().equals(WifiInfo.DEFAULT_MAC_ADDRESS)) {
- return createRandomUnicastAddress();
- }
- return mac;
+ return createRandomUnicastAddress(null, new SecureRandom());
}
/**
@@ -380,18 +374,23 @@
* The locally assigned bit is always set to 1. The multicast bit is always set to 0.
*
* @param base a base MacAddress whose OUI is used for generating the random address.
+ * If base == null then the OUI will also be randomized.
* @param r a standard Java Random object used for generating the random address.
* @return a random locally assigned MacAddress.
*
* @hide
*/
public static @NonNull MacAddress createRandomUnicastAddress(MacAddress base, Random r) {
- long addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong());
+ long addr;
+ if (base == null) {
+ addr = r.nextLong() & VALID_LONG_MASK;
+ } else {
+ addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong());
+ }
addr |= LOCALLY_ASSIGNED_MASK;
addr &= ~MULTICAST_MASK;
MacAddress mac = new MacAddress(addr);
- // WifiInfo.DEFAULT_MAC_ADDRESS is being used for another purpose, so do not use it here.
- if (mac.toString().equals(WifiInfo.DEFAULT_MAC_ADDRESS)) {
+ if (mac.equals(DEFAULT_MAC_ADDRESS)) {
return createRandomUnicastAddress(base, r);
}
return mac;
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index b6af829..d4abf28 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -39,6 +39,13 @@
* Gives access to the system properties store. The system properties
* store contains a list of string key-value pairs.
*
+ * <p>Use this class only for the system properties that are local. e.g., within
+ * an app, a partition, or a module. For system properties used across the
+ * boundaries, formally define them in <code>*.sysprop</code> files and use the
+ * auto-generated methods. For more information, see <a href=
+ * "https://source.android.com/devices/architecture/sysprops-apis">Implementing
+ * System Properties as APIs</a>.</p>
+ *
* {@hide}
*/
@SystemApi
diff --git a/core/java/android/os/telephony/TelephonyRegistryManager.java b/core/java/android/os/telephony/TelephonyRegistryManager.java
new file mode 100644
index 0000000..459c414
--- /dev/null
+++ b/core/java/android/os/telephony/TelephonyRegistryManager.java
@@ -0,0 +1,546 @@
+/*
+ * Copyright (C) 2019 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 android.os.telephony;
+
+import android.annotation.SystemApi;
+import android.net.LinkProperties;
+import android.net.NetworkCapabilities;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telephony.CallQuality;
+import android.telephony.CellInfo;
+import android.telephony.DataFailCause;
+import android.telephony.DisconnectCause;
+import android.telephony.PhoneCapability;
+import android.telephony.PreciseCallState.State;
+import android.telephony.ServiceState;
+import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
+import android.telephony.TelephonyManager.CallState;
+import android.telephony.TelephonyManager.DataActivityType;
+import android.telephony.TelephonyManager.DataState;
+import android.telephony.TelephonyManager.NetworkType;
+import android.telephony.TelephonyManager.RadioPowerState;
+import android.telephony.TelephonyManager.SimActivationState;
+import android.telephony.data.ApnSetting;
+import android.telephony.data.ApnSetting.ApnType;
+import android.telephony.ims.ImsReasonInfo;
+import com.android.internal.telephony.ITelephonyRegistry;
+import java.util.List;
+
+/**
+ * A centralized place to notify telephony related status changes, e.g, {@link ServiceState} update
+ * or {@link PhoneCapability} changed. This might trigger callback from applications side through
+ * {@link android.telephony.PhoneStateListener}
+ *
+ * TODO: limit API access to only carrier apps with certain permissions or apps running on
+ * privileged UID.
+ *
+ * @hide
+ */
+@SystemApi
+public class TelephonyRegistryManager {
+
+ private static final String TAG = "TelephonyRegistryManager";
+ private static ITelephonyRegistry sRegistry;
+
+ /** @hide **/
+ public TelephonyRegistryManager() {
+ if (sRegistry == null) {
+ sRegistry = ITelephonyRegistry.Stub.asInterface(
+ ServiceManager.getService("telephony.registry"));
+ }
+ }
+
+ /**
+ * Informs the system of an intentional upcoming carrier network change by a carrier app.
+ * This call only used to allow the system to provide alternative UI while telephony is
+ * performing an action that may result in intentional, temporary network lack of connectivity.
+ * <p>
+ * Based on the active parameter passed in, this method will either show or hide the alternative
+ * UI. There is no timeout associated with showing this UX, so a carrier app must be sure to
+ * call with active set to false sometime after calling with it set to {@code true}.
+ * <p>
+ * Requires Permission: calling app has carrier privileges.
+ *
+ * @param active Whether the carrier network change is or shortly will be
+ * active. Set this value to true to begin showing alternative UI and false to stop.
+ * @see TelephonyManager#hasCarrierPrivileges
+ */
+ public void notifyCarrierNetworkChange(boolean active) {
+ try {
+ sRegistry.notifyCarrierNetworkChange(active);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify call state changed on certain subscription.
+ *
+ * @param subId for which call state changed.
+ * @param slotIndex for which call state changed. Can be derived from subId except when subId is
+ * invalid.
+ * @param state latest call state. e.g, offhook, ringing
+ * @param incomingNumer incoming phone number.
+ *
+ * @hide
+ */
+ public void notifyCallStateChanged(int subId, int slotIndex, @CallState int state,
+ String incomingNumer) {
+ try {
+ sRegistry.notifyCallState(slotIndex, subId, state, incomingNumer);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link ServiceState} update on certain subscription.
+ *
+ * @param subId for which the service state changed.
+ * @param slotIndex for which the service state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param state service state e.g, in service, out of service or roaming status.
+ *
+ * @hide
+ */
+ public void notifyServiceStateChanged(int subId, int slotIndex, ServiceState state) {
+ try {
+ sRegistry.notifyServiceStateForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link SignalStrength} update on certain subscription.
+ *
+ * @param subId for which the signalstrength changed.
+ * @param slotIndex for which the signalstrength changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param signalStrength e.g, signalstrength level {@see SignalStrength#getLevel()}
+ *
+ * @hide
+ */
+ public void notifySignalStrengthChanged(int subId, int slotIndex,
+ SignalStrength signalStrength) {
+ try {
+ sRegistry.notifySignalStrengthForPhoneId(slotIndex, subId, signalStrength);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify changes to the message-waiting indicator on certain subscription. e.g, The status bar
+ * uses message waiting indicator to determine when to display the voicemail icon.
+ *
+ * @param subId for which message waiting indicator changed.
+ * @param slotIndex for which message waiting indicator changed. Can be derived from subId
+ * except when subId is invalid.
+ * @param msgWaitingInd {@code true} indicates there is message-waiting indicator, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyMessageWaitingChanged(int subId, int slotIndex, boolean msgWaitingInd) {
+ try {
+ sRegistry.notifyMessageWaitingChangedForPhoneId(slotIndex, subId, msgWaitingInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to the call-forwarding status on certain subscription.
+ *
+ * @param subId for which call forwarding status changed.
+ * @param callForwardInd {@code true} indicates there is call forwarding, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyCallForwardingChanged(int subId, boolean callForwardInd) {
+ try {
+ sRegistry.notifyCallForwardingChangedForSubscriber(subId, callForwardInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to activity state changes on certain subscription.
+ *
+ * @param subId for which data activity state changed.
+ * @param dataActivityType indicates the latest data activity type e.g, {@link
+ * TelephonyManager#DATA_ACTIVITY_IN}
+ *
+ * @hide
+ */
+ public void notifyDataActivityChanged(int subId, @DataActivityType int dataActivityType) {
+ try {
+ sRegistry.notifyDataActivityForSubscriber(subId, dataActivityType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to default (Internet) data connection state on certain subscription.
+ *
+ * @param subId for which data connection state changed.
+ * @param slotIndex for which data connections state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state latest data connection state, e.g,
+ * @param isDataConnectivityPossible indicates if data is allowed
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param linkProperties {@link LinkProperties} associated with this data connection.
+ * @param networkCapabilities {@link NetworkCapabilities} associated with this data connection.
+ * @param networkType associated with this data connection.
+ * @param roaming {@code true} indicates in roaming, {@false} otherwise.
+ * @see TelephonyManager#DATA_DISCONNECTED
+ * @see TelephonyManager#isDataConnectivityPossible()
+ *
+ * @hide
+ */
+ public void notifyDataConnectionForSubscriber(int slotIndex, int subId, @DataState int state,
+ boolean isDataConnectivityPossible,
+ @ApnType String apn, String apnType, LinkProperties linkProperties,
+ NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
+ try {
+ sRegistry.notifyDataConnectionForSubscriber(slotIndex, subId, state,
+ isDataConnectivityPossible,
+ apn, apnType, linkProperties, networkCapabilities, networkType, roaming);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CallQuality} change on certain subscription.
+ *
+ * @param subId for which call quality state changed.
+ * @param slotIndex for which call quality state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param callQuality Information about call quality e.g, call quality level
+ * @param networkType associated with this data connection. e.g, LTE
+ *
+ * @hide
+ */
+ public void notifyCallQualityChanged(int subId, int slotIndex, CallQuality callQuality,
+ @NetworkType int networkType) {
+ try {
+ sRegistry.notifyCallQualityChanged(callQuality, slotIndex, subId, networkType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify emergency number list changed on certain subscription.
+ *
+ * @param subId for which emergency number list changed.
+ * @param slotIndex for which emergency number list changed. Can be derived from subId except
+ * when subId is invalid.
+ *
+ * @hide
+ */
+ public void notifyEmergencyNumberList(int subId, int slotIndex) {
+ try {
+ sRegistry.notifyEmergencyNumberList(slotIndex, subId);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify radio power state changed on certain subscription.
+ *
+ * @param subId for which radio power state changed.
+ * @param slotIndex for which radio power state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param radioPowerState the current modem radio state.
+ *
+ * @hide
+ */
+ public void notifyRadioPowerStateChanged(int subId, int slotIndex,
+ @RadioPowerState int radioPowerState) {
+ try {
+ sRegistry.notifyRadioPowerStateChanged(slotIndex, subId, radioPowerState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link PhoneCapability} changed.
+ *
+ * @param phoneCapability the capability of the modem group.
+ *
+ * @hide
+ */
+ public void notifyPhoneCapabilityChanged(PhoneCapability phoneCapability) {
+ try {
+ sRegistry.notifyPhoneCapabilityChanged(phoneCapability);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data activation state changed on certain subscription.
+ * @see TelephonyManager#getDataActivationState()
+ *
+ * @param subId for which data activation state changed.
+ * @param slotIndex for which data activation state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyDataActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_DATA, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify voice activation state changed on certain subscription.
+ * @see TelephonyManager#getVoiceActivationState()
+ *
+ * @param subId for which voice activation state changed.
+ * @param slotIndex for which voice activation state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyVoiceActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_VOICE, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify User mobile data state changed on certain subscription. e.g, mobile data is enabled
+ * or disabled.
+ *
+ * @param subId for which mobile data state has changed.
+ * @param slotIndex for which mobile data state has changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state {@code true} indicates mobile data is enabled/on. {@code false} otherwise.
+ *
+ * @hide
+ */
+ public void notifyUserMobileDataStateChanged(int slotIndex, int subId, boolean state) {
+ try {
+ sRegistry.notifyUserMobileDataStateChangedForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO: this is marked as deprecated, can we move this one safely?
+ *
+ * @param subId
+ * @param slotIndex
+ * @param rawData
+ *
+ * @hide
+ */
+ public void notifyOemHookRawEventForSubscriber(int subId, int slotIndex, byte[] rawData) {
+ try {
+ sRegistry.notifyOemHookRawEventForSubscriber(slotIndex, subId, rawData);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
+ *
+ * @param subId for which ims call disconnect.
+ * @param imsReasonInfo the reason for ims call disconnect.
+ *
+ * @hide
+ */
+ public void notifyImsDisconnectCause(int subId, ImsReasonInfo imsReasonInfo) {
+ try {
+ sRegistry.notifyImsDisconnectCause(subId, imsReasonInfo);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise data connection failed cause on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction failed. Can be derived from subId except when
+ * subId is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param failCause data fail cause.
+ *
+ * @hide
+ */
+ public void notifyPreciseDataConnectionFailed(int subId, int slotIndex, String apnType,
+ String apn, @DataFailCause.FailCause int failCause) {
+ try {
+ sRegistry.notifyPreciseDataConnectionFailed(slotIndex, subId, apnType, apn, failCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify single Radio Voice Call Continuity (SRVCC) state change for the currently active call
+ * on certain subscription.
+ *
+ * @param subId for which srvcc state changed.
+ * @param state srvcc state
+ *
+ * @hide
+ */
+ public void notifySrvccStateChanged(int subId, @TelephonyManager.SrvccState int state) {
+ try {
+ sRegistry.notifySrvccStateChanged(subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify over the air sim provisioning(OTASP) mode changed on certain subscription.
+ *
+ * @param subId for which otasp mode changed.
+ * @param otaspMode latest mode for OTASP e.g, OTASP needed.
+ *
+ * @hide
+ */
+ public void notifyOtaspChanged(int subId, int otaspMode) {
+ try {
+ sRegistry.notifyOtaspChanged(subId, otaspMode);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise call state changed on certain subscription, including foreground, background
+ * and ringcall states.
+ *
+ * @param subId for which precise call state changed.
+ * @param slotIndex for which precise call state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param ringCallPreciseState ringCall state.
+ * @param foregroundCallPreciseState foreground call state.
+ * @param backgroundCallPreciseState background call state.
+ *
+ * @hide
+ */
+ public void notifyPreciseCallState(int subId, int slotIndex, @State int ringCallPreciseState,
+ @State int foregroundCallPreciseState, @State int backgroundCallPreciseState) {
+ try {
+ sRegistry.notifyPreciseCallState(slotIndex, subId, ringCallPreciseState,
+ foregroundCallPreciseState, backgroundCallPreciseState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify call disconnect causes which contains {@link DisconnectCause} and {@link
+ * android.telephony.PreciseDisconnectCause}.
+ *
+ * @param subId for which call disconnected.
+ * @param slotIndex for which call disconnected. Can be derived from subId except when subId is
+ * invalid.
+ * @param cause {@link DisconnectCause} for the disconnected call.
+ * @param preciseCause {@link android.telephony.PreciseDisconnectCause} for the disconnected
+ * call.
+ *
+ * @hide
+ */
+ public void notifyDisconnectCause(int slotIndex, int subId, int cause, int preciseCause) {
+ try {
+ sRegistry.notifyDisconnectCause(slotIndex, subId, cause, preciseCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data connection failed on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction faled. Can be derived from subId except when subId
+ * is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN. Note each data
+ * connection can support multiple anyTypes.
+ *
+ * @hide
+ */
+ public void notifyDataConnectionFailed(int subId, int slotIndex, String apnType) {
+ try {
+ sRegistry.notifyDataConnectionFailedForSubscriber(slotIndex, subId, apnType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO change from bundle to CellLocation?
+ * @hide
+ */
+ public void notifyCellLocation(int subId, Bundle cellLocation) {
+ try {
+ sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CellInfo} changed on certain subscription. e.g, when an observed cell info has
+ * changed or new cells have been added or removed on the given subscription.
+ *
+ * @param subId for which cellinfo changed.
+ * @param cellInfo A list of cellInfo associated with the given subscription.
+ *
+ * @hide
+ */
+ public void notifyCellInfoChanged(int subId, List<CellInfo> cellInfo) {
+ try {
+ sRegistry.notifyCellInfoForSubscriber(subId, cellInfo);
+ } catch (RemoteException ex) {
+
+ }
+ }
+
+}
diff --git a/core/java/android/service/carrier/CarrierService.java b/core/java/android/service/carrier/CarrierService.java
index aeb186b..9184d6d 100644
--- a/core/java/android/service/carrier/CarrierService.java
+++ b/core/java/android/service/carrier/CarrierService.java
@@ -16,17 +16,15 @@
import android.annotation.CallSuper;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PersistableBundle;
-import android.os.RemoteException;
import android.os.ResultReceiver;
-import android.os.ServiceManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.util.Log;
-import com.android.internal.telephony.ITelephonyRegistry;
-
/**
* A service that exposes carrier-specific functionality to the system.
* <p>
@@ -55,16 +53,10 @@
public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";
- private static ITelephonyRegistry sRegistry;
-
private final ICarrierService.Stub mStubWrapper;
public CarrierService() {
mStubWrapper = new ICarrierServiceWrapper();
- if (sRegistry == null) {
- sRegistry = ITelephonyRegistry.Stub.asInterface(
- ServiceManager.getService("telephony.registry"));
- }
}
/**
@@ -122,9 +114,12 @@
* @see android.telephony.TelephonyManager#hasCarrierPrivileges
*/
public final void notifyCarrierNetworkChange(boolean active) {
- try {
- if (sRegistry != null) sRegistry.notifyCarrierNetworkChange(active);
- } catch (RemoteException | NullPointerException ex) {}
+ TelephonyRegistryManager telephonyRegistryMgr =
+ (TelephonyRegistryManager) this.getSystemService(
+ Context.TELEPHONY_REGISTRY_SERVICE);
+ if (telephonyRegistryMgr != null) {
+ telephonyRegistryMgr.notifyCarrierNetworkChange(active);
+ }
}
/**
diff --git a/core/java/android/view/accessibility/AccessibilityNodeProvider.java b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
index 4b25378..f4c7b96 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeProvider.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeProvider.java
@@ -44,28 +44,126 @@
* View itself. Similarly the returned instance is responsible for performing accessibility
* actions on any virtual view or the root view itself. For example:
* </p>
- * <pre>
- * getAccessibilityNodeProvider(
- * if (mAccessibilityNodeProvider == null) {
- * mAccessibilityNodeProvider = new AccessibilityNodeProvider() {
- * public boolean performAction(int action, int virtualDescendantId) {
- * // Implementation.
+ * <div>
+ * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
+ * <pre class="prettyprint lang-kotlin">
+ * // "view" is the View instance on which this class performs accessibility functions.
+ * class MyCalendarViewAccessibilityDelegate(
+ * private var view: MyCalendarView) : AccessibilityDelegate() {
+ * override fun getAccessibilityNodeProvider(host: View): AccessibilityNodeProvider {
+ * return object : AccessibilityNodeProvider() {
+ * override fun createAccessibilityNodeInfo(virtualViewId: Int):
+ * AccessibilityNodeInfo? {
+ * when (virtualViewId) {
+ * <var>host-view-id</var> -> {
+ * val node = AccessibilityNodeInfo.obtain(view)
+ * node.addChild(view, <var>child-view-id</var>)
+ * // Set other attributes like screenReaderFocusable
+ * // and contentDescription.
+ * return node
+ * }
+ * <var>child-view-id</var> -> {
+ * val node = AccessibilityNodeInfo
+ * .obtain(view, virtualViewId)
+ * node.setParent(view)
+ * node.addAction(ACTION_SCROLL_UP)
+ * node.addAction(ACTION_SCROLL_DOWN)
+ * // Set other attributes like focusable and visibleToUser.
+ * node.setBoundsInScreen(
+ * Rect(<var>coords-of-edges-relative-to-screen</var>))
+ * return node
+ * }
+ * else -> return null
+ * }
+ * }
+ *
+ * override fun performAction(
+ * virtualViewId: Int,
+ * action: Int,
+ * arguments: Bundle
+ * ): Boolean {
+ * if (virtualViewId == <var>host-view-id</var>) {
+ * return view.performAccessibilityAction(action, arguments)
+ * }
+ * when (action) {
+ * ACTION_SCROLL_UP.id -> {
+ * // Implement logic in a separate method.
+ * navigateToPreviousMonth()
+ *
+ * return true
+ * }
+ * ACTION_SCROLL_DOWN.id ->
+ * // Implement logic in a separate method.
+ * navigateToNextMonth()
+ *
+ * return true
+ * else -> return false
+ * }
+ * }
+ * }
+ * }
+ * }
+ * </pre>
+ * </section><section><h3 id="java">Java</h3>
+ * <pre class="prettyprint lang-java">
+ * final class MyCalendarViewAccessibilityDelegate extends AccessibilityDelegate {
+ * // The View instance on which this class performs accessibility functions.
+ * private final MyCalendarView view;
+ *
+ * MyCalendarViewAccessibilityDelegate(MyCalendarView view) {
+ * this.view = view;
+ * }
+ *
+ * @Override
+ * public AccessibilityNodeProvider getAccessibilityNodeProvider(View host) {
+ * return new AccessibilityNodeProvider() {
+ * @Override
+ * @Nullable
+ * public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
+ * if (virtualViewId == <var>host-view-id</var>) {
+ * AccessibilityNodeInfo node = AccessibilityNodeInfo.obtain(view);
+ * node.addChild(view, <var>child-view-id</var>);
+ * // Set other attributes like screenReaderFocusable and contentDescription.
+ * return node;
+ * } else if (virtualViewId == <var>child-view-id</var>) {
+ * AccessibilityNodeInfo node =
+ * AccessibilityNodeInfo.obtain(view, virtualViewId);
+ * node.setParent(view);
+ * node.addAction(ACTION_SCROLL_UP);
+ * node.addAction(ACTION_SCROLL_DOWN);
+ * // Set other attributes like focusable and visibleToUser.
+ * node.setBoundsInScreen(
+ * new Rect(<var>coordinates-of-edges-relative-to-screen</var>));
+ * return node;
+ * } else {
+ * return null;
+ * }
+ * }
+ *
+ * @Override
+ * public boolean performAction(int virtualViewId, int action, Bundle arguments) {
+ * if (virtualViewId == <var>host-view-id</var>) {
+ * return view.performAccessibilityAction(action, arguments);
+ * }
+ *
+ * if (action == ACTION_SCROLL_UP.getId()) {
+ * // Implement logic in a separate method.
+ * navigateToPreviousMonth();
+ *
+ * return true;
+ * } else if (action == ACTION_SCROLL_DOWN.getId()) {
+ * // Implement logic in a separate method.
+ * navigateToNextMonth();
+ *
+ * return true;
+ * } else {
* return false;
* }
- *
- * public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String text,
- * int virtualDescendantId) {
- * // Implementation.
- * return null;
- * }
- *
- * public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualDescendantId) {
- * // Implementation.
- * return null;
- * }
- * });
- * return mAccessibilityNodeProvider;
- * </pre>
+ * }
+ * };
+ * }
+ * }
+ * </pre></section></div></div>
*/
public abstract class AccessibilityNodeProvider {
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index c12940a..49b9eba 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -1163,9 +1163,9 @@
setenv("ANDROID_ROOT", rootDir, 1);
}
- const char* runtimeRootDir = getenv("ANDROID_RUNTIME_ROOT");
- if (runtimeRootDir == NULL) {
- LOG_FATAL("No runtime directory specified with ANDROID_RUNTIME_ROOT environment variable.");
+ const char* artRootDir = getenv("ANDROID_ART_ROOT");
+ if (artRootDir == NULL) {
+ LOG_FATAL("No ART directory specified with ANDROID_ART_ROOT environment variable.");
return;
}
diff --git a/core/proto/Android.bp b/core/proto/Android.bp
index e199dab..6119d71 100644
--- a/core/proto/Android.bp
+++ b/core/proto/Android.bp
@@ -30,9 +30,9 @@
}
java_library_host {
- name: "windowmanager-log-proto",
+ name: "protolog-proto",
srcs: [
- "android/server/windowmanagerlog.proto"
+ "android/server/protolog.proto"
],
proto: {
type: "full",
diff --git a/core/proto/android/server/protolog.proto b/core/proto/android/server/protolog.proto
new file mode 100644
index 0000000..7c98d31
--- /dev/null
+++ b/core/proto/android/server/protolog.proto
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+syntax = "proto2";
+
+package com.android.server.protolog;
+
+option java_multiple_files = true;
+
+/* represents a single log entry */
+message ProtoLogMessage {
+ /* log statement identifier, created from message string and log level. */
+ optional fixed32 message_hash = 1;
+ /* log time, relative to the elapsed system time clock. */
+ optional fixed64 elapsed_realtime_nanos = 2;
+ /* string parameters passed to the log call. */
+ repeated string str_params = 3;
+ /* integer parameters passed to the log call. */
+ repeated sint64 sint64_params = 4 [packed=true];
+ /* floating point parameters passed to the log call. */
+ repeated double double_params = 5 [packed=true];
+ /* boolean parameters passed to the log call. */
+ repeated bool boolean_params = 6 [packed=true];
+}
+
+/* represents a log file containing ProtoLog log entries.
+ Encoded, it should start with 0x9 0x50 0x52 0x4f 0x54 0x4f 0x4c 0x4f 0x47 (.PROTOLOG), such
+ that they can be easily identified. */
+message ProtoLogFileProto {
+ /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
+ (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
+ constants into .proto files. */
+ enum MagicNumber {
+ INVALID = 0;
+ MAGIC_NUMBER_L = 0x544f5250; /* PROT (little-endian ASCII) */
+ MAGIC_NUMBER_H = 0x474f4c4f; /* OLOG (little-endian ASCII) */
+ }
+
+ /* the magic number header */
+ optional fixed64 magic_number = 1;
+ /* log proto version. */
+ optional string version = 2;
+ /* offset between real-time clock and elapsed system time clock in miliseconds.
+ Calculated as: (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000) */
+ optional fixed64 realTimeToElapsedTimeOffsetMillis = 3;
+ /* log entries */
+ repeated ProtoLogMessage log = 4;
+}
diff --git a/core/proto/android/server/windowmanagerlog.proto b/core/proto/android/server/windowmanagerlog.proto
deleted file mode 100644
index 5bee1bd..0000000
--- a/core/proto/android/server/windowmanagerlog.proto
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-
-syntax = "proto2";
-
-package com.android.server.wm;
-
-option java_multiple_files = true;
-
-/* represents a single log entry */
-message ProtoLogMessage {
- /* log statement identifier, created from message string and log level. */
- optional fixed32 message_hash = 1;
- /* log time, relative to the elapsed system time clock. */
- optional fixed64 elapsed_realtime_nanos = 2;
- /* string parameters passed to the log call. */
- repeated string str_params = 3;
- /* integer parameters passed to the log call. */
- repeated sint64 sint64_params = 4 [packed=true];
- /* floating point parameters passed to the log call. */
- repeated double double_params = 5 [packed=true];
- /* boolean parameters passed to the log call. */
- repeated bool boolean_params = 6 [packed=true];
-}
-
-/* represents a log file containing window manager log entries.
- Encoded, it should start with 0x9 0x57 0x49 0x4e 0x44 0x4f 0x4c 0x4f 0x47 (.WINDOLOG), such
- that they can be easily identified. */
-message WindowManagerLogFileProto {
- /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
- (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
- constants into .proto files. */
- enum MagicNumber {
- INVALID = 0;
- MAGIC_NUMBER_L = 0x444e4957; /* WIND (little-endian ASCII) */
- MAGIC_NUMBER_H = 0x474f4c4f; /* OLOG (little-endian ASCII) */
- }
-
- /* the magic number header */
- optional fixed64 magic_number = 1;
- /* log proto version. */
- optional string version = 2;
- /* offset between real-time clock and elapsed system time clock in miliseconds.
- Calculated as: (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000) */
- optional fixed64 realTimeToElapsedTimeOffsetMillis = 3;
- /* log entries */
- repeated ProtoLogMessage log = 4;
-}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1d590ea..7a0d0cb 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2552,6 +2552,19 @@
android:label="@string/permlab_readSyncStats"
android:protectionLevel="normal" />
+ <!-- ==================================================== -->
+ <!-- Permissions related to accessibility -->
+ <!-- ==================================================== -->
+ <eat-comment />
+
+ <!-- Allows applications to define the accessibility shortcut target.
+ <p>Protection level: normal
+ -->
+ <permission android:name="android.permission.ACCESSIBILITY_SHORTCUT_TARGET"
+ android:description="@string/permdesc_accessibilityShortcutTarget"
+ android:label="@string/permlab_accessibilityShortcutTarget"
+ android:protectionLevel="normal" />
+
<!-- ============================================ -->
<!-- Permissions for low-level system interaction -->
<!-- ============================================ -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index d2989d9..56e1fed 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1745,6 +1745,11 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_startViewPermissionUsage">Allows the holder to start the permission usage for an app. Should never be needed for normal apps.</string>
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=NONE] -->
+ <string name="permlab_accessibilityShortcutTarget">accessibility shortcut target</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=NONE] -->
+ <string name="permdesc_accessibilityShortcutTarget">Allows an app to define the accessibility shortcut target.</string>
+
<!-- Policy administration -->
<!-- Title of policy access to limiting the user's password choices -->
diff --git a/data/etc/Android.bp b/data/etc/Android.bp
index 4493f3a..7e167c9 100644
--- a/data/etc/Android.bp
+++ b/data/etc/Android.bp
@@ -133,3 +133,8 @@
sub_dir: "permissions",
src: "com.android.timezone.updater.xml",
}
+
+filegroup {
+ name: "services.core.protolog.json",
+ srcs: ["services.core.protolog.json"],
+}
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json
new file mode 100644
index 0000000..261891f
--- /dev/null
+++ b/data/etc/services.core.protolog.json
@@ -0,0 +1,15 @@
+{
+ "version": "1.0.0",
+ "messages": {
+ "485522692": {
+ "message": "Test completed successfully: %b %d %o %x %e %g %f %% %s.",
+ "level": "ERROR",
+ "group": "TEST_GROUP"
+ }
+ },
+ "groups": {
+ "TEST_GROUP": {
+ "tag": "WindowManagetProtoLogTest"
+ }
+ }
+}
diff --git a/packages/BackupEncryption/src/com/android/server/backup/encryption/tasks/KvBackupEncrypter.java b/packages/BackupEncryption/src/com/android/server/backup/encryption/tasks/KvBackupEncrypter.java
new file mode 100644
index 0000000..d20cd4c
--- /dev/null
+++ b/packages/BackupEncryption/src/com/android/server/backup/encryption/tasks/KvBackupEncrypter.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2019 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.server.backup.encryption.tasks;
+
+import static com.android.internal.util.Preconditions.checkState;
+
+import android.annotation.Nullable;
+import android.app.backup.BackupDataInput;
+
+import com.android.server.backup.encryption.chunk.ChunkHash;
+import com.android.server.backup.encryption.chunking.ChunkEncryptor;
+import com.android.server.backup.encryption.chunking.ChunkHasher;
+import com.android.server.backup.encryption.chunking.EncryptedChunk;
+import com.android.server.backup.encryption.kv.KeyValueListingBuilder;
+import com.android.server.backup.encryption.protos.nano.KeyValueListingProto;
+import com.android.server.backup.encryption.protos.nano.KeyValuePairProto;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.SecretKey;
+
+/**
+ * Reads key value backup data from an input, converts each pair into a chunk and encrypts the
+ * chunks.
+ *
+ * <p>The caller should pass in the key value listing from the previous backup, if there is one.
+ * This class emits chunks for both existing and new pairs, using the provided listing to
+ * determine the hashes of pairs that already exist. During the backup it computes the new listing,
+ * which the caller should store on disk and pass in at the start of the next backup.
+ *
+ * <p>Also computes the message digest, which is {@code SHA-256(chunk hashes sorted
+ * lexicographically)}.
+ */
+public class KvBackupEncrypter implements BackupEncrypter {
+ private final BackupDataInput mBackupDataInput;
+
+ private KeyValueListingProto.KeyValueListing mOldKeyValueListing;
+ @Nullable private KeyValueListingBuilder mNewKeyValueListing;
+
+ /**
+ * Constructs a new instance which reads data from the given input.
+ *
+ * <p>By default this performs non-incremental backup, call {@link #setOldKeyValueListing} to
+ * perform incremental backup.
+ */
+ public KvBackupEncrypter(BackupDataInput backupDataInput) {
+ mBackupDataInput = backupDataInput;
+ mOldKeyValueListing = KeyValueListingBuilder.emptyListing();
+ }
+
+ /** Sets the old listing to perform incremental backup against. */
+ public void setOldKeyValueListing(KeyValueListingProto.KeyValueListing oldKeyValueListing) {
+ mOldKeyValueListing = oldKeyValueListing;
+ }
+
+ @Override
+ public Result backup(
+ SecretKey secretKey,
+ @Nullable byte[] unusedFingerprintMixerSalt,
+ Set<ChunkHash> unusedExistingChunks)
+ throws IOException, GeneralSecurityException {
+ ChunkHasher chunkHasher = new ChunkHasher(secretKey);
+ ChunkEncryptor chunkEncryptor = new ChunkEncryptor(secretKey, new SecureRandom());
+ mNewKeyValueListing = new KeyValueListingBuilder();
+ List<ChunkHash> allChunks = new ArrayList<>();
+ List<EncryptedChunk> newChunks = new ArrayList<>();
+
+ Map<String, ChunkHash> existingChunksToReuse = buildPairMap(mOldKeyValueListing);
+
+ while (mBackupDataInput.readNextHeader()) {
+ String key = mBackupDataInput.getKey();
+ Optional<byte[]> value = readEntireValue(mBackupDataInput);
+
+ // As this pair exists in the new backup, we don't need to add it from the previous
+ // backup.
+ existingChunksToReuse.remove(key);
+
+ // If the value is not present then this key has been deleted.
+ if (value.isPresent()) {
+ EncryptedChunk newChunk =
+ createEncryptedChunk(chunkHasher, chunkEncryptor, key, value.get());
+ allChunks.add(newChunk.key());
+ newChunks.add(newChunk);
+ mNewKeyValueListing.addPair(key, newChunk.key());
+ }
+ }
+
+ allChunks.addAll(existingChunksToReuse.values());
+
+ mNewKeyValueListing.addAll(existingChunksToReuse);
+
+ return new Result(allChunks, newChunks, createMessageDigest(allChunks));
+ }
+
+ /**
+ * Returns a listing containing the pairs in the new backup.
+ *
+ * <p>You must call {@link #backup} first.
+ */
+ public KeyValueListingProto.KeyValueListing getNewKeyValueListing() {
+ checkState(mNewKeyValueListing != null, "Must call backup() first");
+ return mNewKeyValueListing.build();
+ }
+
+ private static Map<String, ChunkHash> buildPairMap(
+ KeyValueListingProto.KeyValueListing listing) {
+ Map<String, ChunkHash> map = new HashMap<>();
+ for (KeyValueListingProto.KeyValueEntry entry : listing.entries) {
+ map.put(entry.key, new ChunkHash(entry.hash));
+ }
+ return map;
+ }
+
+ private EncryptedChunk createEncryptedChunk(
+ ChunkHasher chunkHasher, ChunkEncryptor chunkEncryptor, String key, byte[] value)
+ throws InvalidKeyException, IllegalBlockSizeException {
+ KeyValuePairProto.KeyValuePair pair = new KeyValuePairProto.KeyValuePair();
+ pair.key = key;
+ pair.value = Arrays.copyOf(value, value.length);
+
+ byte[] plaintext = KeyValuePairProto.KeyValuePair.toByteArray(pair);
+ return chunkEncryptor.encrypt(chunkHasher.computeHash(plaintext), plaintext);
+ }
+
+ private static byte[] createMessageDigest(List<ChunkHash> allChunks)
+ throws NoSuchAlgorithmException {
+ MessageDigest messageDigest =
+ MessageDigest.getInstance(BackupEncrypter.MESSAGE_DIGEST_ALGORITHM);
+ // TODO:b/141531271 Extract sorted chunks code to utility class
+ List<ChunkHash> sortedChunks = new ArrayList<>(allChunks);
+ Collections.sort(sortedChunks);
+ for (ChunkHash hash : sortedChunks) {
+ messageDigest.update(hash.getHash());
+ }
+ return messageDigest.digest();
+ }
+
+ private static Optional<byte[]> readEntireValue(BackupDataInput input) throws IOException {
+ // A negative data size indicates that this key should be deleted.
+ if (input.getDataSize() < 0) {
+ return Optional.empty();
+ }
+
+ byte[] value = new byte[input.getDataSize()];
+ int bytesRead = 0;
+ while (bytesRead < value.length) {
+ bytesRead += input.readEntityData(value, bytesRead, value.length - bytesRead);
+ }
+ return Optional.of(value);
+ }
+}
diff --git a/packages/BackupEncryption/test/robolectric/Android.bp b/packages/BackupEncryption/test/robolectric/Android.bp
index 4e42ce7..2a36dcf 100644
--- a/packages/BackupEncryption/test/robolectric/Android.bp
+++ b/packages/BackupEncryption/test/robolectric/Android.bp
@@ -16,7 +16,7 @@
name: "BackupEncryptionRoboTests",
srcs: [
"src/**/*.java",
- ":FrameworksServicesRoboShadows",
+// ":FrameworksServicesRoboShadows",
],
java_resource_dirs: ["config"],
libs: [
diff --git a/packages/BackupEncryption/test/robolectric/src/com/android/server/backup/encryption/tasks/KvBackupEncrypterTest.java b/packages/BackupEncryption/test/robolectric/src/com/android/server/backup/encryption/tasks/KvBackupEncrypterTest.java
new file mode 100644
index 0000000..ccfbfa4
--- /dev/null
+++ b/packages/BackupEncryption/test/robolectric/src/com/android/server/backup/encryption/tasks/KvBackupEncrypterTest.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2019 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.server.backup.encryption.tasks;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.app.backup.BackupDataInput;
+import android.platform.test.annotations.Presubmit;
+import android.util.Pair;
+
+import com.android.server.backup.encryption.chunk.ChunkHash;
+import com.android.server.backup.encryption.chunking.ChunkHasher;
+import com.android.server.backup.encryption.chunking.EncryptedChunk;
+import com.android.server.backup.encryption.kv.KeyValueListingBuilder;
+import com.android.server.backup.encryption.protos.nano.KeyValueListingProto.KeyValueListing;
+import com.android.server.backup.encryption.protos.nano.KeyValuePairProto.KeyValuePair;
+import com.android.server.backup.encryption.tasks.BackupEncrypter.Result;
+import com.android.server.testing.shadows.DataEntity;
+import com.android.server.testing.shadows.ShadowBackupDataInput;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Ordering;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+import java.security.MessageDigest;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+@RunWith(RobolectricTestRunner.class)
+@Presubmit
+@Config(shadows = {ShadowBackupDataInput.class})
+public class KvBackupEncrypterTest {
+ private static final String KEY_ALGORITHM = "AES";
+ private static final String CIPHER_ALGORITHM = "AES/GCM/NoPadding";
+ private static final int GCM_TAG_LENGTH_BYTES = 16;
+
+ private static final byte[] TEST_TERTIARY_KEY = Arrays.copyOf(new byte[0], 256 / Byte.SIZE);
+ private static final String TEST_KEY_1 = "test_key_1";
+ private static final String TEST_KEY_2 = "test_key_2";
+ private static final String TEST_KEY_3 = "test_key_3";
+ private static final byte[] TEST_VALUE_1 = {10, 11, 12};
+ private static final byte[] TEST_VALUE_2 = {13, 14, 15};
+ private static final byte[] TEST_VALUE_2B = {13, 14, 15, 16};
+ private static final byte[] TEST_VALUE_3 = {16, 17, 18};
+
+ private SecretKey mSecretKey;
+ private ChunkHasher mChunkHasher;
+
+ @Before
+ public void setUp() {
+ mSecretKey = new SecretKeySpec(TEST_TERTIARY_KEY, KEY_ALGORITHM);
+ mChunkHasher = new ChunkHasher(mSecretKey);
+
+ ShadowBackupDataInput.reset();
+ }
+
+ private KvBackupEncrypter createEncrypter(KeyValueListing keyValueListing) {
+ KvBackupEncrypter encrypter = new KvBackupEncrypter(new BackupDataInput(null));
+ encrypter.setOldKeyValueListing(keyValueListing);
+ return encrypter;
+ }
+
+ @Test
+ public void backup_noExistingBackup_encryptsAllPairs() throws Exception {
+ ShadowBackupDataInput.addEntity(TEST_KEY_1, TEST_VALUE_1);
+ ShadowBackupDataInput.addEntity(TEST_KEY_2, TEST_VALUE_2);
+
+ KeyValueListing emptyKeyValueListing = new KeyValueListingBuilder().build();
+ ImmutableSet<ChunkHash> emptyExistingChunks = ImmutableSet.of();
+ KvBackupEncrypter encrypter = createEncrypter(emptyKeyValueListing);
+
+ Result result =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, emptyExistingChunks);
+
+ assertThat(result.getAllChunks()).hasSize(2);
+ EncryptedChunk chunk1 = result.getNewChunks().get(0);
+ EncryptedChunk chunk2 = result.getNewChunks().get(1);
+ assertThat(chunk1.key()).isEqualTo(getChunkHash(TEST_KEY_1, TEST_VALUE_1));
+ KeyValuePair pair1 = decryptChunk(chunk1);
+ assertThat(pair1.key).isEqualTo(TEST_KEY_1);
+ assertThat(pair1.value).isEqualTo(TEST_VALUE_1);
+ assertThat(chunk2.key()).isEqualTo(getChunkHash(TEST_KEY_2, TEST_VALUE_2));
+ KeyValuePair pair2 = decryptChunk(chunk2);
+ assertThat(pair2.key).isEqualTo(TEST_KEY_2);
+ assertThat(pair2.value).isEqualTo(TEST_VALUE_2);
+ }
+
+ @Test
+ public void backup_existingBackup_encryptsNewAndUpdatedPairs() throws Exception {
+ Pair<KeyValueListing, Set<ChunkHash>> initialResult = runInitialBackupOfPairs1And2();
+
+ // Update key 2 and add the new key 3.
+ ShadowBackupDataInput.reset();
+ ShadowBackupDataInput.addEntity(TEST_KEY_2, TEST_VALUE_2B);
+ ShadowBackupDataInput.addEntity(TEST_KEY_3, TEST_VALUE_3);
+
+ KvBackupEncrypter encrypter = createEncrypter(initialResult.first);
+ BackupEncrypter.Result secondResult =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialResult.second);
+
+ assertThat(secondResult.getAllChunks()).hasSize(3);
+ assertThat(secondResult.getNewChunks()).hasSize(2);
+ EncryptedChunk newChunk2 = secondResult.getNewChunks().get(0);
+ EncryptedChunk newChunk3 = secondResult.getNewChunks().get(1);
+ assertThat(newChunk2.key()).isEqualTo(getChunkHash(TEST_KEY_2, TEST_VALUE_2B));
+ assertThat(decryptChunk(newChunk2).value).isEqualTo(TEST_VALUE_2B);
+ assertThat(newChunk3.key()).isEqualTo(getChunkHash(TEST_KEY_3, TEST_VALUE_3));
+ assertThat(decryptChunk(newChunk3).value).isEqualTo(TEST_VALUE_3);
+ }
+
+ @Test
+ public void backup_allChunksContainsHashesOfAllChunks() throws Exception {
+ Pair<KeyValueListing, Set<ChunkHash>> initialResult = runInitialBackupOfPairs1And2();
+
+ ShadowBackupDataInput.reset();
+ ShadowBackupDataInput.addEntity(TEST_KEY_3, TEST_VALUE_3);
+
+ KvBackupEncrypter encrypter = createEncrypter(initialResult.first);
+ BackupEncrypter.Result secondResult =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialResult.second);
+
+ assertThat(secondResult.getAllChunks())
+ .containsExactly(
+ getChunkHash(TEST_KEY_1, TEST_VALUE_1),
+ getChunkHash(TEST_KEY_2, TEST_VALUE_2),
+ getChunkHash(TEST_KEY_3, TEST_VALUE_3));
+ }
+
+ @Test
+ public void backup_negativeSize_deletesKeyFromExistingBackup() throws Exception {
+ Pair<KeyValueListing, Set<ChunkHash>> initialResult = runInitialBackupOfPairs1And2();
+
+ ShadowBackupDataInput.reset();
+ ShadowBackupDataInput.addEntity(new DataEntity(TEST_KEY_2));
+
+ KvBackupEncrypter encrypter = createEncrypter(initialResult.first);
+ Result secondResult =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialResult.second);
+
+ assertThat(secondResult.getAllChunks())
+ .containsExactly(getChunkHash(TEST_KEY_1, TEST_VALUE_1));
+ assertThat(secondResult.getNewChunks()).isEmpty();
+ }
+
+ @Test
+ public void backup_returnsMessageDigestOverChunkHashes() throws Exception {
+ Pair<KeyValueListing, Set<ChunkHash>> initialResult = runInitialBackupOfPairs1And2();
+
+ ShadowBackupDataInput.reset();
+ ShadowBackupDataInput.addEntity(TEST_KEY_3, TEST_VALUE_3);
+
+ KvBackupEncrypter encrypter = createEncrypter(initialResult.first);
+ Result secondResult =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialResult.second);
+
+ MessageDigest messageDigest =
+ MessageDigest.getInstance(BackupEncrypter.MESSAGE_DIGEST_ALGORITHM);
+ ImmutableList<ChunkHash> sortedHashes =
+ Ordering.natural()
+ .immutableSortedCopy(
+ ImmutableList.of(
+ getChunkHash(TEST_KEY_1, TEST_VALUE_1),
+ getChunkHash(TEST_KEY_2, TEST_VALUE_2),
+ getChunkHash(TEST_KEY_3, TEST_VALUE_3)));
+ messageDigest.update(sortedHashes.get(0).getHash());
+ messageDigest.update(sortedHashes.get(1).getHash());
+ messageDigest.update(sortedHashes.get(2).getHash());
+ assertThat(secondResult.getDigest()).isEqualTo(messageDigest.digest());
+ }
+
+ @Test
+ public void getNewKeyValueListing_noExistingBackup_returnsCorrectListing() throws Exception {
+ KeyValueListing keyValueListing = runInitialBackupOfPairs1And2().first;
+
+ assertThat(keyValueListing.entries.length).isEqualTo(2);
+ assertThat(keyValueListing.entries[0].key).isEqualTo(TEST_KEY_1);
+ assertThat(keyValueListing.entries[0].hash)
+ .isEqualTo(getChunkHash(TEST_KEY_1, TEST_VALUE_1).getHash());
+ assertThat(keyValueListing.entries[1].key).isEqualTo(TEST_KEY_2);
+ assertThat(keyValueListing.entries[1].hash)
+ .isEqualTo(getChunkHash(TEST_KEY_2, TEST_VALUE_2).getHash());
+ }
+
+ @Test
+ public void getNewKeyValueListing_existingBackup_returnsCorrectListing() throws Exception {
+ Pair<KeyValueListing, Set<ChunkHash>> initialResult = runInitialBackupOfPairs1And2();
+
+ ShadowBackupDataInput.reset();
+ ShadowBackupDataInput.addEntity(TEST_KEY_2, TEST_VALUE_2B);
+ ShadowBackupDataInput.addEntity(TEST_KEY_3, TEST_VALUE_3);
+
+ KvBackupEncrypter encrypter = createEncrypter(initialResult.first);
+ encrypter.backup(mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialResult.second);
+
+ ImmutableMap<String, ChunkHash> keyValueListing =
+ listingToMap(encrypter.getNewKeyValueListing());
+ assertThat(keyValueListing).hasSize(3);
+ assertThat(keyValueListing)
+ .containsEntry(TEST_KEY_1, getChunkHash(TEST_KEY_1, TEST_VALUE_1));
+ assertThat(keyValueListing)
+ .containsEntry(TEST_KEY_2, getChunkHash(TEST_KEY_2, TEST_VALUE_2B));
+ assertThat(keyValueListing)
+ .containsEntry(TEST_KEY_3, getChunkHash(TEST_KEY_3, TEST_VALUE_3));
+ }
+
+ @Test
+ public void getNewKeyValueChunkListing_beforeBackup_throws() throws Exception {
+ KvBackupEncrypter encrypter = createEncrypter(new KeyValueListing());
+ assertThrows(IllegalStateException.class, encrypter::getNewKeyValueListing);
+ }
+
+ private ImmutableMap<String, ChunkHash> listingToMap(KeyValueListing listing) {
+ // We can't use the ImmutableMap collector directly because it isn't supported in Android
+ // guava.
+ return ImmutableMap.copyOf(
+ Arrays.stream(listing.entries)
+ .collect(
+ Collectors.toMap(
+ entry -> entry.key, entry -> new ChunkHash(entry.hash))));
+ }
+
+ private Pair<KeyValueListing, Set<ChunkHash>> runInitialBackupOfPairs1And2() throws Exception {
+ ShadowBackupDataInput.addEntity(TEST_KEY_1, TEST_VALUE_1);
+ ShadowBackupDataInput.addEntity(TEST_KEY_2, TEST_VALUE_2);
+
+ KeyValueListing initialKeyValueListing = new KeyValueListingBuilder().build();
+ ImmutableSet<ChunkHash> initialExistingChunks = ImmutableSet.of();
+ KvBackupEncrypter encrypter = createEncrypter(initialKeyValueListing);
+ Result firstResult =
+ encrypter.backup(
+ mSecretKey, /*unusedFingerprintMixerSalt=*/ null, initialExistingChunks);
+
+ return Pair.create(
+ encrypter.getNewKeyValueListing(), ImmutableSet.copyOf(firstResult.getAllChunks()));
+ }
+
+ private ChunkHash getChunkHash(String key, byte[] value) throws Exception {
+ KeyValuePair pair = new KeyValuePair();
+ pair.key = key;
+ pair.value = Arrays.copyOf(value, value.length);
+ return mChunkHasher.computeHash(KeyValuePair.toByteArray(pair));
+ }
+
+ private KeyValuePair decryptChunk(EncryptedChunk encryptedChunk) throws Exception {
+ Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
+ cipher.init(
+ Cipher.DECRYPT_MODE,
+ mSecretKey,
+ new GCMParameterSpec(GCM_TAG_LENGTH_BYTES * Byte.SIZE, encryptedChunk.nonce()));
+ byte[] decryptedBytes = cipher.doFinal(encryptedChunk.encryptedBytes());
+ return KeyValuePair.parseFrom(decryptedBytes);
+ }
+}
diff --git a/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/DataEntity.java b/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/DataEntity.java
new file mode 100644
index 0000000..6d3b5e9
--- /dev/null
+++ b/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/DataEntity.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2019 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.server.testing.shadows;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+
+/**
+ * Represents a key value pair in {@link ShadowBackupDataInput} and {@link ShadowBackupDataOutput}.
+ */
+public class DataEntity {
+ public final String mKey;
+ public final byte[] mValue;
+ public final int mSize;
+
+ /**
+ * Constructs a pair with a string value. The value will be converted to a byte array in {@link
+ * StandardCharsets#UTF_8}.
+ */
+ public DataEntity(String key, String value) {
+ this.mKey = checkNotNull(key);
+ this.mValue = value.getBytes(StandardCharsets.UTF_8);
+ mSize = this.mValue.length;
+ }
+
+ /**
+ * Constructs a new entity with the given key but a negative size. This represents a deleted
+ * pair.
+ */
+ public DataEntity(String key) {
+ this.mKey = checkNotNull(key);
+ mSize = -1;
+ mValue = null;
+ }
+
+ /** Constructs a new entity where the size of the value is the entire array. */
+ public DataEntity(String key, byte[] value) {
+ this(key, value, value.length);
+ }
+
+ /**
+ * Constructs a new entity.
+ *
+ * @param key the key of the pair
+ * @param data the value to associate with the key
+ * @param size the length of the value in bytes
+ */
+ public DataEntity(String key, byte[] data, int size) {
+ this.mKey = checkNotNull(key);
+ this.mSize = size;
+ mValue = new byte[size];
+ for (int i = 0; i < size; i++) {
+ mValue[i] = data[i];
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ DataEntity that = (DataEntity) o;
+
+ if (mSize != that.mSize) {
+ return false;
+ }
+ if (!mKey.equals(that.mKey)) {
+ return false;
+ }
+ return Arrays.equals(mValue, that.mValue);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = mKey.hashCode();
+ result = 31 * result + Arrays.hashCode(mValue);
+ result = 31 * result + mSize;
+ return result;
+ }
+}
diff --git a/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/ShadowBackupDataInput.java b/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/ShadowBackupDataInput.java
new file mode 100644
index 0000000..7ac6ec4
--- /dev/null
+++ b/packages/BackupEncryption/test/robolectric/src/com/android/server/testing/shadows/ShadowBackupDataInput.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2019 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.server.testing.shadows;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import android.annotation.Nullable;
+import android.app.backup.BackupDataInput;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/** Shadow for BackupDataInput. */
+@Implements(BackupDataInput.class)
+public class ShadowBackupDataInput {
+ private static final List<DataEntity> ENTITIES = new ArrayList<>();
+ @Nullable private static IOException sReadNextHeaderException;
+
+ @Nullable private ByteArrayInputStream mCurrentEntityInputStream;
+ private int mCurrentEntity = -1;
+
+ /** Resets the shadow, clearing any entities or exception. */
+ public static void reset() {
+ ENTITIES.clear();
+ sReadNextHeaderException = null;
+ }
+
+ /** Sets the exception which the input will throw for any call to {@link #readNextHeader}. */
+ public static void setReadNextHeaderException(@Nullable IOException readNextHeaderException) {
+ ShadowBackupDataInput.sReadNextHeaderException = readNextHeaderException;
+ }
+
+ /** Adds the given entity to the input. */
+ public static void addEntity(DataEntity e) {
+ ENTITIES.add(e);
+ }
+
+ /** Adds an entity to the input with the given key and value. */
+ public static void addEntity(String key, byte[] value) {
+ ENTITIES.add(new DataEntity(key, value, value.length));
+ }
+
+ public void __constructor__(FileDescriptor fd) {}
+
+ @Implementation
+ public boolean readNextHeader() throws IOException {
+ if (sReadNextHeaderException != null) {
+ throw sReadNextHeaderException;
+ }
+
+ mCurrentEntity++;
+
+ if (mCurrentEntity >= ENTITIES.size()) {
+ return false;
+ }
+
+ byte[] value = ENTITIES.get(mCurrentEntity).mValue;
+ if (value == null) {
+ mCurrentEntityInputStream = new ByteArrayInputStream(new byte[0]);
+ } else {
+ mCurrentEntityInputStream = new ByteArrayInputStream(value);
+ }
+ return true;
+ }
+
+ @Implementation
+ public String getKey() {
+ return ENTITIES.get(mCurrentEntity).mKey;
+ }
+
+ @Implementation
+ public int getDataSize() {
+ return ENTITIES.get(mCurrentEntity).mSize;
+ }
+
+ @Implementation
+ public void skipEntityData() {
+ // Do nothing.
+ }
+
+ @Implementation
+ public int readEntityData(byte[] data, int offset, int size) {
+ checkState(mCurrentEntityInputStream != null, "Must call readNextHeader() first");
+ return mCurrentEntityInputStream.read(data, offset, size);
+ }
+}
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index b2ff4b3..e767bcc 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -172,6 +172,8 @@
<!-- Permissions needed to test system only camera devices -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.SYSTEM_CAMERA" />
+ <!-- Permissions needed for CTS camera test: RecordingTest.java when assuming shell id -->
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- Permission needed to enable/disable Bluetooth/Wifi -->
<uses-permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_WIRELESS_CONSENT_REQUIRED" />
<uses-permission android:name="android.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED" />
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index 37fefc2..0c582c4 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -170,39 +170,3 @@
required: ["privapp_whitelist_com.android.systemui"],
}
-
-// Only used for products that are shipping legacy Recents
-android_app {
- name: "SystemUIWithLegacyRecents",
- overrides: [
- "SystemUI",
- ],
-
- platform_apis: true,
- certificate: "platform",
- privileged: true,
-
- dxflags: ["--multi-dex"],
- optimize: {
- proguard_flags_files: ["proguard.flags", "legacy/recents/proguard.flags"],
- },
-
- static_libs: [
- "SystemUI-core",
- ],
- libs: [
- "telephony-common",
- ],
-
- kotlincflags: ["-Xjvm-default=enable"],
-
- srcs: [
- "legacy/recents/src/**/*.java",
- "legacy/recents/src/**/I*.aidl",
- ],
- resource_dirs: [
- "legacy/recents/res",
- ],
-
- manifest: "legacy/recents/AndroidManifest.xml",
-}
diff --git a/packages/SystemUI/legacy/recents/AndroidManifest.xml b/packages/SystemUI/legacy/recents/AndroidManifest.xml
deleted file mode 100644
index 0d8b3cd..0000000
--- a/packages/SystemUI/legacy/recents/AndroidManifest.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright (c) 2018 Google Inc.
- *
- * 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.
- */
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- package="com.android.systemui"
- android:sharedUserId="android.uid.systemui"
- coreApp="true">
-
- <application
- android:name="com.android.systemui.SystemUIApplication">
-
- <!-- Service used by secondary users to register themselves with the system user. -->
- <service android:name=".recents.RecentsSystemUserService"
- android:exported="false"
- android:permission="com.android.systemui.permission.SELF" />
-
- <!-- Alternate Recents -->
- <activity android:name=".recents.RecentsActivity"
- android:label="@string/accessibility_desc_recent_apps"
- android:exported="false"
- android:launchMode="singleInstance"
- android:excludeFromRecents="true"
- android:stateNotNeeded="true"
- android:resumeWhilePausing="true"
- android:resizeableActivity="true"
- android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden"
- android:theme="@style/RecentsTheme.Wallpaper">
- <intent-filter>
- <action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
- </intent-filter>
- </activity>
-
- </application>
-</manifest>
diff --git a/packages/SystemUI/legacy/recents/proguard.flags b/packages/SystemUI/legacy/recents/proguard.flags
deleted file mode 100644
index c358949..0000000
--- a/packages/SystemUI/legacy/recents/proguard.flags
+++ /dev/null
@@ -1,14 +0,0 @@
--keepclassmembers class ** {
- public void onBusEvent(**);
- public void onInterprocessBusEvent(**);
-}
--keepclassmembers class ** extends **.EventBus$InterprocessEvent {
- public <init>(android.os.Bundle);
-}
-
--keep class com.android.systemui.recents.views.TaskView {
- public int getDim();
- public void setDim(int);
- public float getTaskProgress();
- public void setTaskProgress(float);
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_fast_toggle_app_home_exit.xml b/packages/SystemUI/legacy/recents/res/anim/recents_fast_toggle_app_home_exit.xml
deleted file mode 100644
index 69edcc7..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_fast_toggle_app_home_exit.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-<!-- Recents Activity -->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:duration="250"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_enter.xml b/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_enter.xml
deleted file mode 100644
index 00b3dfd..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear_out_slow_in"
- android:duration="150"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_exit.xml b/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_exit.xml
deleted file mode 100644
index 33831b8..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_from_launcher_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@interpolator/recents_from_launcher_exit_interpolator"
- android:duration="133"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_enter.xml b/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_enter.xml
deleted file mode 100644
index da1dee0..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear"
- android:duration="200"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_exit.xml b/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_exit.xml
deleted file mode 100644
index 31cf26a..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_from_unknown_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="200"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_bounce.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_bounce.xml
deleted file mode 100644
index 74f2814..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_bounce.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
-
-
- <translate android:fromYDelta="0" android:toYDelta="2%"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="133"/>
-
- <scale android:fromXScale="1.0" android:toXScale="0.98"
- android:fromYScale="1.0" android:toYScale="0.98"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:pivotX="50%p" android:pivotY="50%p"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="133" />
-
- <translate android:fromYDelta="0" android:toYDelta="-2%"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@interpolator/recents_launch_prev_affiliated_task_bounce_ydelta"
- android:startOffset="133"
- android:duration="217"/>
-
- <scale android:fromXScale="1.0" android:toXScale="1.02040816326531"
- android:fromYScale="1.0" android:toYScale="1.02040816326531"
- android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
- android:pivotX="50%p" android:pivotY="50%p"
- android:interpolator="@interpolator/recents_launch_next_affiliated_task_bounce_scale"
- android:startOffset="133"
- android:duration="217" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_source.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_source.xml
deleted file mode 100644
index f0fd684..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_source.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
-
- <alpha android:fromAlpha="1.0" android:toAlpha="0.6"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/accelerate_cubic"
- android:duration="150"/>
-
- <scale android:fromXScale="1.0" android:toXScale="0.9"
- android:fromYScale="1.0" android:toYScale="0.9"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:pivotX="50%p" android:pivotY="50%p"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="300" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_target.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_target.xml
deleted file mode 100644
index 170ac82..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_next_affiliated_task_target.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
-
- <translate android:fromYDelta="110%" android:toYDelta="0%"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_quint"
- android:startOffset="50"
- android:duration="250" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_bounce.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_bounce.xml
deleted file mode 100644
index b19167d..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_bounce.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
-
- <translate android:fromYDelta="0%" android:toYDelta="10%"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/fast_out_slow_in"
- android:duration="133" />
-
- <translate android:fromYDelta="0%" android:toYDelta="-10%"
- android:fillEnabled="true" android:fillBefore="false" android:fillAfter="true"
- android:interpolator="@interpolator/recents_launch_prev_affiliated_task_bounce_ydelta"
- android:startOffset="133"
- android:duration="217" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_source.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_source.xml
deleted file mode 100644
index ad5341b..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_source.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
-
- <translate android:fromYDelta="0%" android:toYDelta="110%"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/accelerate_quint"
- android:duration="300" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_target.xml b/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_target.xml
deleted file mode 100644
index 7687f02..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_launch_prev_affiliated_task_target.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
-
- <alpha android:fromAlpha="0.6" android:toAlpha="1.0"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/decelerate_cubic"
- android:startOffset="75"
- android:duration="150"/>
-
- <scale android:fromXScale="0.9" android:toXScale="1.0"
- android:fromYScale="0.9" android:toYScale="1.0"
- android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear_out_slow_in"
- android:pivotX="50%p" android:pivotY="50%p"
- android:startOffset="75"
- android:duration="225" />
-</set>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_enter.xml b/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_enter.xml
deleted file mode 100644
index 544ec88..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="normal">
- <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@interpolator/recents_to_launcher_enter_interpolator"
- android:duration="133"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_exit.xml b/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_exit.xml
deleted file mode 100644
index 226edb8..0000000
--- a/packages/SystemUI/legacy/recents/res/anim/recents_to_launcher_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2012, 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.
-*/
--->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:shareInterpolator="false"
- android:zAdjustment="top">
- <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
- android:fillEnabled="true"
- android:fillBefore="true" android:fillAfter="true"
- android:interpolator="@android:interpolator/linear_out_slow_in"
- android:duration="1"/>
-</set>
diff --git a/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_lower_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_lower_gradient.9.png
deleted file mode 100644
index 17100f7..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_lower_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_status_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_status_gradient.9.png
deleted file mode 100644
index e969d4c2..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-hdpi/recents_status_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_lower_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_lower_gradient.9.png
deleted file mode 100644
index b53bd8f..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_lower_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_status_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_status_gradient.9.png
deleted file mode 100644
index 657f710..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-mdpi/recents_status_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_lower_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_lower_gradient.9.png
deleted file mode 100644
index 09606f6..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_lower_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_status_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_status_gradient.9.png
deleted file mode 100644
index a444c55..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-xhdpi/recents_status_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_lower_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_lower_gradient.9.png
deleted file mode 100644
index 427cad9..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_lower_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_status_gradient.9.png b/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_status_gradient.9.png
deleted file mode 100644
index 29cf44b..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_status_gradient.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_task_shadow.9.png b/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_task_shadow.9.png
deleted file mode 100644
index 36e7e45..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable-xxhdpi/recents_task_shadow.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_dark.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_dark.xml
deleted file mode 100644
index b837ebe..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_dark.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-android:width="24dp"
-android:height="24dp"
-android:viewportWidth="24"
-android:viewportHeight="24">
-
-<path
- android:fillColor="@color/recents_task_bar_dark_icon_color"
- android:pathData="M18.3 5.71a.996 .996 0 0 0-1.41 0L12 10.59 7.11 5.7A.996 .996 0 1 0 5.7
-7.11L10.59 12 5.7 16.89a.996 .996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996 .996 0
-1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38 .38 -1.02 0-1.4z" />
-<path
- android:pathData="M0 0h24v24H0z" />
-</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_light.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_light.xml
deleted file mode 100644
index 2b20814..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_dismiss_light.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-android:width="24dp"
-android:height="24dp"
-android:viewportWidth="24"
-android:viewportHeight="24">
-
-<path
- android:fillColor="@color/recents_task_bar_light_icon_color"
- android:pathData="M18.3 5.71a.996 .996 0 0 0-1.41 0L12 10.59 7.11 5.7A.996 .996 0 1 0 5.7
-7.11L10.59 12 5.7 16.89a.996 .996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996 .996 0
-1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38 .38 -1.02 0-1.4z" />
-<path
- android:pathData="M0 0h24v24H0z" />
-</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_empty.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_empty.xml
deleted file mode 100644
index 5506de1..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_empty.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="100dp"
- android:height="132dp"
- android:viewportWidth="100"
- android:viewportHeight="132">
-
- <path
- android:fillColor="#5AFFFFFF"
- android:pathData="M86.91,68.67H13.09c-4.96,0-9,4.04-9,9V119c0,4.96,4.04,9,9,9h73.82c4.96,0,9-4.04,9-9V77.67
-C95.91,72.7,91.87,68.67,86.91,68.67z M27.59,77.27h26.72v3.94H27.59V77.27z
-M18.73,74.74c2.49,0,4.5,2.01,4.5,4.5
-c0,2.49-2.01,4.5-4.5,4.5s-4.5-2.01-4.5-4.5C14.23,76.75,16.24,74.74,18.73,74.74z
-M89.91,119c0,1.65-1.35,3-3,3H13.09 c-1.65,0-3-1.35-3-3V88.67h79.82V119z" />
- <path
- android:fillColor="#5AFFFFFF"
- android:pathData="M86.91,36.3H13.09c-4.96,0-9,4.04-9,9v23c1.65-1.58,3.71-2.73,6-3.28v-9.08h79.82v9.08
-c2.29,0.55,4.35,1.69,6,3.28v-23C95.91,40.34,91.87,36.3,86.91,36.3z
-M18.73,51.38c-2.49,0-4.5-2.01-4.5-4.5s2.01-4.5,4.5-4.5
-s4.5,2.01,4.5,4.5S21.22,51.38,18.73,51.38z M54.31,48.84H27.59v-3.94h26.72V48.84z" />
- <path
- android:fillColor="#5AFFFFFF"
- android:pathData="M86.91,4H13.09c-4.96,0-9,4.04-9,9v22.94c1.65-1.58,3.71-2.73,6-3.28V24h79.82v8.67
-c2.29,0.55,4.35,1.69,6,3.28V13C95.91,8.04,91.87,4,86.91,4z
-M18.73,18.5c-2.49,0-4.5-2.01-4.5-4.5s2.01-4.5,4.5-4.5
-s4.5,2.01,4.5,4.5S21.22,18.5,18.73,18.5z M54.31,15.97H27.59v-3.94h26.72V15.97z" />
- <path
- android:pathData="M 0 0 H 100 V 132 H 0 V 0 Z" />
-</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_grid_task_view_focus_frame_background.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_grid_task_view_focus_frame_background.xml
deleted file mode 100644
index 4987f9b..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_grid_task_view_focus_frame_background.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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.
--->
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="#61FFFFFF" />
- <corners android:radius="@dimen/recents_grid_task_view_focused_frame_rounded_corners_radius"/>
-</shape>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_info_dark.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_info_dark.xml
deleted file mode 100644
index 555a69a..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_info_dark.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="@color/recents_task_bar_dark_icon_color"
- android:pathData="M12.000000,2.000000C6.500000,2.000000 2.000000,6.500000 2.000000,12.000000s4.500000,10.000000 10.000000,10.000000c5.500000,0.000000 10.000000,-4.500000 10.000000,-10.000000S17.500000,2.000000 12.000000,2.000000zM13.000000,17.000000l-2.000000,0.000000l0.000000,-6.000000l2.000000,0.000000L13.000000,17.000000zM13.000000,9.000000l-2.000000,0.000000L11.000000,7.000000l2.000000,0.000000L13.000000,9.000000z"/>
-</vector>
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_info_light.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_info_light.xml
deleted file mode 100644
index 65e7bf5..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_info_light.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:pathData="M12.000000,2.000000C6.500000,2.000000 2.000000,6.500000 2.000000,12.000000s4.500000,10.000000 10.000000,10.000000c5.500000,0.000000 10.000000,-4.500000 10.000000,-10.000000S17.500000,2.000000 12.000000,2.000000zM13.000000,17.000000l-2.000000,0.000000l0.000000,-6.000000l2.000000,0.000000L13.000000,17.000000zM13.000000,9.000000l-2.000000,0.000000L11.000000,7.000000l2.000000,0.000000L13.000000,9.000000z"
- android:fillColor="#FFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_app_pin.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_app_pin.xml
deleted file mode 100644
index 317f858..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_app_pin.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24.0dp"
- android:height="24.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
-
- <path
- android:fillColor="#FFffffff"
- android:pathData="M16.000000,12.000000L16.000000,4.000000l1.000000,0.000000L17.000000,2.000000L7.000000,2.000000l0.000000,2.000000l1.000000,0.000000l0.000000,8.000000l-2.000000,2.000000l0.000000,2.000000l5.200000,0.000000l0.000000,6.000000l1.600000,0.000000l0.000000,-6.000000L18.000000,16.000000l0.000000,-2.000000L16.000000,12.000000z"/>
-</vector>
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_task_button_bg.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_task_button_bg.xml
deleted file mode 100644
index 8a8164a..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_lock_to_task_button_bg.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="#ff9cdfd9">
- <item>
- <shape android:shape="oval">
- <solid android:color="#9cc8c4" />
- <size android:width="@dimen/recents_lock_to_app_size"
- android:height="@dimen/recents_lock_to_app_size" />
- </shape>
- </item>
-</ripple>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_low_ram_stack_button_background.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_low_ram_stack_button_background.xml
deleted file mode 100644
index bff97f6..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_low_ram_stack_button_background.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--
- ~ 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="?attr/clearAllBackgroundColor" />
-
-</shape>
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_dark.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_dark.xml
deleted file mode 100644
index fd468c1..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_dark.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <group
- android:translateX="-252.000000"
- android:translateY="-602.000000">
- <group
- android:translateX="109.000000"
- android:translateY="514.000000">
- <group
- android:translateX="144.000000"
- android:translateY="89.000000">
- <path
- android:strokeColor="@color/recents_task_bar_dark_icon_color"
- android:strokeWidth="2"
- android:pathData="M17,17 L5,17 L5,5 L17,5 L17,17 Z" />
- </group>
- </group>
- </group>
-</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_light.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_light.xml
deleted file mode 100644
index 53229063..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_move_task_fullscreen_light.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <group
- android:translateX="-252.000000"
- android:translateY="-602.000000">
- <group
- android:translateX="109.000000"
- android:translateY="514.000000">
- <group
- android:translateX="144.000000"
- android:translateY="89.000000">
- <path
- android:strokeColor="@color/recents_task_bar_light_icon_color"
- android:strokeWidth="2"
- android:pathData="M19,19 L3,19 L3,3 L19,3 L19,5 L19,18 L19,19 Z" />
- </group>
- </group>
- </group>
-</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/drawable/recents_stack_action_background.xml b/packages/SystemUI/legacy/recents/res/drawable/recents_stack_action_background.xml
deleted file mode 100644
index 2a40dd0..0000000
--- a/packages/SystemUI/legacy/recents/res/drawable/recents_stack_action_background.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2 (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.
--->
-
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:attr/colorControlHighlight">
- <item android:id="@android:id/mask">
- <shape>
- <corners android:radius="@dimen/recents_task_view_rounded_corners_radius" />
- <solid android:color="@android:color/white" />
- </shape>
- </item>
-</ripple>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/interpolator/recents_from_launcher_exit_interpolator.xml b/packages/SystemUI/legacy/recents/res/interpolator/recents_from_launcher_exit_interpolator.xml
deleted file mode 100644
index 4a7fff6..0000000
--- a/packages/SystemUI/legacy/recents/res/interpolator/recents_from_launcher_exit_interpolator.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
- android:controlX1="0"
- android:controlY1="0"
- android:controlX2="0.8"
- android:controlY2="1" />
diff --git a/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_next_affiliated_task_bounce_scale.xml b/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_next_affiliated_task_bounce_scale.xml
deleted file mode 100644
index c4e5d97..0000000
--- a/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_next_affiliated_task_bounce_scale.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
- android:pathData="M 0,0 c 0.8,0 0.2,1 1,1" />
diff --git a/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_prev_affiliated_task_bounce_ydelta.xml b/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_prev_affiliated_task_bounce_ydelta.xml
deleted file mode 100644
index 40a08b9..0000000
--- a/packages/SystemUI/legacy/recents/res/interpolator/recents_launch_prev_affiliated_task_bounce_ydelta.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
- android:pathData="M 0,0 c 0.6,0 0.2,1 1,1" />
diff --git a/packages/SystemUI/legacy/recents/res/interpolator/recents_to_launcher_enter_interpolator.xml b/packages/SystemUI/legacy/recents/res/interpolator/recents_to_launcher_enter_interpolator.xml
deleted file mode 100644
index c61dfd8..0000000
--- a/packages/SystemUI/legacy/recents/res/interpolator/recents_to_launcher_enter_interpolator.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2014, 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.
-*/
--->
-<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
- android:controlX1="0.4"
- android:controlY1="0"
- android:controlX2="1"
- android:controlY2="1" />
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents.xml b/packages/SystemUI/legacy/recents/res/layout/recents.xml
deleted file mode 100644
index ae89631..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- Recents View -->
- <com.android.systemui.recents.views.RecentsView
- android:id="@+id/recents_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- </com.android.systemui.recents.views.RecentsView>
-
- <!-- Incompatible task overlay -->
- <ViewStub android:id="@+id/incompatible_app_overlay_stub"
- android:inflatedId="@+id/incompatible_app_overlay"
- android:layout="@layout/recents_incompatible_app_overlay"
- android:layout_width="match_parent"
- android:layout_height="128dp"
- android:layout_gravity="center_horizontal|top" />
-
- <!-- Nav Bar Scrim View -->
- <ImageView
- android:id="@+id/nav_bar_scrim"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal|bottom"
- android:scaleType="fitXY"
- android:src="@drawable/recents_lower_gradient" />
-</FrameLayout>
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_empty.xml b/packages/SystemUI/legacy/recents/res/layout/recents_empty.xml
deleted file mode 100644
index d7f058c..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_empty.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center"
- android:drawableTop="@drawable/recents_empty"
- android:drawablePadding="25dp"
- android:textSize="16sp"
- android:drawableTint="?attr/wallpaperTextColor"
- android:textColor="?attr/wallpaperTextColor"
- android:text="@string/recents_empty_message"
- android:fontFamily="sans-serif"
- android:visibility="gone" />
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_grid_task_view.xml b/packages/SystemUI/legacy/recents/res/layout/recents_grid_task_view.xml
deleted file mode 100644
index 1c9b9ac..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_grid_task_view.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<com.android.systemui.recents.views.grid.GridTaskView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="true">
- <com.android.systemui.recents.views.grid.GridTaskViewThumbnail
- android:id="@+id/task_view_thumbnail"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <include layout="@layout/recents_task_view_header" />
-
- <!-- TODO: Move this into a view stub -->
- <include layout="@layout/recents_task_view_lock_to_app"/>
-
- <!-- The incompatible app toast -->
- <include layout="@layout/recents_task_view_incompatible_app_toast"/>
-</com.android.systemui.recents.views.grid.GridTaskView>
-
-
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_incompatible_app_overlay.xml b/packages/SystemUI/legacy/recents/res/layout/recents_incompatible_app_overlay.xml
deleted file mode 100644
index a1c1e5b..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_incompatible_app_overlay.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:alpha="0"
- android:background="#88000000"
- android:forceHasOverlappingRendering="false">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:drawableTop="@drawable/recents_info_light"
- android:drawablePadding="8dp"
- android:text="@string/dock_non_resizeble_failed_to_dock_text"
- android:textColor="@android:color/white" />
-</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_low_ram_stack_action_button.xml b/packages/SystemUI/legacy/recents/res/layout/recents_low_ram_stack_action_button.xml
deleted file mode 100644
index dca8911..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_low_ram_stack_action_button.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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" />
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_search_bar.xml b/packages/SystemUI/legacy/recents/res/layout/recents_search_bar.xml
deleted file mode 100644
index 915283e..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_search_bar.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/search_bg_transparent">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="@string/recents_search_bar_label"
- android:textColor="#99ffffff"
- android:textSize="18sp"
- android:textAllCaps="true" />
-</FrameLayout>
-
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_stack_action_button.xml b/packages/SystemUI/legacy/recents/res/layout/recents_stack_action_button.xml
deleted file mode 100644
index 4707a8c..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_stack_action_button.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<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="14dp"
- android:paddingEnd="14dp"
- android:paddingTop="12dp"
- android:paddingBottom="12dp"
- android:text="@string/recents_stack_action_button_label"
- android:textSize="14sp"
- android:textColor="?attr/wallpaperTextColor"
- android:textAllCaps="true"
- android:shadowColor="#99000000"
- android:shadowDx="0"
- android:shadowDy="2"
- android:shadowRadius="5"
- android:fontFamily="sans-serif-medium"
- android:background="@drawable/recents_stack_action_background"
- android:visibility="invisible"
- android:forceHasOverlappingRendering="false"
- style="?attr/clearAllStyle" />
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view.xml
deleted file mode 100644
index 015e4a2..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<com.android.systemui.recents.views.TaskView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="true">
- <com.android.systemui.recents.views.TaskViewThumbnail
- android:id="@+id/task_view_thumbnail"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <include layout="@layout/recents_task_view_header" />
-
- <!-- TODO: Move this into a view stub -->
- <include layout="@layout/recents_task_view_lock_to_app"/>
-
- <!-- The incompatible app toast -->
- <include layout="@layout/recents_task_view_incompatible_app_toast"/>
-</com.android.systemui.recents.views.TaskView>
-
-
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header.xml
deleted file mode 100644
index 1734506..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2014 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.
--->
-<!-- The layouts params are calculated in TaskViewHeader.java -->
-<com.android.systemui.recents.views.TaskViewHeader
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/task_view_bar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal">
- <com.android.systemui.recents.views.FixedSizeImageView
- android:id="@+id/icon"
- android:contentDescription="@string/recents_app_info_button_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
- android:paddingStart="16dp"
- android:paddingEnd="12dp" />
- <TextView
- android:id="@+id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:textSize="16sp"
- android:textColor="#ffffffff"
- android:text="@string/recents_empty_message"
- android:fontFamily="sans-serif-medium"
- android:singleLine="true"
- android:maxLines="1"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal"
- android:forceHasOverlappingRendering="false" />
- <com.android.systemui.recents.views.FixedSizeImageView
- android:id="@+id/move_task"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:padding="@dimen/recents_task_view_header_button_padding"
- android:src="@drawable/star"
- android:background="?android:selectableItemBackground"
- android:alpha="0"
- android:visibility="gone" />
- <com.android.systemui.recents.views.FixedSizeImageView
- android:id="@+id/dismiss_task"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:padding="@dimen/recents_task_view_header_button_padding"
- android:src="@drawable/recents_dismiss_light"
- android:background="?android:selectableItemBackground"
- android:alpha="0"
- android:visibility="gone" />
-
- <!-- The app overlay shows as the user long-presses on the app icon -->
- <ViewStub android:id="@+id/app_overlay_stub"
- android:inflatedId="@+id/app_overlay"
- android:layout="@layout/recents_task_view_header_overlay"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-</com.android.systemui.recents.views.TaskViewHeader>
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_overlay.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_overlay.xml
deleted file mode 100644
index cf09b1d..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_overlay.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<!-- The layouts params are calculated in TaskViewHeader.java -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <com.android.systemui.recents.views.FixedSizeImageView
- android:id="@+id/app_icon"
- android:contentDescription="@string/recents_app_info_button_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
- android:paddingStart="16dp"
- android:paddingEnd="12dp" />
- <TextView
- android:id="@+id/app_title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:textSize="16sp"
- android:textColor="#ffffffff"
- android:text="@string/recents_empty_message"
- android:fontFamily="sans-serif-medium"
- android:singleLine="true"
- android:maxLines="2"
- android:ellipsize="marquee"
- android:fadingEdge="horizontal" />
- <com.android.systemui.recents.views.FixedSizeImageView
- android:id="@+id/app_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:padding="@dimen/recents_task_view_header_button_padding"
- android:background="?android:selectableItemBackground"
- android:src="@drawable/recents_info_light" />
-</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_progress_bar.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_progress_bar.xml
deleted file mode 100644
index f352632..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_header_progress_bar.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<ProgressBar
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:indeterminateOnly="false"
- android:visibility="invisible" />
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_incompatible_app_toast.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view_incompatible_app_toast.xml
deleted file mode 100644
index d573d6b..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_incompatible_app_toast.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<ViewStub
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/incompatible_app_toast_stub"
- android:inflatedId="@+id/incompatible_app_toast"
- android:layout="@*android:layout/transient_notification"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal"
- android:layout_marginTop="48dp"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp" />
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_lock_to_app.xml b/packages/SystemUI/legacy/recents/res/layout/recents_task_view_lock_to_app.xml
deleted file mode 100644
index 8cece11..0000000
--- a/packages/SystemUI/legacy/recents/res/layout/recents_task_view_lock_to_app.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/lock_to_app_fab"
- android:layout_width="@dimen/recents_lock_to_app_size"
- android:layout_height="@dimen/recents_lock_to_app_size"
- android:layout_gravity="bottom|end"
- android:layout_marginEnd="15dp"
- android:layout_marginBottom="15dp"
- android:translationZ="4dp"
- android:contentDescription="@string/recents_lock_to_app_button_label"
- android:background="@drawable/recents_lock_to_task_button_bg"
- android:visibility="invisible"
- android:alpha="0">
- <ImageView
- android:layout_width="@dimen/recents_lock_to_app_icon_size"
- android:layout_height="@dimen/recents_lock_to_app_icon_size"
- android:layout_gravity="center"
- android:src="@drawable/recents_lock_to_app_pin" />
-</com.android.systemui.statusbar.AlphaOptimizedFrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values-af/strings.xml b/packages/SystemUI/legacy/recents/res/values-af/strings.xml
deleted file mode 100644
index 736c810..0000000
--- a/packages/SystemUI/legacy/recents/res/values-af/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Oorsig."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Maak <xliff:g id="APP">%s</xliff:g> toe."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> is toegemaak."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alle onlangse programme is toegemaak."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Maak <xliff:g id="APP">%s</xliff:g>-programinligting oop."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Begin tans <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Geen onlangse items nie"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Jy het alles toegemaak"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Programinligting"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"skermvaspen"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"soek"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Kon nie <xliff:g id="APP">%s</xliff:g> begin nie."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is in veiligmodus gedeaktiveer."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Vee alles uit"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Sleep hierheen om verdeelde skerm te gebruik"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Verdeel horisontaal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Verdeel vertikaal"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Verdeel gepasmaak"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Verdeel skerm na bo"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Verdeel skerm na links"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Verdeel skerm na regs"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-am/strings.xml b/packages/SystemUI/legacy/recents/res/values-am/strings.xml
deleted file mode 100644
index 2870be7..0000000
--- a/packages/SystemUI/legacy/recents/res/values-am/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"አጠቃላይ እይታ።"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> አስወግድ።"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ተሰናብቷል።"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ሁሉም የቅርብ ጊዜ ማመልከቻዎች ተሰናብተዋል።"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"የ<xliff:g id="APP">%s</xliff:g> መተግበሪያ መረጃውን ይክፈቱ።"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> በመጀመር ላይ።"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ምንም የቅርብ ጊዜ ንጥሎች የሉም"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ሁሉንም ነገር አጽድተዋል"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"የመተግበሪያ መረጃ"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ማያ ገጽ መሰካት"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ፈልግ"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>ን መጀመር አልተቻለም።"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> በጥንቃቄ ሁነታ ውስጥ ታግዷል።"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ሁሉንም አጽዳ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"የተከፈለ ማያ ገጽን ለመጠቀም እዚህ ላይ ይጎትቱ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"አግድም ክፈል"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ቁልቁል ክፈል"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"በብጁ ክፈል"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ማያ ገጽ ወደ ላይ ክፈል"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ማያ ገጽ ወደ ግራ ክፈል"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ማያ ገጽ ወደ ቀኝ ክፈል"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ar/strings.xml b/packages/SystemUI/legacy/recents/res/values-ar/strings.xml
deleted file mode 100644
index 004de41..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ar/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"النظرة عامة"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"إزالة <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"تمَّت إزالة <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"تمَّت إزالة كل التطبيقات المستخدمة مؤخرًا."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"فتح معلومات تطبيق <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"جارٍ بدء <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ليست هناك عناصر تم استخدامها مؤخرًا"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"لقد محوتَ كل شيء"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"معلومات التطبيق"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"تثبيت الشاشة"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"بحث"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"تعذَّر بدء <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"تم إيقاف <xliff:g id="APP">%s</xliff:g> في الوضع الآمن."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"محو الكل"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"اسحب هنا لاستخدام وضع تقسيم الشاشة"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"تقسيم أفقي"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"تقسيم رأسي"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"تقسيم مخصَّص"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"تقسيم الشاشة بمحاذاة الجزء العلوي"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"تقسيم الشاشة بمحاذاة اليسار"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"تقسيم الشاشة بمحاذاة اليمين"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-as/strings.xml b/packages/SystemUI/legacy/recents/res/values-as/strings.xml
deleted file mode 100644
index c742dab..0000000
--- a/packages/SystemUI/legacy/recents/res/values-as/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"অৱলোকন।"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"শেহতীয়া-ৰ তালিকাৰ পৰা <xliff:g id="APP">%s</xliff:g>ক আঁতৰাওক।"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"শেহতীয়া-ৰ তালিকাৰ পৰা <xliff:g id="APP">%s</xliff:g>ক আঁতৰোৱা হ’ল।"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"শেহতীয়া-ৰ তালিকাৰ পৰা সকলো এপ্লিকেশ্বন আঁতৰোৱা হ’ল।"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> এপ্লিকেশ্বনৰ তথ্য খোলক।"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>ক আৰম্ভ কৰা হৈছে।"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"কোনো শেহতীয়া বস্তু নাই"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"আপুনি সকলো খালী কৰিলে"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"এপ্লিকেশ্বনৰ তথ্য"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"স্ক্ৰীণ পিনিং"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"সন্ধান কৰক"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>ক আৰম্ভ কৰিব পৰা নগ’ল।"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>টো সুৰক্ষিত ম’ডত অক্ষম কৰা হ’ল।"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"সকলো মচক"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"বিভাজিত স্ক্ৰীণ ব্যৱহাৰ কৰিবলৈ ইয়ালৈ টানি আনি এৰক"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"আনুভূমিকভাৱে বিভাজন কৰক"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"উলম্বভাৱে বিভাজন কৰক"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"কাষ্টম বিভাজন কৰক"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"স্ক্ৰীণখনক ওপৰফাললৈ ভাগ কৰক"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"স্ক্ৰীণখনক বাওঁফাললৈ ভাগ কৰক"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"স্ক্ৰীণখনক সোঁফাললৈ ভাগ কৰক"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-az/strings.xml b/packages/SystemUI/legacy/recents/res/values-az/strings.xml
deleted file mode 100644
index 76ae02a..0000000
--- a/packages/SystemUI/legacy/recents/res/values-az/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"İcmal."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> tətbiqini silin."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> silindi."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Bütün son tətbiqlər silindi."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> tətbiq məlumatını açın."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> başladılır."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ən son element yoxdur"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Hər şeyi sildiniz"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Tətbiq məlumatı"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ekran sancağı"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"axtarış"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> başladılmadı."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> təhlükəsiz rejimdə deaktiv edildi."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Hamısını silin"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Bölünmüş ekrandan istifadə etmək üçün bura sürüşdürün"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horizontal Bölün"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikal Bölün"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Fərdi Bölün"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Ekranı yuxarıya doğru bölün"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Ekranı sola doğru bölün"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Ekranı sağa doğru bölün"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-b+sr+Latn/strings.xml b/packages/SystemUI/legacy/recents/res/values-b+sr+Latn/strings.xml
deleted file mode 100644
index 3117eea..0000000
--- a/packages/SystemUI/legacy/recents/res/values-b+sr+Latn/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Pregled."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Odbacite aplikaciju <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikacija <xliff:g id="APP">%s</xliff:g> je odbačena."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Sve nedavno korišćene aplikacije su odbačene."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otvorite informacije o aplikaciji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Pokreće se <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nema nedavnih stavki"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Obrisali ste sve"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informacije o aplikaciji"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"kačenje ekrana"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pretraži"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Pokretanje aplikacije <xliff:g id="APP">%s</xliff:g> nije uspelo."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikacija <xliff:g id="APP">%s</xliff:g> je onemogućena u bezbednom režimu."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Obriši sve"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Prevucite ovde da biste koristili razdeljeni ekran"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Podeli horizontalno"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Podeli vertikalno"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Podeli prilagođeno"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Podeli ekran nagore"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Podeli ekran nalevo"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Podeli ekran nadesno"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-be/strings.xml b/packages/SystemUI/legacy/recents/res/values-be/strings.xml
deleted file mode 100644
index 8121846..0000000
--- a/packages/SystemUI/legacy/recents/res/values-be/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Агляд."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Закрыць праграму \"<xliff:g id="APP">%s</xliff:g>\"."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Праграма \"<xliff:g id="APP">%s</xliff:g>\" закрыта."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Усе нядаўнія праграмы закрыты."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Адкрыць інфармацыю пра праграму \"<xliff:g id="APP">%s</xliff:g>\"."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Запускаецца праграма \"<xliff:g id="APP">%s</xliff:g>\"."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Няма нядаўніх элементаў"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Вы ўсё выдалілі"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Інфармацыя пра праграму"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"замацаванне экрана"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"пошук"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Не ўдалося запусціць праграму \"<xliff:g id="APP">%s</xliff:g>\"."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Праграма \"<xliff:g id="APP">%s</xliff:g>\" адключана ў бяспечным рэжыме."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ачысціць усё"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Перацягніце сюды, каб перайсці ў рэжым падзеленага экрана"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Падзяліць гарызантальна"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Падзяліць вертыкальна"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Падзяліць іншым чынам"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Падзяліць экран зверху"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Падзяліць экран злева"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Падзяліць экран справа"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-bg/strings.xml b/packages/SystemUI/legacy/recents/res/values-bg/strings.xml
deleted file mode 100644
index 3dda34f..0000000
--- a/packages/SystemUI/legacy/recents/res/values-bg/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Общ преглед."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Отхвърляне на <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Приложението <xliff:g id="APP">%s</xliff:g> е отхвърлено."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Всички скорошни приложения са отхвърлени."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Отворете информацията за приложението <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> се стартира."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Няма скорошни елементи"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Изчистихте всичко"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Информация за приложението"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"фиксиране на екрана"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"търсене"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> не можа да стартира."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Приложението <xliff:g id="APP">%s</xliff:g> е деактивирано в безопасния режим."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Изчистване на всичко"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Преместете тук с плъзгане, за да използвате режим за разделен екран"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Хоризонтално разделяне"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Вертикално разделяне"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Персонализирано разделяне"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Разделяне на екрана нагоре"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Разделяне на екрана наляво"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Разделяне на екрана надясно"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-bn/strings.xml b/packages/SystemUI/legacy/recents/res/values-bn/strings.xml
deleted file mode 100644
index b22672e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-bn/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"এক নজরে।"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> খারিজ করুন।"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> খারিজ করা হয়েছে।"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"সব সাম্প্রতিক অ্যাপ্লিকেশন খারিজ করা হয়েছে।"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> অ্যাপ্লিকেশনের তথ্য খুলুন।"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> শুরু করা হচ্ছে।"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"কোনো সাম্প্রতিক আইটেম নেই"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"আপনি সবকিছু মুছে দিয়েছেন"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"অ্যাপ্লিকেশনের তথ্য"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"স্ক্রিন পিন করা"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"খুঁজুন"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> চালু করা যায়নি।"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"নিরাপদ মোডে <xliff:g id="APP">%s</xliff:g> বন্ধ করা আছে।"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"সবগুলি মুছে দিন"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"স্প্লিট স্ক্রিন ব্যবহার করতে এখানে টেনে আনুন"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"অনুভূমিক স্প্লিট করুন"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"উল্লম্ব স্প্লিট করুন"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"কাস্টম স্প্লিট করুন"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"স্ক্রিনটি উপরের দিকে স্প্লিট করুন"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"স্ক্রিনটি বাঁদিকে স্প্লিট করুন"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"স্ক্রিনটি ডানদিকে স্প্লিট করুন"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-bs/strings.xml b/packages/SystemUI/legacy/recents/res/values-bs/strings.xml
deleted file mode 100644
index 8e149ba8..0000000
--- a/packages/SystemUI/legacy/recents/res/values-bs/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Pregled."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Odbaci aplikaciju <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikacija <xliff:g id="APP">%s</xliff:g> je odbačena."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Sve nedavno korištene aplikacije su odbačene."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otvaranje informacija o aplikaciji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Pokretanje aplikacije <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nema nedavnih stavki"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Sve ste obrisali"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informacije o aplikaciji"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"kačenje ekrana"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pretraži"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Aplikacija <xliff:g id="APP">%s</xliff:g> nije pokrenuta."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikacija <xliff:g id="APP">%s</xliff:g> je onemogućena u sigurnom načinu rada."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Obriši sve"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Povucite ovdje za korištenje podijeljenog ekrana"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Podjela po horizontali"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Podjela po vertikali"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Prilagođena podjela"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dijeli ekran nagore"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dijeli ekran nalijevo"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dijeli ekran nadesno"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ca/strings.xml b/packages/SystemUI/legacy/recents/res/values-ca/strings.xml
deleted file mode 100644
index fff525c..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ca/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Aplicacions recents."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Ignora <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"S\'ha ignorat <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"S\'han ignorat totes les aplicacions recents."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Obre la informació sobre l\'aplicació <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"S\'està iniciant <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No hi ha cap element recent"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Ho has esborrat tot"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informació de l\'aplicació"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"fixació de pantalla"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"cerca"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"No s\'ha pogut iniciar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"En mode segur, l\'aplicació <xliff:g id="APP">%s</xliff:g> està desactivada."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Esborra-ho tot"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arrossega-ho aquí per utilitzar la pantalla dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Divisió horitzontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Divisió vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Divisió personalitzada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Divideix la pantalla cap amunt"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Divideix la pantalla cap a l\'esquerra"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Divideix la pantalla cap a la dreta"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-cs/strings.xml b/packages/SystemUI/legacy/recents/res/values-cs/strings.xml
deleted file mode 100644
index 200f7a8..0000000
--- a/packages/SystemUI/legacy/recents/res/values-cs/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Přehled"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Zavřít aplikaci <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikace <xliff:g id="APP">%s</xliff:g> byla odebrána."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Všechny naposledy použité aplikace byly odstraněny."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otevře informace o aplikaci <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Spouštění aplikace <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Žádné nedávné položky"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Vše je vymazáno"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informace o aplikaci"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"připnutí obrazovky"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"hledat"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Aplikaci <xliff:g id="APP">%s</xliff:g> nelze spustit."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikace <xliff:g id="APP">%s</xliff:g> je v nouzovém režimu zakázána."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Vymazat vše"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Přetáhnutím sem aktivujete rozdělenou obrazovku"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Vodorovné rozdělení"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Svislé rozdělení"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Vlastní rozdělení"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Rozdělit obrazovku nahoru"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Rozdělit obrazovku vlevo"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Rozdělit obrazovku vpravo"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-da/strings.xml b/packages/SystemUI/legacy/recents/res/values-da/strings.xml
deleted file mode 100644
index 0a1690e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-da/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Oversigt."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Fjern <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> er fjernet."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alle de seneste apps er fjernet."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Åbn appoplysningerne for <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> åbnes."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ingen nye elementer"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Du har ryddet alt"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Appoplysninger"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"skærmfastholdelse"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"søg"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> kunne ikke åbnes."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> er deaktiveret i sikker tilstand."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ryd alle"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Træk hertil for at bruge opdelt skærm"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Opdel vandret"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Opdel lodret"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Opdel brugerdefineret"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Opdelt skærm øverst"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Opdelt skærm til venstre"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Opdelt skærm til højre"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-de/strings.xml b/packages/SystemUI/legacy/recents/res/values-de/strings.xml
deleted file mode 100644
index 4a089bf..0000000
--- a/packages/SystemUI/legacy/recents/res/values-de/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Übersicht."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> entfernen."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> wurde entfernt."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alle kürzlich verwendeten Apps wurden entfernt."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Infos zur <xliff:g id="APP">%s</xliff:g> App öffnen."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> wird gestartet."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Keine kürzlich verwendeten Elemente"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Du hast alles gelöscht"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"App-Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"Bildschirm anpinnen"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"Suchen"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> konnte nicht gestartet werden."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ist im abgesicherten Modus deaktiviert."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Alle löschen"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Hierher ziehen, um den Bildschirm zu teilen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Geteilt – horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Geteilt – vertikal"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Geteilt – benutzerdefiniert"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Geteilten Bildschirm oben anzeigen"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Geteilten Bildschirm links anzeigen"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Geteilten Bildschirm rechts anzeigen"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-el/strings.xml b/packages/SystemUI/legacy/recents/res/values-el/strings.xml
deleted file mode 100644
index 90baf52..0000000
--- a/packages/SystemUI/legacy/recents/res/values-el/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Επισκόπηση."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Παράβλεψη εφαρμογής <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Η εφαρμογή <xliff:g id="APP">%s</xliff:g> απορρίφθηκε."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Όλες οι πρόσφατες εφαρμογές παραβλέφθηκαν."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Άνοιγμα πληροφοριών εφαρμογής <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Έναρξη εφαρμογής <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Δεν υπάρχουν πρόσφατα στοιχεία"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Διαγράψατε όλα τα στοιχεία"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Πληροφορίες εφαρμογής"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"καρφίτσωμα οθόνης"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"αναζήτηση"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Δεν ήταν δυνατή η έναρξη της εφαρμογής <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Η εφαρμογή <xliff:g id="APP">%s</xliff:g> έχει απενεργοποιηθεί στην ασφαλή λειτουργία."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Διαγραφή όλων"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Σύρετε εδώ για να χρησιμοποιήσετε τον διαχωρισμό οθόνης"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Οριζόντιος διαχωρισμός"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Κάθετος διαχωρισμός"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Προσαρμοσμένος διαχωρισμός"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Διαχωρισμός οθόνης στην κορυφή"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Διαχωρισμός οθόνης στα αριστερά"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Διαχωρισμός οθόνης στα δεξιά"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-en-rAU/strings.xml b/packages/SystemUI/legacy/recents/res/values-en-rAU/strings.xml
deleted file mode 100644
index af1d055..0000000
--- a/packages/SystemUI/legacy/recents/res/values-en-rAU/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dismiss <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dismissed."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"All recent applications dismissed."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Open <xliff:g id="APP">%s</xliff:g> application info."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starting <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No recent items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"You\'ve cleared everything"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Application Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"screen pinning"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"search"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is disabled in safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Clear all"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Drag here to use split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Split Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Split Vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Split screen to the top"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Split screen to the left"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Split screen to the right"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-en-rCA/strings.xml b/packages/SystemUI/legacy/recents/res/values-en-rCA/strings.xml
deleted file mode 100644
index af1d055..0000000
--- a/packages/SystemUI/legacy/recents/res/values-en-rCA/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dismiss <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dismissed."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"All recent applications dismissed."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Open <xliff:g id="APP">%s</xliff:g> application info."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starting <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No recent items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"You\'ve cleared everything"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Application Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"screen pinning"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"search"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is disabled in safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Clear all"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Drag here to use split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Split Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Split Vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Split screen to the top"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Split screen to the left"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Split screen to the right"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-en-rGB/strings.xml b/packages/SystemUI/legacy/recents/res/values-en-rGB/strings.xml
deleted file mode 100644
index af1d055..0000000
--- a/packages/SystemUI/legacy/recents/res/values-en-rGB/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dismiss <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dismissed."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"All recent applications dismissed."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Open <xliff:g id="APP">%s</xliff:g> application info."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starting <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No recent items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"You\'ve cleared everything"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Application Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"screen pinning"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"search"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is disabled in safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Clear all"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Drag here to use split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Split Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Split Vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Split screen to the top"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Split screen to the left"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Split screen to the right"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-en-rIN/strings.xml b/packages/SystemUI/legacy/recents/res/values-en-rIN/strings.xml
deleted file mode 100644
index af1d055..0000000
--- a/packages/SystemUI/legacy/recents/res/values-en-rIN/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dismiss <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dismissed."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"All recent applications dismissed."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Open <xliff:g id="APP">%s</xliff:g> application info."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starting <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No recent items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"You\'ve cleared everything"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Application Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"screen pinning"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"search"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is disabled in safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Clear all"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Drag here to use split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Split Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Split Vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Split screen to the top"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Split screen to the left"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Split screen to the right"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-en-rXC/strings.xml b/packages/SystemUI/legacy/recents/res/values-en-rXC/strings.xml
deleted file mode 100644
index ceb6b13..0000000
--- a/packages/SystemUI/legacy/recents/res/values-en-rXC/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dismiss <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dismissed."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"All recent applications dismissed."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Open <xliff:g id="APP">%s</xliff:g> application info."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starting <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No recent items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"You\'ve cleared everything"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Application Info"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"screen pinning"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"search"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Could not start <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is disabled in safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Clear all"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Drag here to use split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Split Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Split Vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Split screen to the top"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Split screen to the left"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Split screen to the right"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-es-rUS/strings.xml b/packages/SystemUI/legacy/recents/res/values-es-rUS/strings.xml
deleted file mode 100644
index f212b02..0000000
--- a/packages/SystemUI/legacy/recents/res/values-es-rUS/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Recientes"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Permite descartar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Se descartó <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Se descartaron todas las aplicaciones recientes."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Permite abrir la información de la aplicación de <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iniciando <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No hay elementos recientes"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Todo borrado"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Información de la aplicación"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"Fijar pantalla"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"Buscar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"No se pudo iniciar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> está inhabilitada en modo seguro."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Borrar todo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arrastra hasta aquí para usar la pantalla dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"División horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"División vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"División personalizada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dividir pantalla en la parte superior"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dividir pantalla a la izquierda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dividir pantalla a la derecha"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-es/strings.xml b/packages/SystemUI/legacy/recents/res/values-es/strings.xml
deleted file mode 100644
index 8bcfe84..0000000
--- a/packages/SystemUI/legacy/recents/res/values-es/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Aplicaciones recientes."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Cerrar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Se ha ignorado la aplicación <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Se han ignorado todas las aplicaciones recientes."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Abre la información de la aplicación <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iniciando la aplicación <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"No hay elementos recientes"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Has borrado todo"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Información de la aplicación"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"fijar pantalla"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"buscar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"No se ha podido iniciar la aplicación <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"La aplicación <xliff:g id="APP">%s</xliff:g> se ha inhabilitado en modo seguro."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Borrar todo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arrastra el elemento hasta aquí para utilizar la pantalla dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"División horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"División vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"División personalizada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dividir la pantalla en la parte superior"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dividir la pantalla a la izquierda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dividir la pantalla a la derecha"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-et/strings.xml b/packages/SystemUI/legacy/recents/res/values-et/strings.xml
deleted file mode 100644
index c1903af..0000000
--- a/packages/SystemUI/legacy/recents/res/values-et/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Ülevaade."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Rakendusest <xliff:g id="APP">%s</xliff:g> loobumine."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Rakendusest <xliff:g id="APP">%s</xliff:g> on loobutud."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Kõikidest hiljutistest rakendustest on loobutud."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Rakenduse <xliff:g id="APP">%s</xliff:g> teabe avamine."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Rakenduse <xliff:g id="APP">%s</xliff:g> käivitamine."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Hiljutisi üksusi pole"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Olete kõik ära kustutanud"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Rakenduse teave"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ekraanikuva kinnitamine"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"otsi"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Rakendust <xliff:g id="APP">%s</xliff:g> ei saanud käivitada."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Rakendus <xliff:g id="APP">%s</xliff:g> on turvarežiimis keelatud."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Kustuta kõik"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Jagatud ekraani kasutamiseks lohistage siia"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horisontaalne poolitamine"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikaalne poolitamine"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Kohandatud poolitamine"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Poolita ekraan üles"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Poolita ekraan vasakule"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Poolita ekraan paremale"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-eu/strings.xml b/packages/SystemUI/legacy/recents/res/values-eu/strings.xml
deleted file mode 100644
index 91e250f..0000000
--- a/packages/SystemUI/legacy/recents/res/values-eu/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Ikuspegi orokorra."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Baztertu <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Baztertu da <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Baztertu dira azken aplikazio guztiak."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Ireki <xliff:g id="APP">%s</xliff:g> aplikazioari buruzko informazioa."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> abiarazten."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ez dago azkenaldi honetako ezer"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Dena garbitu duzu"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Aplikazioaren informazioa"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"pantaila-ainguratzea"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"bilatu"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Ezin izan da abiarazi <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> desgaituta dago modu seguruan."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Garbitu guztiak"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arrastatu hona pantaila zatitzeko"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Zatitze horizontala"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Zatitze bertikala"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Zatitze pertsonalizatua"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Zatitu pantaila eta ezarri goian"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Zatitu pantaila eta ezarri ezkerrean"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Zatitu pantaila eta ezarri eskuinean"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-fa/strings.xml b/packages/SystemUI/legacy/recents/res/values-fa/strings.xml
deleted file mode 100644
index 61e87c1..0000000
--- a/packages/SystemUI/legacy/recents/res/values-fa/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"نمای کلی."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"رد کردن <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> نادیده گرفته شد."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"همه برنامههای اخیر رد شدند."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"باز کردن اطلاعات برنامه <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> درحال شروع به کار است."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"بدون موارد اخیر"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"همهچیز را پاک کردهاید"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"اطلاعات برنامه"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"پین کردن صفحه"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"جستجو"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> شروع نشد."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> در حالت ایمن غیرفعال است."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"پاک کردن همه"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"برای استفاده از تقسیم صفحه، به اینجا بکشید"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"تقسیم افقی"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"تقسیم عمودی"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"سفارشی کردن تقسیم"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"تقسیم کردن صفحه به بالا"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"تقسیم کردن صفحه به چپ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"تقسیم کردن صفحه به راست"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-fi/strings.xml b/packages/SystemUI/legacy/recents/res/values-fi/strings.xml
deleted file mode 100644
index bf2e461..0000000
--- a/packages/SystemUI/legacy/recents/res/values-fi/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Viimeisimmät"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Hylkää <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> hylättiin."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Kaikki viimeisimmät sovellukset on hylätty."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Avaa sovelluksen <xliff:g id="APP">%s</xliff:g> tiedot."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Käynnistetään <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ei viimeaikaisia kohteita"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Kaikki on hoidettu"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Sovellustiedot"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"näytön kiinnitys"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"haku"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ei käynnistynyt."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> on poistettu käytöstä vikasietotilassa."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Poista kaikki"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Jaa näyttö vetämällä tähän."</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Vaakasuuntainen jako"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Pystysuuntainen jako"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Oma jako"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Jaa näyttö ylös"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Jaa näyttö vasemmalle"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Jaa näyttö oikealle"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-fr-rCA/strings.xml b/packages/SystemUI/legacy/recents/res/values-fr-rCA/strings.xml
deleted file mode 100644
index e60727e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-fr-rCA/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Aperçu"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Supprimer <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> supprimée."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Toutes les applications récentes ont été supprimées."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Ouvre les détails de l\'application <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Lancement de <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Aucun élément récent"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Vous avez tout effacé"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Détails de l\'application"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"épinglage d\'écran"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"rechercher"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Impossible de lancer <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> est désactivée en mode sans échec."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Tout effacer"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Glissez l\'élément ici pour utiliser l\'écran partagé"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Séparation horizontale"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Séparation verticale"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Séparation personnalisée"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Écran partagé dans le haut"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Écran partagé à la gauche"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Écran partagé à la droite"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-fr/strings.xml b/packages/SystemUI/legacy/recents/res/values-fr/strings.xml
deleted file mode 100644
index 5b0d611..0000000
--- a/packages/SystemUI/legacy/recents/res/values-fr/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Aperçu"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Supprimer l\'application <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Application <xliff:g id="APP">%s</xliff:g> supprimée."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Toutes les applications récentes ont été supprimées."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Ouvre les informations sur l\'application <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Lancement de l\'application <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Aucun élément récent"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Vous avez tout effacé"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informations sur l\'application"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"épinglage d\'écran"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"rechercher"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Impossible de lancer l\'application <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"L\'application <xliff:g id="APP">%s</xliff:g> est désactivée en mode sécurisé."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Tout fermer"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Faire glisser ici pour utiliser l\'écran partagé"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Séparation horizontale"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Séparation verticale"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Séparation personnalisée"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Partager l\'écran en haut"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Partager l\'écran sur la gauche"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Partager l\'écran sur la droite"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-gl/strings.xml b/packages/SystemUI/legacy/recents/res/values-gl/strings.xml
deleted file mode 100644
index 008c776..0000000
--- a/packages/SystemUI/legacy/recents/res/values-gl/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Visión xeral."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Rexeita <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Rexeitouse <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Rexeitáronse todas as aplicacións recentes."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Abre a información da aplicación <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iniciando <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Non hai elementos recentes"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Borraches todo"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Información da aplicación"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"fixación de pantalla"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"buscar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Non se puido iniciar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"A aplicación <xliff:g id="APP">%s</xliff:g> está desactivada no modo seguro."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Borrar todo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arrastra aquí para usar a pantalla dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Dividir horizontalmente"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Dividir verticalmente"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Dividir de xeito personalizado"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dividir pantalla arriba"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dividir pantalla á esquerda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dividir pantalla á dereita"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-gu/strings.xml b/packages/SystemUI/legacy/recents/res/values-gu/strings.xml
deleted file mode 100644
index 33dc7e8..0000000
--- a/packages/SystemUI/legacy/recents/res/values-gu/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ઝલક."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> કાઢી નાખો."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> કાઢી નાખી."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"તાજેતરની બધી ઍપ્લિકેશનો કાઢી નાખવામાં આવી."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g>ની ઍપ્લિકેશન માહિતી ખોલો."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>ને શરૂ કરી રહ્યાં છીએ."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"તાજેતરની કોઈ આઇટમ નથી"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"તમે બધું સાફ કર્યું"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ઍપ્લિકેશનની માહિતી"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"સ્ક્રીન પિનિંગ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"શોધો"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>ને શરૂ કરી શકાઈ નથી."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"સુરક્ષિત મોડમાં <xliff:g id="APP">%s</xliff:g>ને બંધ કરવામાં આવી છે."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"બધું સાફ કરો"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"વિભાજિત સ્ક્રીનનો ઉપયોગ કરવા માટે અહીં ખેંચો"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"સ્ક્રીનને આડી વિભાજિત કરો"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"સ્ક્રીનને ઊભી વિભાજિત કરો"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"સ્ક્રીનને કસ્ટમ વિભાજિત કરો"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"સ્ક્રીનને ઉપરની તરફ વિભાજિત કરો"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"સ્ક્રીનને ડાબી તરફ વિભાજિત કરો"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"સ્ક્રીનને જમણી તરફ વિભાજિત કરો"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-hi/strings.xml b/packages/SystemUI/legacy/recents/res/values-hi/strings.xml
deleted file mode 100644
index 3f19f33..0000000
--- a/packages/SystemUI/legacy/recents/res/values-hi/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"खास जानकारी."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> को खारिज करें."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> खारिज किया गया."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"हाल के सभी ऐप्लिकेशन खारिज कर दिए गए हैं."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ऐप्लिकेशन की जानकारी खोलें."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> शुरू किया जा रहा है."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"हाल का कोई आइटम नहीं है"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"आपने सब कुछ हटा दिया है"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ऐप्लिकेशन की जानकारी"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"स्क्रीन पिन करना"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"खोजें"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> शुरू नहीं किया जा सका."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> को सुरक्षित-मोड में बंद किया गया."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"सभी ऐप्लिकेशन बंद करें"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"स्क्रीन को दो हिस्सों में बाँटने (स्प्लिट स्क्रीन) के लिए यहां से खींचें और छोड़ें"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"क्षैतिज रूप से दो हिस्सों में बाँटें (स्प्लिट करें)"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"लम्बवत रूप से दो हिस्सों में बाँटें (स्प्लिट करें)"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"अपने मुताबिक दो हिस्सों में बाँटें (स्प्लिट स्क्रीन करें)"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ऊपर की ओर दूसरी स्क्रीन बनाएं"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"बाईं ओर दूसरी स्क्रीन बनाएं"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"दाईं ओर दूसरी स्क्रीन बनाएं"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-hr/strings.xml b/packages/SystemUI/legacy/recents/res/values-hr/strings.xml
deleted file mode 100644
index 88926a4..0000000
--- a/packages/SystemUI/legacy/recents/res/values-hr/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Pregled."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Odbacivanje aplikacije <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Odbačena je aplikacija <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Odbačene su sve nedavne aplikacije."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otvaranje informacija o aplikaciji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Pokreće se aplikacija <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nema nedavnih stavki"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Izbrisali ste sve"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informacije o aplikaciji"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"prikačivanje zaslona"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pretraživanje"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Aplikacija <xliff:g id="APP">%s</xliff:g> nije pokrenuta."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikacija <xliff:g id="APP">%s</xliff:g> onemogućena je u sigurnom načinu."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Izbriši sve"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Povucite ovdje da biste upotrebljavali podijeljeni zaslon"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Podijeli vodoravno"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Podijeli okomito"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Podijeli prilagođeno"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Podijeli zaslon na vrhu"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Podijeli zaslon slijeva"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Podijeli zaslon zdesna"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-hu/strings.xml b/packages/SystemUI/legacy/recents/res/values-hu/strings.xml
deleted file mode 100644
index d0429e7..0000000
--- a/packages/SystemUI/legacy/recents/res/values-hu/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Áttekintés."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"A(z) <xliff:g id="APP">%s</xliff:g> elvetése."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> eltávolítva."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Az összes alkalmazás eltávolítva a nemrég használtak közül."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"A(z) <xliff:g id="APP">%s</xliff:g> alkalmazás adatainak megnyitása."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"A(z) <xliff:g id="APP">%s</xliff:g> indítása."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nincsenek mostanában használt elemek"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Mindent törölt"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Az alkalmazás adatai"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"képernyő rögzítése"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"keresés"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Nem lehet elindítani a következőt: <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"A(z) <xliff:g id="APP">%s</xliff:g> csökkentett módban le van tiltva."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Összes törlése"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Húzza ide az osztott képernyő használatához"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Osztott vízszintes"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Osztott függőleges"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Osztott egyéni"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Osztott képernyő felülre"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Osztott képernyő balra"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Osztott képernyő jobbra"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-hy/strings.xml b/packages/SystemUI/legacy/recents/res/values-hy/strings.xml
deleted file mode 100644
index c56b691..0000000
--- a/packages/SystemUI/legacy/recents/res/values-hy/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Համատեսք:"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Հեռացնել <xliff:g id="APP">%s</xliff:g> հավելվածը ցուցակից:"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> հավելվածը հեռացվել է ցուցակից:"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Բոլոր վերջին հավելվածները հեռացվել են ցուցակից:"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Բացել <xliff:g id="APP">%s</xliff:g> հավելվածի մասին տեղեկությունները"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> հավելվածը գործարկվում է:"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Այստեղ դեռ ոչինչ չկա"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Ցուցակը դատարկ է"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Հավելվածի մասին"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"էկրանի ամրացում"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"որոնում"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Չհաջողվեց գործարկել <xliff:g id="APP">%s</xliff:g> հավելվածը:"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> հավելվածը անվտանգ ռեժիմում անջատված է:"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ջնջել բոլորը"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Քաշեք այստեղ՝ էկրանի տրոհումն օգտագործելու համար"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Հորիզոնական տրոհում"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Ուղղահայաց տրոհում"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Հատուկ տրոհում"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Տրոհել էկրանը վերևից"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Տրոհել էկրանը ձախից"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Տրոհել էկրանն աջից"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-in/strings.xml b/packages/SystemUI/legacy/recents/res/values-in/strings.xml
deleted file mode 100644
index aa9dcfe..0000000
--- a/packages/SystemUI/legacy/recents/res/values-in/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Ringkasan."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Hapus <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dihapus."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Semua aplikasi yang baru dibuka telah dihapus."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Buka info aplikasi <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Memulai <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Tidak ada item yang baru dibuka"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Anda sudah menghapus semua"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Info Aplikasi"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"pin ke layar"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"telusuri"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Tidak dapat memulai <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> dinonaktifkan dalam mode aman."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Hapus semua"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Tarik ke sini untuk menggunakan layar terpisah"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Pisahkan Horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Pisahkan Vertikal"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Pisahkan Khusus"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Pisahkan layar ke atas"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Pisahkan layar ke kiri"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Pisahkan layar ke kanan"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-is/strings.xml b/packages/SystemUI/legacy/recents/res/values-is/strings.xml
deleted file mode 100644
index e0a555e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-is/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Yfirlit."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Fjarlægja <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> fjarlægt."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Öll nýleg forrit fjarlægð."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Opna forritsupplýsingar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Ræsir <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Engin nýleg atriði"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Þú hefur hreinsað allt"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Forritsupplýsingar"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"skjáfesting"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"leita"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Ekki var hægt að ræsa <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Slökkt er á <xliff:g id="APP">%s</xliff:g> í öruggri stillingu."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Hreinsa allt"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Dragðu hingað til að skipta skjánum"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Lárétt skipting"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Lóðrétt skipting"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Sérsniðin skipting"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Skipta skjá að ofanverðu"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Skipta skjá til vinstri"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Skipta skjá til hægri"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-it/strings.xml b/packages/SystemUI/legacy/recents/res/values-it/strings.xml
deleted file mode 100644
index e04d560..0000000
--- a/packages/SystemUI/legacy/recents/res/values-it/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Panoramica."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Elimina <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> eliminata."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Tutte le applicazioni recenti sono state rimosse."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Mostra informazioni sull\'applicazione <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Avvio di <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nessun elemento recente"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Hai cancellato tutto"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informazioni sull\'applicazione"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"blocco su schermo"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"cerca"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Impossibile avviare <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"L\'app <xliff:g id="APP">%s</xliff:g> è stata disattivata in modalità provvisoria."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Cancella tutto"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Trascina qui per utilizzare la modalità Schermo diviso"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Divisione in orizzontale"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Divisione in verticale"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Divisione personalizzata"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Schermo diviso in alto"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Schermo diviso a sinistra"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Schermo diviso a destra"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-iw/strings.xml b/packages/SystemUI/legacy/recents/res/values-iw/strings.xml
deleted file mode 100644
index a96c709..0000000
--- a/packages/SystemUI/legacy/recents/res/values-iw/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"סקירה כללית."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"הסרה של <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> הוסרה."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"כל האפליקציות האחרונות הוסרו."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"פתיחת מידע על האפליקציה <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"מפעיל את <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"אין פריטים אחרונים"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"מחקת הכול"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"מידע על האפליקציה"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"הקפאת מסך"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"חיפוש"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"לא ניתן היה להפעיל את <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> מושבתת במצב בטוח."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ניקוי הכול"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"יש לגרור לכאן כדי להשתמש במסך מפוצל"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"פיצול אופקי"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"פיצול אנכי"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"פיצול מותאם אישית"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"פיצול מסך למעלה"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"פיצול מסך לשמאל"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"פיצול מסך לימין"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ja/strings.xml b/packages/SystemUI/legacy/recents/res/values-ja/strings.xml
deleted file mode 100644
index 4d7524c..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ja/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"最近"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g>を削除します。"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g>を削除しました。"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"最近のアプリをすべて削除しました。"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g>のアプリ情報を開きます。"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>を開始しています。"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"最近のアイテムはありません"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"すべてのタスクを削除しました"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"アプリ情報"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"画面固定"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"検索"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>を開始できませんでした。"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>はセーフモードでは無効になります。"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"すべて消去"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"分割画面を使用するにはここにドラッグします"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"横に分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"縦に分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"分割(カスタム)"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"画面を上に分割"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"画面を左に分割"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"画面を右に分割"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ka/strings.xml b/packages/SystemUI/legacy/recents/res/values-ka/strings.xml
deleted file mode 100644
index 088388b..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ka/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"მიმოხილვა"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g>-ის დახურვა."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> დაიხურა."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ყველა ბოლოდროინდელი აპლიკაცია დაიხურა."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> აპლიკაციის ინფორმაციის გახსნა."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"მიმდინარეობს <xliff:g id="APP">%s</xliff:g>-ის გაშვება."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ბოლოდროინდელი ერთეულები არ არის"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ყველაფერი გასუფთავდა"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"აპლიკაციის ინფორმაცია"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ეკრანზე ჩამაგრება"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ძიება"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>-ის გაშვება ვერ მოხერხდა."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> გათიშულია უსაფრთხო რეჟიმში."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ყველას გასუფთავება"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ეკრანის გასაყოფად ჩავლებით გადმოიტანეთ აქ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"ჰორიზონტალური გაყოფა"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ვერტიკალური გაყოფა"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"მორგებული გაყოფა"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ეკრანის გაყოფა ზემოთ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ეკრანის გაყოფა მარცხნივ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ეკრანის გაყოფა მარჯვნივ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-kk/strings.xml b/packages/SystemUI/legacy/recents/res/values-kk/strings.xml
deleted file mode 100644
index 9d4e01c..0000000
--- a/packages/SystemUI/legacy/recents/res/values-kk/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Жалпы ақпарат."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> қолданбасын өшіру."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> өшірілді."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Барлық қолданбалар \"Соңғылар\" тізімінен өшірілді."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> қолданбасы туралы ақпаратты ашу."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> іске қосылды."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ешқандай соңғы элементтер жоқ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Барлығын өшірдіңіз"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Қолданба туралы ақпарат"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"экранды бекіту"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"іздеу"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> іске қосылмады."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> қауіпсіз режимде өшіріледі."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Барлығын өшіру"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Экранды бөлу үшін осы жерге сүйреңіз"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Көлденеңінен бөлу"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Тігінен бөлу"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Бөлу (арнаулы)"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Экранды жоғары жағынан бөлу"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Экранды сол жағынан бөлу"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Экранды оң жағынан бөлу"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-km/strings.xml b/packages/SystemUI/legacy/recents/res/values-km/strings.xml
deleted file mode 100644
index b7bfba6..0000000
--- a/packages/SystemUI/legacy/recents/res/values-km/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ទិដ្ឋភាពរួម។"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"ច្រានចោល <xliff:g id="APP">%s</xliff:g> ។"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"បានច្រានចោល <xliff:g id="APP">%s</xliff:g> ។"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"បានច្រានចោលកម្មវិធីថ្មីៗទាំងអស់។"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"បើកព័ត៌មានកម្មវិធី <xliff:g id="APP">%s</xliff:g> ។"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"កំពុងចាប់ផ្ដើម <xliff:g id="APP">%s</xliff:g> ។"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"មិនមានធាតុថ្មីៗទេ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"អ្នកបានសម្អាតអ្វីៗគ្រប់យ៉ាង"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ព័ត៌មានកម្មវិធី"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ការភ្ជាប់អេក្រង់"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ស្វែងរក"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"មិនអាចចាប់ផ្ដើម <xliff:g id="APP">%s</xliff:g> បានទេ។"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ត្រូវបានបិទដំណើរការក្នុងមុខងារសុវត្ថិភាព។"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"សម្អាតទាំងអស់"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"អូសនៅទីនេះដើម្បីប្រើអេក្រង់បំបែក"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"បំបែកផ្តេក"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"បំបែកបញ្ឈរ"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"បំបែកផ្ទាល់ខ្លួន"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"បំបែកអេក្រង់ទៅខាងលើ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"បំបែកអេក្រង់ទៅខាងឆ្វេង"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"បំបែកអេក្រង់ទៅខាងស្តាំ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-kn/strings.xml b/packages/SystemUI/legacy/recents/res/values-kn/strings.xml
deleted file mode 100644
index 84894c1..0000000
--- a/packages/SystemUI/legacy/recents/res/values-kn/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ಸಮಗ್ರ ನೋಟ."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ವಜಾಗೊಳಿಸಿ."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ವಜಾಗೊಳಿಸಲಾಗಿದೆ."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ಇತ್ತೀಚಿನ ಎಲ್ಲಾ ಆ್ಯಪ್ಗಳನ್ನು ವಜಾಗೊಳಿಸಲಾಗಿದೆ."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ಆ್ಯಪ್ ಮಾಹಿತಿ ತೆರೆಯಿರಿ."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ಪ್ರಾರಂಭಿಸಲಾಗುತ್ತಿದೆ."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ಯಾವುದೇ ಇತ್ತೀಚಿನ ಐಟಂಗಳಿಲ್ಲ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ನೀವು ಎಲ್ಲವನ್ನೂ ತೆರವುಗೊಳಿಸಿರುವಿರಿ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ಆ್ಯಪ್ ಮಾಹಿತಿ"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ಸ್ಕ್ರೀನ್ ಪಿನ್ನಿಂಗ್"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ಹುಡುಕಾಟ"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ಪ್ರಾರಂಭಿಸಲು ಸಾದ್ಯವಾಗಲಿಲ್ಲ."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ಅನ್ನು ಸುರಕ್ಷಿತ ಮೋಡ್ನಲ್ಲಿ ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಲಾಗಿದೆ."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ಎಲ್ಲವನ್ನೂ ತೆರವುಗೊಳಿಸಿ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ವಿಭಜಿತ ಸ್ಕ್ರೀನ್ ಅನ್ನು ಬಳಸಲು ಇಲ್ಲಿ ಡ್ರ್ಯಾಗ್ ಮಾಡಿ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"ಅಡ್ಡಲಾಗಿ ವಿಭಜಿಸಿದ"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ಲಂಬವಾಗಿ ವಿಭಜಿಸಿದ"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"ಕಸ್ಟಮ್ ವಿಭಜಿಸಿದ"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ಮೇಲ್ಭಾಗಕ್ಕೆ ಸ್ಕ್ರೀನ್ ಅನ್ನು ವಿಭಜಿಸಿ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ಎಡಕ್ಕೆ ಸ್ಕ್ರೀನ್ ಅನ್ನು ವಿಭಜಿಸಿ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ಬಲಕ್ಕೆ ಸ್ಕ್ರೀನ್ ಅನ್ನು ವಿಭಜಿಸಿ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ko/strings.xml b/packages/SystemUI/legacy/recents/res/values-ko/strings.xml
deleted file mode 100644
index ee856bd..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ko/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"최근 사용"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g>을(를) 닫습니다."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> 애플리케이션을 닫았습니다."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"최근 사용한 애플리케이션을 모두 닫았습니다."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> 애플리케이션 정보를 엽니다."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>을(를) 시작하는 중입니다."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"최근 항목이 없습니다."</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"모든 항목을 삭제했습니다."</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"애플리케이션 정보"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"화면 고정"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"검색"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>을(를) 시작할 수 없습니다."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>은(는) 안전 모드에서 사용 중지됩니다."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"모두 삭제"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"여기를 드래그하여 분할 화면 사용하기"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"수평 분할"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"수직 분할"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"맞춤 분할"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"위쪽으로 화면 분할"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"왼쪽으로 화면 분할"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"오른쪽으로 화면 분할"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ky/strings.xml b/packages/SystemUI/legacy/recents/res/values-ky/strings.xml
deleted file mode 100644
index 879e492..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ky/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Сереп салуу."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> колдонмосун өчүрүү."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> колдонмосу өчүрүлдү."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Акыркы колдонмолордун баары өчүрүлдү."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> колдонмосу жөнүндө маалыматты ачыңыз."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ачылууда."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Акыркы колдонмолор жок"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Баарын тазаладыңыз"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Колдонмо жөнүндө маалымат"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"экран кадоо"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"издөө"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> колдонмосу ачылган жок"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> коопсуз режиминде өчүрүлдү."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Баарын тазалоо"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Экранды бөлүү үчүн бул жерге сүйрөңүз"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Туурасынан бөлүү"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Тигинен бөлүү"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Ыңгайлаштырылган бөлүү"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Экранды өйдө жакка бөлүү"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Экранды сол жакка бөлүү"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Экранды оң жакка бөлүү"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-lo/strings.xml b/packages/SystemUI/legacy/recents/res/values-lo/strings.xml
deleted file mode 100644
index 17f56b4..0000000
--- a/packages/SystemUI/legacy/recents/res/values-lo/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ພາບຮວມ."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"ປິດ <xliff:g id="APP">%s</xliff:g> ໄວ້."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"ປິດ <xliff:g id="APP">%s</xliff:g> ແລ້ວ."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ທຸກແອັບພລິເຄຊັນບໍ່ດົນມານີ້ຖືກປິດໄວ້ແລ້ວ."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"ເປີດຂໍ້ມູນແອັບພລິເຄຊັນ <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"ກຳລັງເປີດ <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ບໍ່ມີລາຍການຫຼ້າສຸດ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ທ່ານລຶບລ້າງທຸກຢ່າງແລ້ວ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ຂໍ້ມູນແອັບພລິເຄຊັນ"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ການປັກໝຸດໜ້າຈໍ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ຊອກຫາ"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"ບໍ່ສາມາດເລີ່ມ <xliff:g id="APP">%s</xliff:g> ໄດ້."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ຖືກປິດໃຊ້ໃນໂໝດຄວາມມປອດໄພ."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ລຶບລ້າງທັງໝົດ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ລາກມາບ່ອນນີ້ເພື່ອໃຊ້ການແບ່ງໜ້າຈໍ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"ການແຍກລວງຂວາງ"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ການແຍກລວງຕັ້ງ"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"ການແຍກກຳນົດເອງ"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ແຍກໜ້າຈໍໄປທາງເທິງ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ແຍກໜ້າຈໍໄປທາງຊ້າຍ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ແຍກໜ້າຈໍໄປທາງຂວາ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-lt/strings.xml b/packages/SystemUI/legacy/recents/res/values-lt/strings.xml
deleted file mode 100644
index 4a9eb83..0000000
--- a/packages/SystemUI/legacy/recents/res/values-lt/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Apžvalga."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Atsisakyti programos „<xliff:g id="APP">%s</xliff:g>“."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Atsisakyta programos „<xliff:g id="APP">%s</xliff:g>“."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Atsisakyta visų naujausių programų."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Atidaryti programos „<xliff:g id="APP">%s</xliff:g>“ informaciją."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Paleidžiama programa „<xliff:g id="APP">%s</xliff:g>“."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nėra jokių naujausių elementų"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Viską išvalėte"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Programos informacija"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ekrano prisegimas"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ieškoti"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Nepavyko paleisti programos „<xliff:g id="APP">%s</xliff:g>“."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Programa „<xliff:g id="APP">%s</xliff:g>“ išjungta saugos režimu."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Išvalyti viską"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Vilkite čia, kad naudotumėte skaidytą ekraną"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horizontalus skaidymas"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikalus skaidymas"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Tinkintas skaidymas"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Skaidyti ekraną į viršų"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Skaidyti ekraną į kairę"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Skaidyti ekraną į dešinę"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-lv/strings.xml b/packages/SystemUI/legacy/recents/res/values-lv/strings.xml
deleted file mode 100644
index 7d87e00..0000000
--- a/packages/SystemUI/legacy/recents/res/values-lv/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Pārskats."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Nerādīt lietotni <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Vairs netiek rādīta lietotne <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Vairs netiek rādīta neviena nesen izmantotā lietojumprogramma."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Atveriet lietojumprogrammas <xliff:g id="APP">%s</xliff:g> informāciju."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Notiek lietotnes <xliff:g id="APP">%s</xliff:g> palaišana."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nav nesenu vienumu"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Visi uzdevumi ir notīrīti"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Lietojumprogrammas informācija"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"Piespraust ekrānu"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"Meklēt"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Nevarēja palaist lietotni <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Lietotne <xliff:g id="APP">%s</xliff:g> ir atspējota drošajā režīmā."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Notīrīt visu"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Velciet šeit, lai izmantotu ekrāna sadalīšanu"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horizontāls dalījums"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikāls dalījums"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Pielāgots dalījums"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Sadalīt ekrānu augšdaļā"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Sadalīt ekrānu kreisajā pusē"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Sadalīt ekrānu labajā pusē"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-mk/strings.xml b/packages/SystemUI/legacy/recents/res/values-mk/strings.xml
deleted file mode 100644
index d8ced0b..0000000
--- a/packages/SystemUI/legacy/recents/res/values-mk/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Преглед."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Отфрлете ја <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> е отфрлена."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Сите неодамнешни апликации се отфрлени."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Отворете информации за апликацијата <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Се стартува <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Нема неодамнешни ставки"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Избришавте сѐ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Информации за апликацијата"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"прикачување екран"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"пребарувај"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> не можеше да се стартува."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> е оневозможена во безбеден режим."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Избриши сѐ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Повлечете тука за да користите поделен екран"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Подели хоризонтално"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Подели вертикално"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Подели приспособено"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Подели го екранот во горниот дел"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Подели го екранот на левата страна"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Подели го екранот на десната страна"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ml/strings.xml b/packages/SystemUI/legacy/recents/res/values-ml/strings.xml
deleted file mode 100644
index 6dd797e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ml/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"അവലോകനം."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ഡിസ്മിസ് ചെയ്യുക."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ഡിസ്മിസ് ചെയ്തു."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"അടുത്തിടെയുള്ള എല്ലാ ആപ്പുകളും ഡിസ്മിസ് ചെയ്തു."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ആപ്പ് വിവരങ്ങൾ തുറക്കുക."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ആരംഭിക്കുന്നു."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"സമീപകാല ഇനങ്ങൾ ഒന്നുമില്ല"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"നിങ്ങൾ എല്ലാം മായ്ച്ചിരിക്കുന്നു"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ആപ്പ് വിവരങ്ങൾ"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"സ്ക്രീൻ പിൻ ചെയ്യൽ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"തിരയുക"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ആരംഭിക്കാനായില്ല"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"സുരക്ഷിത മോഡിൽ <xliff:g id="APP">%s</xliff:g> പ്രവർത്തനരഹിതമാക്കിയിരിക്കുന്നു."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"എല്ലാം മായ്ക്കുക"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"സ്പ്ലിറ്റ് സ്ക്രീൻ ഉപയോഗിക്കാൻ, ഇവിടെ വലിച്ചിടുക"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"തിരശ്ചീനമായി സ്പ്ലിറ്റ് ചെയ്യുക"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ലംബമായി സ്പ്ലിറ്റ് ചെയ്യുക"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"ഇഷ്ടാനുസൃതമായി സ്പ്ലിറ്റ് ചെയ്യുക"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"സ്ക്രീൻ മുകളിലോട്ട് സ്പ്ലിറ്റ് ചെയ്യുക"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"സ്ക്രീൻ ഇടത്തോട്ട് സ്പ്ലിറ്റ് ചെയ്യുക"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"സ്ക്രീൻ വലത്തോട്ട് സ്പ്ലിറ്റ് ചെയ്യുക"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-mn/strings.xml b/packages/SystemUI/legacy/recents/res/values-mn/strings.xml
deleted file mode 100644
index 205f56c..0000000
--- a/packages/SystemUI/legacy/recents/res/values-mn/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Тойм."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g>-г үл хэрэгсэнэ үү."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g>-г үл хэрэгссэн."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Саяхны бүх аппыг үл хэрэгссэн."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> аппын мэдээллийг нээнэ үү."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>-г эхлүүлж байна."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Саяхны зүйлс алга"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Та бүгдийг нь устгасан"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Аппын мэдээлэл"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"дэлгэц тогтоох"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"хайх"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>-г эхлүүлж чадсангүй."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>-г аюулгүй горимд идэвхгүй болгосон."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Бүгдийг устгах"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Хуваасан дэлгэцийг ашиглахын тулд энд чирэх"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Хэвтээ чиглэлд хуваах"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Босоо чиглэлд хуваах"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Хүссэн хэлбэрээр хуваах"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Дэлгэцийг дээд хэсэгт хуваах"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Дэлгэцийг зүүн хэсэгт хуваах"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Дэлгэцийг баруун хэсэгт хуваах"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-mr/strings.xml b/packages/SystemUI/legacy/recents/res/values-mr/strings.xml
deleted file mode 100644
index 51bce6d..0000000
--- a/packages/SystemUI/legacy/recents/res/values-mr/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"अवलोकन."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> डिसमिस करा."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> डिसमिस केले"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"अलीकडील सर्व अॅप्लिकेशन डिसमिस झाले."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> अॅप्लिकेशन माहिती उघडा."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> सुरू करत आहे."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"कोणतेही अलीकडील आयटम नाहीत"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"तुम्ही सर्वकाही साफ केले"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"अॅप्लिकेशन माहिती"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"स्क्रीन पिन करणे"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"शोधा"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> सुरू करता आले नाही."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> सुरक्षित मोडमध्ये बंद केले आहे."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"सर्व साफ करा"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"स्प्लिट स्क्रीन वापर करण्यासाठी येथे ड्रॅग करा"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"आडवे स्प्लिट करा"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"उभे स्प्लिट करा"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"कस्टम स्प्लिट करा"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"स्क्रीन वर स्प्लिट करा"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"स्क्रीन डावीकडे स्प्लिट करा"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"स्क्रीन उजवीकडे स्प्लिट करा"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ms/strings.xml b/packages/SystemUI/legacy/recents/res/values-ms/strings.xml
deleted file mode 100644
index ae4461d..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ms/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Ikhtisar."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Ketepikan <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> diketepikan."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Semua aplikasi terbaharu diketepikan."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Buka maklumat aplikasi <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Memulakan <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Tiada item terbaharu"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Anda telah mengetepikan semua item"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Maklumat Aplikasi"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"penyematan skrin"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"cari"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Tidak dapat memulakan <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> dilumpuhkan dalam mod selamat."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Kosongkan semua"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Seret ke sini untuk menggunakan skrin pisah"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Pisah Mendatar"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Pisah Menegak"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Pisah Tersuai"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Pisahkan skrin ke atas"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Pisahkan skrin ke kiri"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Pisahkan skrin ke kanan"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-my/strings.xml b/packages/SystemUI/legacy/recents/res/values-my/strings.xml
deleted file mode 100644
index 7b5870e1..0000000
--- a/packages/SystemUI/legacy/recents/res/values-my/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"အနှစ်ချုပ်။"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ကို ပယ်မည်။"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ကို ဖယ်ထုတ်ထားသည်။"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"လတ်တလော အပလီကေးရှင်းအားလုံး ဖယ်ထုတ်ထားသည်။"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> အပလီကေးရှင်း အချက်အလက်ကို ဖွင့်မည်။"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ကို စတင်နေသည်။"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"လတ်တလော ဖွင့်ထားသည်များ မရှိပါ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"အားလုံးကို ဖယ်ရှားပြီးပါပြီ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"အပလီကေးရှင်း အချက်အလက်"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"မျက်နှာပြင် ပင်ထိုးမှု"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ရှာရန်"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ကို စတင်၍ မရပါ။"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"အန္တရာယ်ကင်းမှု စနစ်တွင် <xliff:g id="APP">%s</xliff:g> ကို ပိတ်ထားပါသည်။"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"အားလုံး ဖယ်ရှားရန်"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"မျက်နှာပြင် ခွဲ၍ပြသခြင်းကို အသုံးပြုရန် ဤနေရာသို့ ဖိဆွဲပါ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"အလျားလိုက် ခွဲရန်"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ဒေါင်လိုက် ခွဲရန်"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"စိတ်ကြိုက် ခွဲရန်"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"မျက်နှာပြင်ကို အပေါ်သို့ ခွဲရန်"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"မျက်နှာပြင်ကို ဘယ်ဘက်သို့ ခွဲရန်"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"မျက်နှာပြင်ကို ညာဘက်သို့ ခွဲရန်"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-nb/strings.xml b/packages/SystemUI/legacy/recents/res/values-nb/strings.xml
deleted file mode 100644
index 176986a..0000000
--- a/packages/SystemUI/legacy/recents/res/values-nb/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Oversikt."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Avvis <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> er avvist."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alle nylig brukte apper er avvist."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Åpne appinformasjonen for <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Starter <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ingen nylige elementer"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Du har fjernet alt"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Appinformasjon"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"én-appsmodus"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"søk"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Kunne ikke starte <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> er slått av i sikker modus."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Fjern alt"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Dra hit for å bruke delt skjerm"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Del horisontalt"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Del vertikalt"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Del tilpasset"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Delt skjerm øverst"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Delt skjerm til venstre"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Delt skjerm til høyre"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ne/strings.xml b/packages/SystemUI/legacy/recents/res/values-ne/strings.xml
deleted file mode 100644
index 0113833..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ne/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"परिदृश्य।"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> खारेज गर्नुहोस्।"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> खारेज गरिएको छ।"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"हालका सबै अनुप्रयोगहरू खारेज गरियो।"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> अनुप्रयोग सम्बन्धी जानकारी खोल्नुहोस्।"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> सुरु गर्दै।"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"हालसालैको कुनै पनि वस्तु छैन"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"तपाईंले सबै कुरा खाली गर्नुभएको छ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"अनुप्रयोगको जानकारी"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"स्क्रिन पिनिसङ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"खोज्नुहोस्"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> सुरु गर्न सकिएन।"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> लाई सुरक्षित मोडमा असक्षम पारिएको छ।"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"सबै हटाउनुहोस्"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"विभाजित स्क्रिनको प्रयोग गर्न यहाँ तान्नुहोस्"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"तेर्सो रूपमा विभाजन गर्नुहोस्"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ठाडो रूपमा विभाजन गर्नुहोस्"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"आफू अनुकूल विभाजन गर्नुहोस्"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"विभाजित स्क्रिन शीर्ष स्थानमा राख्नुहोस्"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"विभाजित स्क्रिन बायाँतर्फ राख्नुहोस्"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"विभाजित स्क्रिन दायाँतर्फ राख्नुहोस्"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-nl/strings.xml b/packages/SystemUI/legacy/recents/res/values-nl/strings.xml
deleted file mode 100644
index 9714022..0000000
--- a/packages/SystemUI/legacy/recents/res/values-nl/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overzicht."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> sluiten."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> verwijderd."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alle recente apps gesloten."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"App-gegevens voor <xliff:g id="APP">%s</xliff:g> openen."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> starten."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Geen recente items"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Je hebt alles gewist"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"App-informatie"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"scherm vastzetten"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"zoeken"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Kan <xliff:g id="APP">%s</xliff:g> niet starten."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> is uitgeschakeld in de veilige modus"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Alles wissen"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Sleep hier naartoe om het scherm te splitsen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horizontaal splitsen"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Verticaal splitsen"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Aangepast splitsen"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Scherm bovenaan gesplitst"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Scherm links gesplitst"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Scherm rechts gesplitst"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-or/strings.xml b/packages/SystemUI/legacy/recents/res/values-or/strings.xml
deleted file mode 100644
index 7ffcc94..0000000
--- a/packages/SystemUI/legacy/recents/res/values-or/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ସଂକ୍ଷିପ୍ତ ବିବରଣୀ"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ଖାରଜ।"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ଖାରଜ କରିଦିଆଗଲା।"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ସମସ୍ତ ସମ୍ପ୍ରତି ଆପ୍ଲିକେସନ୍ଗୁଡ଼ିକ ଖାରଜ କରାଯାଇଛି।"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ଆପ୍ଲିକେସନ୍ ସୂଚନା ଖୋଲନ୍ତୁ।"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ଆରମ୍ଭ ହେଉଛି।"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"କୌଣସି ସାମ୍ପ୍ରତିକ ଆଇଟମ୍ ନାହିଁ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ଆପଣ ସୁବୁକିଛି ଖାଲି କରିଦେଇଛନ୍ତି"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ଆପ୍ଲିକେସନ୍ ସୂଚନା"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ସ୍କ୍ରିନ୍ ଲକ୍"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ଖୋଜନ୍ତୁ"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> କୁ ଆରମ୍ଭ କରାଯାଇପାରିଲା ନାହିଁ।"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ସୁରକ୍ଷିତ-ମୋଡ୍ରେ ଅକ୍ଷମ ଅଟେ।"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ସବୁ ଖାଲି କରନ୍ତୁ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ସ୍ପ୍ଲିଟ୍ ସ୍କ୍ରିନ୍ ବ୍ୟବହାର କରିବା ପାଇଁ ଏଠାକୁ ଡ୍ରାଗ୍ କରନ୍ତୁ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"ଭୂସମାନ୍ତରଭାବରେ ଭାଗ କରନ୍ତୁ"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ଭୂଲମ୍ବଭାବରେ ଭାଗ କରନ୍ତୁ"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"କଷ୍ଟମ୍ କରି ଭାଗ କରନ୍ତୁ"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ସ୍କ୍ରିନ୍କୁ ଉପର ଆଡ଼କୁ ଭାଗ କରନ୍ତୁ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ସ୍କ୍ରିନ୍କୁ ବାମ ଆଡ଼କୁ ଭାଗ କରନ୍ତୁ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ସ୍କ୍ରିନ୍କୁ ଡାହାଣ ଆଡ଼କୁ ଭାଗ କରନ୍ତୁ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-pa/strings.xml b/packages/SystemUI/legacy/recents/res/values-pa/strings.xml
deleted file mode 100644
index 4608561..0000000
--- a/packages/SystemUI/legacy/recents/res/values-pa/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ਰੂਪ-ਰੇਖਾ।"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ਨੂੰ ਖਾਰਜ ਕਰੋ।"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ਖਾਰਜ ਕੀਤੀ ਗਈ।"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ਸਾਰੀਆਂ ਹਾਲੀਆ ਐਪਲੀਕੇਸ਼ਨਾਂ ਖਾਰਜ ਕੀਤੀਆਂ ਗਈਆਂ।"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ਐਪਲੀਕੇਸ਼ਨਾਂ ਜਾਣਕਾਰੀ ਖੋਲ੍ਹੋ।"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ਚਾਲੂ ਕੀਤੀ ਜਾ ਰਹੀ ਹੈ।"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ਕੋਈ ਹਾਲੀਆ ਆਈਟਮਾਂ ਨਹੀਂ"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ਤੁਸੀਂ ਸਭ ਕੁਝ ਸਾਫ਼ ਕਰ ਦਿੱਤਾ ਹੈ"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ਐਪਲੀਕੇਸ਼ਨ ਜਾਣਕਾਰੀ"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ਸਕ੍ਰੀਨ ਪਿਨਿੰਗ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ਖੋਜ"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ਨੂੰ ਚਾਲੂ ਨਹੀਂ ਕਰ ਸਕੇ।"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ਨੂੰ ਸੁਰੱਖਿਅਤ-ਮੋਡ ਵਿੱਚ ਬੰਦ ਕੀਤਾ ਗਿਆ ਹੈ।"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ਸਭ ਕਲੀਅਰ ਕਰੋ"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ਸਪਲਿਟ ਸਕ੍ਰੀਨ ਦੀ ਵਰਤੋਂ ਕਰਨ ਲਈ ਇੱਥੇ ਘਸੀਟੋ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"ਲੇਟਵੀਂ ਵੰਡ"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"ਖੜ੍ਹਵੀਂ ਵੰਡ"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"ਵਿਉਂਤੀ ਵੰਡ"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"ਸਕ੍ਰੀਨ ਨੂੰ ਉੱਪਰ ਵੱਲ ਵੰਡੋ"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"ਸਕ੍ਰੀਨ ਨੂੰ ਖੱਬੇ ਪਾਸੇ ਵੰਡੋ"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"ਸਕ੍ਰੀਨ ਨੂੰ ਸੱਜੇ ਪਾਸੇ ਵੰਡੋ"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-pl/strings.xml b/packages/SystemUI/legacy/recents/res/values-pl/strings.xml
deleted file mode 100644
index 50b4ad0..0000000
--- a/packages/SystemUI/legacy/recents/res/values-pl/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Przegląd."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Zamknij aplikację <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikacja <xliff:g id="APP">%s</xliff:g> została zamknięta."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Wszystkie ostatnie aplikacje zostały zamknięte."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otwórz informacje o aplikacji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Uruchamiam aplikację <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Brak ostatnich elementów"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Wszystko zostało wyczyszczone"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informacje o aplikacji"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"przypinanie ekranu"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"szukaj"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Nie udało się uruchomić aplikacji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikacja <xliff:g id="APP">%s</xliff:g> została wyłączona w trybie bezpiecznym."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Wyczyść wszystko"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Przeciągnij tutaj, by podzielić ekran"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Podziel poziomo"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Podziel pionowo"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Podziel niestandardowo"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Podziel ekran u góry"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Podziel ekran z lewej"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Podziel ekran z prawej"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-pt-rBR/strings.xml b/packages/SystemUI/legacy/recents/res/values-pt-rBR/strings.xml
deleted file mode 100644
index b557ad2..0000000
--- a/packages/SystemUI/legacy/recents/res/values-pt-rBR/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Visão geral."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dispensar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dispensado."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Todos os aplicativos recentes foram dispensados."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Abre informações do aplicativo <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iniciando <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nenhum item recente"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Você limpou tudo"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informações do aplicativo"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"Fixar tela"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pesquisar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Não foi possível iniciar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"O app <xliff:g id="APP">%s</xliff:g> fica desativado no modo de segurança."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Limpar tudo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arraste aqui para usar a tela dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Divisão horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Divisão vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Divisão personalizada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dividir a tela para a parte superior"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dividir a tela para a esquerda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dividir a tela para a direita"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-pt-rPT/strings.xml b/packages/SystemUI/legacy/recents/res/values-pt-rPT/strings.xml
deleted file mode 100644
index e62e1c6..0000000
--- a/packages/SystemUI/legacy/recents/res/values-pt-rPT/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Vista geral."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Ignorar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplicação <xliff:g id="APP">%s</xliff:g> ignorada."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Todas as aplicações recentes foram ignoradas."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Abrir as informações da aplicação <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"A iniciar a aplicação <xliff:g id="APP">%s</xliff:g>…"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nenhum item recente"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Limpou tudo"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informações da aplicação"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"afixação no ecrã"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pesquisar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Não foi possível iniciar a aplicação <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"A aplicação <xliff:g id="APP">%s</xliff:g> está desativada no modo de segurança."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Limpar tudo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arraste aqui para utilizar o ecrã dividido"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Divisão horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Divisão vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Divisão personalizada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Ecrã dividido na parte superior"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Ecrã dividido à esquerda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Ecrã dividido à direita"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-pt/strings.xml b/packages/SystemUI/legacy/recents/res/values-pt/strings.xml
deleted file mode 100644
index b557ad2..0000000
--- a/packages/SystemUI/legacy/recents/res/values-pt/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Visão geral."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Dispensar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> dispensado."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Todos os aplicativos recentes foram dispensados."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Abre informações do aplicativo <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iniciando <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nenhum item recente"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Você limpou tudo"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informações do aplicativo"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"Fixar tela"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"pesquisar"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Não foi possível iniciar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"O app <xliff:g id="APP">%s</xliff:g> fica desativado no modo de segurança."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Limpar tudo"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Arraste aqui para usar a tela dividida"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Divisão horizontal"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Divisão vertical"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Divisão personalizada"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Dividir a tela para a parte superior"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Dividir a tela para a esquerda"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Dividir a tela para a direita"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ro/strings.xml b/packages/SystemUI/legacy/recents/res/values-ro/strings.xml
deleted file mode 100644
index 7f8f018..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ro/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Recente."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Închideți <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> a fost închisă."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Toate aplicațiile recente au fost închise."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Deschideți informațiile despre aplicația <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Se inițiază <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Niciun element recent"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Ați șters tot"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informații despre aplicație"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"fixare pe ecran"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"căutați"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> nu a putut porni."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplicația <xliff:g id="APP">%s</xliff:g> este dezactivată în modul sigur."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ștergeți tot"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Trageți aici pentru a folosi ecranul împărțit"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Împărțiți pe orizontală"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Împărțiți pe verticală"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Împărțiți personalizat"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Împărțiți ecranul în partea de sus"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Împărțiți ecranul la stânga"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Împărțiți ecranul la dreapta"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ru/strings.xml b/packages/SystemUI/legacy/recents/res/values-ru/strings.xml
deleted file mode 100644
index 1e988bb..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ru/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Обзор."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Удалить приложение <xliff:g id="APP">%s</xliff:g> из списка."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Приложение <xliff:g id="APP">%s</xliff:g> удалено из списка."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Все недавние приложения удалены из списка."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Открыть информацию о приложении <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Запуск приложения <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Здесь пока ничего нет."</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Список пуст."</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Сведения о приложении"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"блокировка в приложении"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"поиск"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Не удалось запустить приложение \"<xliff:g id="APP">%s</xliff:g>\"."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Приложение \"<xliff:g id="APP">%s</xliff:g>\" отключено в безопасном режиме."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Удалить все"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Перетащите сюда, чтобы разделить экран"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Разделить по горизонтали"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Разделить по вертикали"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Разделить по-другому"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Разделить экран по верхнему краю"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Разделить экран по левому краю"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Разделить экран по правому краю"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-si/strings.xml b/packages/SystemUI/legacy/recents/res/values-si/strings.xml
deleted file mode 100644
index cae8357..0000000
--- a/packages/SystemUI/legacy/recents/res/values-si/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"දළ විශ්ලේෂණය."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ඉවත ලන්න."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ඉවත දමා ඇත."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"සියලුම මෑත යෙඳුම් ඉවත ලන ලදී."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> යෙදුම් තොරතුරු විවෘත කරයි."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ආරම්භ කරමින්."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"මෑත අයිතම නැත"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"ඔබ සියලු දේ හිස් කර ඇත"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"යෙදුම් තොරතුරු"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"තිර ඇමිණීම"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"සෙවීම"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ආරම්භ කළ නොහැකි විය."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ආරක්ෂිත ප්රකාරය තුළ අබලයි."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"සියල්ල හිස් කරන්න"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"බෙදුම් තිරය භාවිත කිරීමට මෙතැනට අදින්න"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"තිරස්ව වෙන් කරන්න"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"සිරස්ව වෙන් කරන්න"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"අභිමත ලෙස වෙන් කරන්න"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"තිරය ඉහළට බෙදන්න"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"තිරය වමට බෙදන්න"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"තිරය දකුණට බෙදන්න"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sk/strings.xml b/packages/SystemUI/legacy/recents/res/values-sk/strings.xml
deleted file mode 100644
index 9c3a857..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sk/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Prehľad"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Zavrieť aplikáciu <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikácia <xliff:g id="APP">%s</xliff:g> bola zrušená."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Všetky nedávne aplikácie boli zrušené."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Otvoriť informácie o aplikácii <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Spúšťa sa aplikácia <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Žiadne nedávne položky"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Vymazali ste všetko"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informácie o aplikácii"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"pripnutie obrazovky"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"hľadať"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Aplikáciu <xliff:g id="APP">%s</xliff:g> sa nepodarilo spustiť."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikácia <xliff:g id="APP">%s</xliff:g> je v núdzovom režime zakázaná."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Vymazať všetko"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Presuňte okno sem a použite tak rozdelenú obrazovku"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Rozdeliť vodorovné"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Rozdeliť zvislé"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Rozdeliť vlastné"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Rozdelená obrazovka hore"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Rozdelená obrazovka naľavo"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Rozdelená obrazovka napravo"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sl/strings.xml b/packages/SystemUI/legacy/recents/res/values-sl/strings.xml
deleted file mode 100644
index 56b2ddb..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sl/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Pregled."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Opustitev aplikacije <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Aplikacija <xliff:g id="APP">%s</xliff:g> je bila odstranjena."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Vse nedavne aplikacije so bile opuščene."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Odpiranje podatkov o aplikaciji <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Zaganjanje aplikacije <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Ni nedavnih elementov"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Vse ste počistili"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Podatki o aplikaciji"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"pripenjanje zaslona"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"išči"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Aplikacije <xliff:g id="APP">%s</xliff:g> ni bilo mogoče zagnati."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Aplikacija <xliff:g id="APP">%s</xliff:g> je v varnem načinu onemogočena."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Počisti vse"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Povlecite sem za razdeljeni zaslon"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Razdeli vodoravno"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Razdeli navpično"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Razdeli po meri"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Razdeljen zaslon na vrhu"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Razdeljen zaslon na levi"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Razdeljen zaslon na desni"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sq/strings.xml b/packages/SystemUI/legacy/recents/res/values-sq/strings.xml
deleted file mode 100644
index 48aab37..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sq/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Përmbledhja."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Largo <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> është hequr."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Të gjitha aplikacionet e fundit u larguan."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Hap informacionin e aplikacionit <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Po nis <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Nuk ka asnjë artikull të fundit"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"I ke pastruar të gjitha"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Informacioni i aplikacionit"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"kyçja e ekranit"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"kërko"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> nuk mund të nisej."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> është i çaktivizuar në modalitetin e sigurt."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Pastroji të gjitha"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Zvarrit këtu për të përdorur ekranin e ndarë"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Horizontal i ndarë"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikal i ndarë"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"I personalizuar i ndarë"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Ndaje ekranin lart"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Ndaje ekranin në të majtë"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Ndaje ekranin në të djathtë"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sr/strings.xml b/packages/SystemUI/legacy/recents/res/values-sr/strings.xml
deleted file mode 100644
index 9d5f126..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sr/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Преглед."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Одбаците апликацију <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Апликација <xliff:g id="APP">%s</xliff:g> је одбачена."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Све недавно коришћене апликације су одбачене."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Отворите информације о апликацији <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Покреће се <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Нема недавних ставки"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Обрисали сте све"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Информације о апликацији"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"качење екрана"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"претражи"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Покретање апликације <xliff:g id="APP">%s</xliff:g> није успело."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Апликација <xliff:g id="APP">%s</xliff:g> је онемогућена у безбедном режиму."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Обриши све"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Превуците овде да бисте користили раздељени екран"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Подели хоризонтално"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Подели вертикално"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Подели прилагођено"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Подели екран нагоре"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Подели екран налево"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Подели екран надесно"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sv/strings.xml b/packages/SystemUI/legacy/recents/res/values-sv/strings.xml
deleted file mode 100644
index b2ee34f..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sv/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Översikt."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Ta bort <xliff:g id="APP">%s</xliff:g> från listan."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> togs bort från listan."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Alla appar har tagits bort från listan Senaste."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Öppna appinformation för <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Startar <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Listan är tom"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Du har tömt listan"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Appinformation"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"fästa skärmen"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"sök"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Det gick inte att starta appen <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> är inaktiverad i säkert läge."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Rensa alla"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Dra hit för att dela upp skärmen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Dela vågrätt"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Dela lodrätt"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Dela anpassat"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Delad skärm till överkanten"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Delad skärm åt vänster"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Delad skärm åt höger"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sw/strings.xml b/packages/SystemUI/legacy/recents/res/values-sw/strings.xml
deleted file mode 100644
index 49e7fb8..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sw/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Muhtasari."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Ondoa <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> imeondolewa."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Programu za hivi majuzi zimeondolewa."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Fungua maelezo kuhusu programu ya <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Inaanzisha <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Hakuna vipengee vya hivi majuzi"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Umeondoa vipengee vyote"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Maelezo ya Programu"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"kubandika kwenye skirini"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"tafuta"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Imeshindwa kuanzisha <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> imezimwa katika hali salama."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ondoa zote"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Buruta hapa ili utumie skrini iliyogawanywa"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Gawanya Mlalo"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Gawanya Wima"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Maalum Iliyogawanywa"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Gawa skrini kuelekea juu"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Gawa skrini upande wa kushoto"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Gawa skrini upande wa kulia"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-sw600dp/dimens.xml b/packages/SystemUI/legacy/recents/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 20d6670..0000000
--- a/packages/SystemUI/legacy/recents/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2012, 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.
-*/
--->
-<resources>
- <!-- The offsets the tasks animate from when recents is launched while docking -->
- <dimen name="recents_task_stack_animation_launched_while_docking_offset">192dp</dimen>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ta/strings.xml b/packages/SystemUI/legacy/recents/res/values-ta/strings.xml
deleted file mode 100644
index 91643fd..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ta/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"மேலோட்டப் பார்வை."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> ஆப்ஸை அகற்றும்."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> அகற்றப்பட்டது."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"அனைத்துச் சமீபத்திய ஆப்ஸும் அகற்றப்பட்டன."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ஆப்ஸ் பற்றிய தகவலைத் திறக்கும்."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ஆப்ஸைத் தொடங்குகிறது."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"சமீபத்தியவை எதுவுமில்லை"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"அனைத்தையும் அழித்துவிட்டீர்கள்"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ஆப்ஸ் பற்றிய தகவல்"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"திரையைப் பின் செய்"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"தேடு"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ஆப்ஸைத் தொடங்க இயலவில்லை."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"பாதுகாப்புப் பயன்முறையில் <xliff:g id="APP">%s</xliff:g> முடக்கப்பட்டது."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"அனைத்தையும் அழி"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"\'திரைப் பிரிப்பைப்\' பயன்படுத்த இங்கே இழுக்கவும்"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"கிடைமட்டமாகப் பிரி"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"செங்குத்தாகப் பிரி"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"தனிப்பயன் விருப்பத்தில் பிரி"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"திரையை மேற்புறமாகப் பிரிக்கும்"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"திரையை இடப்புறமாகப் பிரிக்கும்"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"திரையை வலப்புறமாகப் பிரிக்கும்"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-te/strings.xml b/packages/SystemUI/legacy/recents/res/values-te/strings.xml
deleted file mode 100644
index ea4e638..0000000
--- a/packages/SystemUI/legacy/recents/res/values-te/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"అవలోకనం."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g>ని తీసివేయండి."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> తీసివేయబడింది."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"అన్ని ఇటీవలి యాప్లు తీసివేయబడ్డాయి."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> యాప్ సమాచారాన్ని తెరుస్తుంది."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g>ని ప్రారంభిస్తోంది."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ఇటీవలి అంశాలు ఏవీ లేవు"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"మీరు అన్నింటినీ తీసివేసారు"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"యాప్ సమాచారం"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"స్క్రీన్కు పిన్ చేయడం"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"వెతుకు"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g>ని ప్రారంభించడం సాధ్యపడలేదు."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> సురక్షిత-మోడ్లో నిలిపివేయబడింది."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"అన్నీ తీసివేయి"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"విభజన స్క్రీన్ను ఉపయోగించడానికి ఇక్కడ లాగండి"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"అడ్డంగా విభజించు"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"నిలువుగా విభజించు"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"అనుకూలంగా విభజించు"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"స్క్రీన్ని ఎగువకు విభజించు"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"స్క్రీన్ని ఎడమ వైపుకి విభజించు"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"స్క్రీన్ని కుడి వైపుకి విభజించు"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-th/strings.xml b/packages/SystemUI/legacy/recents/res/values-th/strings.xml
deleted file mode 100644
index b88d05e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-th/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"ภาพรวม"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"ยกเลิก <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> ถูกนำออกไปแล้ว"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"ปิดแอปพลิเคชันล่าสุดทั้งหมดแล้ว"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"เปิดข้อมูลแอปพลิเคชัน <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"กำลังเริ่มต้น <xliff:g id="APP">%s</xliff:g>"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"ไม่มีรายการล่าสุด"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"คุณได้ล้างทุกอย่างแล้ว"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ข้อมูลแอปพลิเคชัน"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"การตรึงหน้าจอ"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ค้นหา"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"เริ่มใช้ <xliff:g id="APP">%s</xliff:g> ไม่ได้"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> ปิดใช้ในโหมดปลอดภัย"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"ล้างทั้งหมด"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"ลากมาที่นี่เพื่อใช้การแยกหน้าจอ"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"แยกในแนวนอน"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"แยกในแนวตั้ง"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"แยกแบบกำหนดเอง"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"แยกหน้าจอไปด้านบน"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"แยกหน้าจอไปทางซ้าย"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"แยกหน้าจอไปทางขวา"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-tl/strings.xml b/packages/SystemUI/legacy/recents/res/values-tl/strings.xml
deleted file mode 100644
index d940d4e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-tl/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Overview"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"I-dismiss ang <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Na-dismiss ang <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Na-dismiss ang lahat ng kamakailang application."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Buksan ang impormasyon ng <xliff:g id="APP">%s</xliff:g> application."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Sinisimulan ang <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Walang kamakailang item"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Na-clear mo ang lahat"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Impormasyon ng Application"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"pag-pin sa screen"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"hanapin"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Hindi masimulan ang <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Naka-disable ang <xliff:g id="APP">%s</xliff:g> sa safe-mode."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"I-clear lahat"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"I-drag dito para magamit ang split screen"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"I-split Pahalang"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"I-split Patayo"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Split Custom"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"I-split ang screen pataas"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"I-split ang screen pakaliwa"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"I-split ang screen pakanan"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-tr/strings.xml b/packages/SystemUI/legacy/recents/res/values-tr/strings.xml
deleted file mode 100644
index 982c57e..0000000
--- a/packages/SystemUI/legacy/recents/res/values-tr/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Genel Bakış."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> uygulamasını kapatır."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> kaldırıldı."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Tüm son uygulamalar kapatıldı."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> uygulama bilgilerini açar."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> başlatılıyor."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Yeni öğe yok"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Her şeyi sildiniz"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Uygulama Bilgileri"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ekran sabitleme"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"ara"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> başlatılamadı."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>, güvenli modda devre dışıdır."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Tümünü temizle"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Ekranı bölünmüş olarak kullanmak için buraya sürükleyin"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Yatay Ayırma"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Dikey Ayırma"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Özel Ayırma"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Ekranı yukarıya doğru böl"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Ekranı sola doğru böl"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Ekranı sağa doğru böl"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-uk/strings.xml b/packages/SystemUI/legacy/recents/res/values-uk/strings.xml
deleted file mode 100644
index 0c0b709..0000000
--- a/packages/SystemUI/legacy/recents/res/values-uk/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Огляд."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Закрити додаток <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Додаток <xliff:g id="APP">%s</xliff:g> закрито."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Усі останні додатки закрито."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Відкрити інформацію про додаток <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Запуск додатка <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Немає останніх елементів"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Ви очистили все"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Інформація про додаток"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"закріпити екран"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"пошук"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Не вдалося запустити додаток <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Додаток <xliff:g id="APP">%s</xliff:g> вимкнено в безпечному режимі."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Очистити все"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Перетягніть сюди, щоб розділити екран"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Розділити горизонтально"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Розділити вертикально"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Розділити (власний варіант)"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Розділити екран угору"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Розділити екран уліво"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Розділити екран управо"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-ur/strings.xml b/packages/SystemUI/legacy/recents/res/values-ur/strings.xml
deleted file mode 100644
index 46033da..0000000
--- a/packages/SystemUI/legacy/recents/res/values-ur/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"عمومی جائزہ۔"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"<xliff:g id="APP">%s</xliff:g> کو مسترد کریں۔"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> کو مسترد کر دیا گیا۔"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"سبھی حالیہ ایپلیکیشنز کو مسترد کر دیا گیا۔"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ایپلیکیشن کی معلومات کھولیں۔"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> شروع ہو رہی ہے۔"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"کوئی حالیہ آئٹم نہیں"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"آپ نے سب کچھ صاف کر دیا ہے"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"ایپلیکیشن کی معلومات"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"اسکرین کو پن کرنا"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"تلاش کریں"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> کو شروع نہیں کیا جا سکا۔"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"محفوظ موڈ میں <xliff:g id="APP">%s</xliff:g> غیر فعال ہے۔"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"سبھی کو ہٹائیں"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"اسپلٹ اسکرین استعمال کرنے کے لیے یہاں گھسیٹیں"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"بلحاظ افقی تقسیم کریں"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"بلحاظ عمودی تقسیم کریں"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"بلحاظ حسب ضرورت تقسیم کریں"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"اسکرین کو اوپر کی جانب تقسیم کریں"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"اسکرین کو بائیں جانب تقسیم کریں"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"اسکرین کو دائیں جانب تقسیم کریں"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-uz/strings.xml b/packages/SystemUI/legacy/recents/res/values-uz/strings.xml
deleted file mode 100644
index 6f8b153..0000000
--- a/packages/SystemUI/legacy/recents/res/values-uz/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Umumiy nazar."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Olib tashlash: <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"<xliff:g id="APP">%s</xliff:g> olib tashlangan."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Yaqinda ishlatilgan barcha ilovalar olib tashlandi."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"<xliff:g id="APP">%s</xliff:g> ilovasi haqidagi axborotlarni ochadi."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"<xliff:g id="APP">%s</xliff:g> ishga tushirilmoqda."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Yaqinda ishlatilgan ilovalar yoʻq"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Hammasi tozalandi"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Ilova haqida axborot"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ekranni mahkamlash"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"qidiruv"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"<xliff:g id="APP">%s</xliff:g> ilovasi ishga tushmadi."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"Xavfsiz rejimda <xliff:g id="APP">%s</xliff:g> ilovasi yopildi."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Ha"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Ekranni boʻlish xususiyatidan foydalanish uchun bu yerga torting"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Gorizontal yoʻnalishda boʻlish"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Vertikal yoʻnalishda boʻlish"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Boshqa usulda boʻlish"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Ekranni tepaga qadash"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Ekranni chap tomonga qadash"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Ekranni oʻng tomonga qadash"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-vi/strings.xml b/packages/SystemUI/legacy/recents/res/values-vi/strings.xml
deleted file mode 100644
index aefeae9..0000000
--- a/packages/SystemUI/legacy/recents/res/values-vi/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Tổng quan."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Loại bỏ <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"Đã loại bỏ <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Đã loại bỏ tất cả các ứng dụng gần đây."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Mở thông tin ứng dụng <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Khởi động <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Không có mục gần đây nào"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Bạn đã xóa mọi nội dung"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Thông tin ứng dụng"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"khóa màn hình"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"tìm kiếm"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Không thể khởi động <xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g> bị tắt ở chế độ an toàn."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Xóa tất cả"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Kéo vào đây để sử dụng chế độ chia đôi màn hình"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Chia ngang"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Phân tách dọc"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Tùy chỉnh phân tách"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Chia đôi màn hình lên trên"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Chia đôi màn hình sang trái"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Chia đôi màn hình sang phải"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-zh-rCN/strings.xml b/packages/SystemUI/legacy/recents/res/values-zh-rCN/strings.xml
deleted file mode 100644
index 993bfae..0000000
--- a/packages/SystemUI/legacy/recents/res/values-zh-rCN/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"概览。"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"移除<xliff:g id="APP">%s</xliff:g>。"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"已移除<xliff:g id="APP">%s</xliff:g>"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"已关闭所有最近用过的应用。"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"打开<xliff:g id="APP">%s</xliff:g>应用信息。"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"正在启动<xliff:g id="APP">%s</xliff:g>。"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"近期没有任何内容"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"您已清除所有内容"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"应用信息"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"固定屏幕"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"搜索"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"无法启动<xliff:g id="APP">%s</xliff:g>。"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"<xliff:g id="APP">%s</xliff:g>已在安全模式下停用。"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"全部清除"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"拖动到此处即可使用分屏功能"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"水平分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"垂直分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"自定义分割"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"将屏幕分隔线移到上方"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"将屏幕分隔线移到左侧"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"将屏幕分隔线移到右侧"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-zh-rHK/strings.xml b/packages/SystemUI/legacy/recents/res/values-zh-rHK/strings.xml
deleted file mode 100644
index b93d246..0000000
--- a/packages/SystemUI/legacy/recents/res/values-zh-rHK/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"概覽。"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"關閉「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"「<xliff:g id="APP">%s</xliff:g>」已關閉。"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"所有最近使用的應用程式均已關閉。"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"開啟「<xliff:g id="APP">%s</xliff:g>」應用程式的資料。"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"正在啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"最近沒有任何項目"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"您已清除所有工作"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"應用程式資料"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"螢幕固定"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"搜尋"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"無法啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"「<xliff:g id="APP">%s</xliff:g>」在安全模式下為停用狀態。"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"全部清除"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"拖曳這裡即可分割螢幕"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"水平分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"垂直分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"自訂分割"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"將分割畫面顯示喺頂部"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"將分割畫面顯示喺左邊"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"將分割畫面顯示喺右邊"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-zh-rTW/strings.xml b/packages/SystemUI/legacy/recents/res/values-zh-rTW/strings.xml
deleted file mode 100644
index 54d656d..0000000
--- a/packages/SystemUI/legacy/recents/res/values-zh-rTW/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"總覽。"</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"關閉「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"「<xliff:g id="APP">%s</xliff:g>」已關閉。"</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"最近使用的應用程式已全部關閉。"</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"開啟「<xliff:g id="APP">%s</xliff:g>」應用程式資訊。"</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"正在啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"最近沒有任何項目"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"你已清除所有工作"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"應用程式資訊"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"螢幕固定"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"搜尋"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"無法啟動「<xliff:g id="APP">%s</xliff:g>」。"</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"「<xliff:g id="APP">%s</xliff:g>」在安全模式中為停用狀態。"</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"全部清除"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"拖曳到這裡即可使用分割畫面"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"水平分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"垂直分割"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"自訂分割"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"將分割畫面顯示在頂端"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"將分割畫面顯示在左邊"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"將分割畫面顯示在右邊"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values-zu/strings.xml b/packages/SystemUI/legacy/recents/res/values-zu/strings.xml
deleted file mode 100644
index 9cbc439..0000000
--- a/packages/SystemUI/legacy/recents/res/values-zu/strings.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="accessibility_desc_recent_apps" msgid="2427210347871321373">"Buka konke."</string>
- <string name="accessibility_recents_item_will_be_dismissed" msgid="2355882496933479534">"Cashisa i-<xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_dismissed" msgid="4816790842084268400">"I-<xliff:g id="APP">%s</xliff:g> icashisiwe."</string>
- <string name="accessibility_recents_all_items_dismissed" msgid="5693205751863608046">"Zonke izinhlelo zokusebenza zakamuva zicashisiwe."</string>
- <string name="accessibility_recents_item_open_app_info" msgid="3406797323476801016">"Vula ulwazi lohlelo lokusebenza le-<xliff:g id="APP">%s</xliff:g>."</string>
- <string name="accessibility_recents_item_launched" msgid="4519918148638221791">"Iqala i-<xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_empty_message" msgid="7967713254531861311">"Azikho izinto zakamuva"</string>
- <string name="recents_empty_message_dismissed_all" msgid="1850214584987361375">"Usule yonke into"</string>
- <string name="recents_app_info_button_label" msgid="8732926607391786762">"Ulwazi lohlelo lokusebenza"</string>
- <string name="recents_lock_to_app_button_label" msgid="6087750201863853365">"ukuphina isikrini"</string>
- <string name="recents_search_bar_label" msgid="638132045925945941">"sesha"</string>
- <string name="recents_launch_error_message" msgid="9107963563503438012">"Ayikwazanga ukuqalisa i-<xliff:g id="APP">%s</xliff:g>."</string>
- <string name="recents_launch_disabled_message" msgid="826461671965217243">"I-<xliff:g id="APP">%s</xliff:g> ikhutshaziwe kumodi yokuphepha."</string>
- <string name="recents_stack_action_button_label" msgid="1974273390109881497">"Sula konke"</string>
- <string name="recents_drag_hint_message" msgid="610417221848280136">"Hudulela lapha ukuze usebenzise ukuhlukanisa kwesikrini"</string>
- <string name="recents_multistack_add_stack_dialog_split_horizontal" msgid="488987777874979435">"Hlukanisa ngokuvundlile"</string>
- <string name="recents_multistack_add_stack_dialog_split_vertical" msgid="2498375296906391117">"Hlukanisa ngokumile"</string>
- <string name="recents_multistack_add_stack_dialog_split_custom" msgid="7368405969130304811">"Hlukanisa ngokwezifiso"</string>
- <string name="recents_accessibility_split_screen_top" msgid="8773505308411722524">"Hlukanisela isikrini phezulu"</string>
- <string name="recents_accessibility_split_screen_left" msgid="722594718192007972">"Hlukanisela isikrini ngakwesokunxele"</string>
- <string name="recents_accessibility_split_screen_right" msgid="2479764030969301514">"Hlukanisela isikrini ngakwesokudla"</string>
-</resources>
diff --git a/packages/SystemUI/legacy/recents/res/values/attrs.xml b/packages/SystemUI/legacy/recents/res/values/attrs.xml
deleted file mode 100644
index ef4cd5b..0000000
--- a/packages/SystemUI/legacy/recents/res/values/attrs.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<resources>
-
- <declare-styleable name="RecentsPanelView">
- <attr name="recentItemLayout" format="reference" />
- <!-- Style for the "Clear all" button. -->
- <attr name="clearAllStyle" format="reference" />
- <attr name="clearAllBackgroundColor" format="reference" />
- </declare-styleable>
-
-</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values/colors.xml b/packages/SystemUI/legacy/recents/res/values/colors.xml
deleted file mode 100644
index 88b9b70..0000000
--- a/packages/SystemUI/legacy/recents/res/values/colors.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2010, 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.
- */
--->
-<resources>
- <!-- The disabled recents task bar background color. -->
- <color name="recents_task_bar_disabled_background_color">#ff676767</color>
- <!-- The default recents task bar background color. -->
- <color name="recents_task_bar_default_background_color">#ffe6e6e6</color>
- <!-- The default recents task view background color. -->
- <color name="recents_task_view_default_background_color">#fff3f3f3</color>
- <!-- The recents task bar light text color to be drawn on top of dark backgrounds. -->
- <color name="recents_task_bar_light_text_color">#ffeeeeee</color>
- <!-- The recents task bar dark text color to be drawn on top of light backgrounds. -->
- <color name="recents_task_bar_dark_text_color">#cc000000</color>
- <!-- The recents task bar light dismiss icon color to be drawn on top of dark backgrounds. -->
- <color name="recents_task_bar_light_icon_color">#ccffffff</color>
- <!-- The recents task bar dark dismiss icon color to be drawn on top of light backgrounds. -->
- <color name="recents_task_bar_dark_icon_color">#99000000</color>
- <!-- The lock to task button background color. -->
- <color name="recents_task_view_lock_to_app_button_background_color">#ffe6e6e6</color>
- <!-- The lock to task button foreground color. -->
- <color name="recents_task_view_lock_to_app_button_color">#ff666666</color>
- <!-- The background color for the freeform workspace. -->
- <color name="recents_freeform_workspace_bg_color">#33FFFFFF</color>
-
- <!-- The background color for clear all button on light backgrounds if not transparent. -->
- <color name="recents_clear_all_button_bg_light_color">#CCFFFFFF</color>
- <!-- The background color for clear all button on dark backgrounds if not transparent. -->
- <color name="recents_clear_all_button_bg_dark_color">#CC000000</color>
-
- <!-- Shadow color for the first pixels around the fake shadow for recents. -->
- <color name="fake_shadow_start_color">#44000000</color>
-
- <!-- Shadow color for the furthest pixels around the fake shadow for recents. -->
- <color name="fake_shadow_end_color">#03000000</color>
-</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values/config.xml b/packages/SystemUI/legacy/recents/res/values/config.xml
deleted file mode 100644
index 2ff9abf..0000000
--- a/packages/SystemUI/legacy/recents/res/values/config.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2009, 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.
-*/
--->
-
-<!-- These resources are around just to allow their values to be customized
- for different hardware and product builds. -->
-<resources>
-
- <!-- Component to be used as the recents implementation. Must implement the
- RecentsImplementation interface. This name is in the ComponentName flattened format
- (package/class) -->
- <string name="config_recentsComponent" translatable="false">com.android.systemui.recents.LegacyRecentsImpl</string>
-
- <!-- Whether recents should use hardware layers for its taskviews. This flag can be enabled
- for devices where the java drawing of round rects may be slow -->
- <bool name="config_recents_use_hardware_layers">false</bool>
-
- <!-- The number of app thumbnails we keep in memory -->
- <integer name="config_recents_max_thumbnail_count">10</integer>
-
- <!-- The number of app icons we keep in memory -->
- <integer name="config_recents_max_icon_count">20</integer>
-
- <!-- Whether to use cheap, less good looking shadows for recents -->
- <bool name="config_recents_fake_shadows">false</bool>
-
- <!-- The duration in seconds to wait before the dismiss buttons are shown. -->
- <integer name="recents_task_bar_dismiss_delay_seconds">1000</integer>
-
- <!-- The duration for animating the task decorations in after transitioning from an app. -->
- <integer name="recents_task_enter_from_app_duration">200</integer>
-
- <!-- The duration for animating the task decorations in after transitioning from an app. -->
- <integer name="recents_task_enter_from_affiliated_app_duration">125</integer>
-
- <!-- The duration for animating the task decorations out before transitioning to an app. -->
- <integer name="recents_task_exit_to_app_duration">125</integer>
-
- <!-- The min animation duration for animating the nav bar scrim in. -->
- <integer name="recents_nav_bar_scrim_enter_duration">400</integer>
-
- <!-- The animation duration for scrolling the stack to a particular item. -->
- <integer name="recents_animate_task_stack_scroll_duration">200</integer>
-
- <!-- The delay to enforce between each alt-tab key press. -->
- <integer name="recents_alt_tab_key_delay">200</integer>
-
- <!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
- <integer name="recents_svelte_level">0</integer>
-
- <!-- Recents: The relative range of visible tasks from the current scroll position
- while the stack is focused. -->
- <item name="recents_layout_focused_range_min" format="float" type="integer">-3</item>
- <item name="recents_layout_focused_range_max" format="float" type="integer">2</item>
-
- <!-- Recents: The relative range of visible tasks from the current scroll position
- while the stack is not focused. -->
- <item name="recents_layout_unfocused_range_min" format="float" type="integer">-2</item>
- <item name="recents_layout_unfocused_range_max" format="float" type="integer">2.5</item>
-</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values/dimens.xml b/packages/SystemUI/legacy/recents/res/values/dimens.xml
deleted file mode 100644
index 528610e4..0000000
--- a/packages/SystemUI/legacy/recents/res/values/dimens.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2006, 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.
-*/
--->
-<resources>
-<!-- Recents Layout -->
-
- <!-- The amount to inset the stack, specifically at the top and the other sides. We also
- don't want this to change across configurations that Recents can be opened in, so we
- define them statically for all display sizes. -->
- <dimen name="recents_layout_min_margin">16dp</dimen>
- <dimen name="recents_layout_top_margin_phone">16dp</dimen>
- <dimen name="recents_layout_top_margin_tablet">32dp</dimen>
- <dimen name="recents_layout_top_margin_tablet_xlarge">40dp</dimen>
- <dimen name="recents_layout_bottom_margin">16dp</dimen>
- <dimen name="recents_layout_side_margin_phone">16dp</dimen>
- <dimen name="recents_layout_side_margin_tablet">48dp</dimen>
- <dimen name="recents_layout_side_margin_tablet_docked">16dp</dimen>
- <dimen name="recents_layout_side_margin_tablet_xlarge">64dp</dimen>
- <dimen name="recents_layout_side_margin_tablet_xlarge_docked">16dp</dimen>
-
- <!-- The height between the top margin and the top of the focused task. -->
- <dimen name="recents_layout_top_peek_size">48dp</dimen>
- <!-- The height between the bottom margin and the top of task in front of the focused task. -->
- <dimen name="recents_layout_bottom_peek_size">56dp</dimen>
-
- <!-- The offset from the top and bottom of the stack of the focused task. The bottom offset
- will be additionally offset by the bottom system insets since it goes under the nav bar
- in certain orientations. -->
- <dimen name="recents_layout_initial_top_offset_phone_port">128dp</dimen>
- <dimen name="recents_layout_initial_bottom_offset_phone_port">80dp</dimen>
- <dimen name="recents_layout_initial_top_offset_phone_land">72dp</dimen>
- <dimen name="recents_layout_initial_bottom_offset_phone_land">72dp</dimen>
- <dimen name="recents_layout_initial_top_offset_tablet">160dp</dimen>
- <dimen name="recents_layout_initial_bottom_offset_tablet">112dp</dimen>
-
- <!-- The min/max translationZ for the tasks in the stack. -->
- <dimen name="recents_layout_z_min">3dp</dimen>
- <dimen name="recents_layout_z_max">24dp</dimen>
-
- <!-- The margin between the freeform and stack. We also don't want this to change across
- configurations that Recents can be opened in, so we define them statically for all
- display sizes. -->
- <dimen name="recents_freeform_layout_bottom_margin">16dp</dimen>
-
- <!-- The padding between each freeform task. -->
- <dimen name="recents_freeform_layout_task_padding">8dp</dimen>
-
-<!-- Recents Views -->
-
- <!-- The height of a task view bar. This has to be large enough to cover the action bar
- height in either orientation at this smallest width. -->
- <dimen name="recents_task_view_header_height">56dp</dimen>
- <dimen name="recents_task_view_header_height_tablet_land">64dp</dimen>
-
- <!-- The padding of a button in the recents task view header. -->
- <dimen name="recents_task_view_header_button_padding">16dp</dimen>
- <dimen name="recents_task_view_header_button_padding_tablet_land">20dp</dimen>
-
- <!-- The radius of the rounded corners on a task view and its shadow (which can be larger
- to create a softer corner effect. -->
- <dimen name="recents_task_view_rounded_corners_radius">2dp</dimen>
- <dimen name="recents_task_view_shadow_rounded_corners_radius">6dp</dimen>
-
- <!-- The amount of highlight to make on each task view. -->
- <dimen name="recents_task_view_highlight">1dp</dimen>
-
- <!-- The size of the lock-to-app button and its icon. -->
- <dimen name="recents_lock_to_app_size">56dp</dimen>
- <dimen name="recents_lock_to_app_icon_size">28dp</dimen>
-
- <!-- The amount of overscroll allowed when flinging to the end of the stack. -->
- <dimen name="recents_fling_overscroll_distance">24dp</dimen>
-
- <!-- The size of the drag hint text. -->
- <dimen name="recents_drag_hint_text_size">14sp</dimen>
-
- <!-- The min alpha to apply to a task affiliation group color. -->
- <item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>
-
- <!-- The amount to offset when animating into an affiliate group. -->
- <dimen name="recents_task_stack_animation_affiliate_enter_offset">32dp</dimen>
-
- <!-- The offsets the tasks animate from when recents is launched while docking -->
- <dimen name="recents_task_stack_animation_launched_while_docking_offset">144dp</dimen>
-
- <!-- The amount to translate when animating the removal of a task. -->
- <dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
-
- <!-- The alpha to apply to the recents row when it doesn't have focus -->
- <item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>
-
- <!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
- loading full resolution screenshots. -->
- <dimen name="recents_fast_fling_velocity">600dp</dimen>
-
-</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values/dimens_grid.xml b/packages/SystemUI/legacy/recents/res/values/dimens_grid.xml
deleted file mode 100644
index febf65b8..0000000
--- a/packages/SystemUI/legacy/recents/res/values/dimens_grid.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2016, 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.
-*/
--->
-<resources>
- <dimen name="recents_grid_padding_left_right">32dp</dimen>
- <dimen name="recents_grid_padding_top_bottom">150dp</dimen>
- <dimen name="recents_grid_padding_task_view">20dp</dimen>
- <dimen name="recents_grid_task_view_header_height">44dp</dimen>
- <dimen name="recents_grid_task_view_header_button_padding">8dp</dimen>
- <dimen name="recents_grid_task_view_focused_frame_thickness">8dp</dimen>
- <dimen name="recents_grid_task_view_rounded_corners_radius">4dp</dimen>
- <dimen name="recents_grid_task_view_focused_frame_rounded_corners_radius">8dp</dimen>
-</resources>
-
diff --git a/packages/SystemUI/legacy/recents/res/values/strings.xml b/packages/SystemUI/legacy/recents/res/values/strings.xml
deleted file mode 100644
index 4b44ba9..0000000
--- a/packages/SystemUI/legacy/recents/res/values/strings.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2009, 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.
- */
--->
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
- <!-- Content description for the recent apps panel (not shown on the screen). [CHAR LIMIT=NONE] -->
- <string name="accessibility_desc_recent_apps">Overview.</string>
-
- <!-- Content description to tell the user that this button will remove an application from recents -->
- <string name="accessibility_recents_item_will_be_dismissed">Dismiss <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
- <!-- Content description to tell the user an application has been removed from recents -->
- <string name="accessibility_recents_item_dismissed"><xliff:g id="app" example="Calendar">%s</xliff:g> dismissed.</string>
- <!-- Content description to tell the user all applications has been removed from recents -->
- <string name="accessibility_recents_all_items_dismissed">All recent applications dismissed.</string>
- <!-- Content description to tell the user that this button will open application info for an application in recents -->
- <string name="accessibility_recents_item_open_app_info">Open <xliff:g id="app" example="Calendar">%s</xliff:g> application info.</string>
- <!-- Content description to tell the user an application has been launched from recents -->
- <string name="accessibility_recents_item_launched">Starting <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
-
- <!-- Recents: The empty recents string. [CHAR LIMIT=NONE] -->
- <string name="recents_empty_message">No recent items</string>
- <!-- Recents: The empty recents string after dismissing all tasks. [CHAR LIMIT=NONE] -->
- <string name="recents_empty_message_dismissed_all">You\'ve cleared everything</string>
- <!-- Recents: The info panel app info button string. [CHAR LIMIT=NONE] -->
- <string name="recents_app_info_button_label">Application Info</string>
- <!-- Recents: The screen pinning button. [CHAR LIMIT=NONE] -->
- <string name="recents_lock_to_app_button_label">screen pinning</string>
- <!-- Recents: Temporary string for the button in the recents search bar. [CHAR LIMIT=NONE] -->
- <string name="recents_search_bar_label">search</string>
- <!-- Recents: Launch error string. [CHAR LIMIT=NONE] -->
- <string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
- <!-- Recents: Launch disabled string. [CHAR LIMIT=NONE] -->
- <string name="recents_launch_disabled_message"><xliff:g id="app" example="Calendar">%s</xliff:g> is disabled in safe-mode.</string>
- <!-- Recents: Stack action button string. [CHAR LIMIT=NONE] -->
- <string name="recents_stack_action_button_label">Clear all</string>
- <!-- Recents: Hint text that shows on the drop targets to start multiwindow. [CHAR LIMIT=NONE] -->
- <string name="recents_drag_hint_message">Drag here to use split screen</string>
-
- <!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
- <string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
- <!-- Recents: MultiStack add stack split vertical radio button. [CHAR LIMIT=NONE] -->
- <string name="recents_multistack_add_stack_dialog_split_vertical">Split Vertical</string>
- <!-- Recents: MultiStack add stack split custom radio button. [CHAR LIMIT=NONE] -->
- <string name="recents_multistack_add_stack_dialog_split_custom">Split Custom</string>
- <!-- Recents: Accessibility split to the top -->
- <string name="recents_accessibility_split_screen_top">Split screen to the top</string>
- <!-- Recents: Accessibility split to the left -->
- <string name="recents_accessibility_split_screen_left">Split screen to the left</string>
- <!-- Recents: Accessibility split to the right -->
- <string name="recents_accessibility_split_screen_right">Split screen to the right</string>
-
-</resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/res/values/styles.xml b/packages/SystemUI/legacy/recents/res/values/styles.xml
deleted file mode 100644
index eb16be7..0000000
--- a/packages/SystemUI/legacy/recents/res/values/styles.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 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.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
- <style name="RecentsTheme" parent="@android:style/Theme.Material">
- <!-- NoTitle -->
- <item name="android:windowNoTitle">true</item>
- <!-- Misc -->
- <item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:navigationBarColor">@android:color/transparent</item>
- <item name="android:windowDrawsSystemBarBackgrounds">true</item>
- <item name="android:windowAnimationStyle">@null</item>
- <item name="android:ambientShadowAlpha">0.35</item>
- </style>
-
- <!-- Recents theme -->
- <style name="RecentsTheme.Wallpaper">
- <item name="android:windowBackground">@*android:color/transparent</item>
- <item name="android:colorBackgroundCacheHint">@null</item>
- <item name="android:windowShowWallpaper">true</item>
- <item name="android:windowDisablePreview">true</item>
- <item name="clearAllStyle">@style/ClearAllButtonDefaultMargins</item>
- <item name="clearAllBackgroundColor">@color/recents_clear_all_button_bg_dark_color</item>
- <item name="wallpaperTextColor">@*android:color/primary_text_material_dark</item>
- <item name="wallpaperTextColorSecondary">@*android:color/secondary_text_material_dark</item>
- </style>
-
- <style name="RecentsTheme.Wallpaper.Light">
- <item name="clearAllBackgroundColor">@color/recents_clear_all_button_bg_light_color</item>
- <item name="wallpaperTextColor">@*android:color/primary_text_material_light</item>
- <item name="wallpaperTextColorSecondary">@*android:color/secondary_text_material_light</item>
- </style>
-
- <!-- Performance optimized Recents theme (no wallpaper) -->
- <style name="RecentsTheme.NoWallpaper">
- <item name="android:windowBackground">@android:color/black</item>
- <item name="wallpaperTextColor">@android:color/white</item>
- <item name="wallpaperTextColorSecondary">@android:color/white</item>
- </style>
-
- </resources>
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/Constants.java
deleted file mode 100644
index 003379f..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/Constants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-/**
- * Constants
- */
-public class Constants {
-
- // TODO: Move into RecentsMetrics
- public static class Metrics {
- // DO NOT MODIFY THE ORDER OF THESE METRICS
- public static final int DismissSourceKeyboard = 0;
- public static final int DismissSourceSwipeGesture = 1;
- public static final int DismissSourceHeaderButton = 2;
- @Deprecated
- public static final int DismissSourceHistorySwipeGesture = 3;
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsNonSystemUserCallbacks.aidl b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsNonSystemUserCallbacks.aidl
deleted file mode 100644
index 90c1099..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsNonSystemUserCallbacks.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents;
-
-import android.graphics.Rect;
-
-/**
- * Due to the fact that RecentsActivity is per-user, we need to establish an
- * interface (this) for the system user to callback to the secondary users in
- * response to UI events coming in from the system user's SystemUI.
- */
-oneway interface IRecentsNonSystemUserCallbacks {
- void preloadRecents();
- void cancelPreloadingRecents();
- void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate,
- int recentsGrowTarget);
- void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey);
- void toggleRecents(int recentsGrowTarget);
- void onConfigurationChanged();
- void splitPrimaryTask(int topTaskId, int stackCreateMode, in Rect initialBounds);
- void onDraggingInRecents(float distanceFromTop);
- void onDraggingInRecentsEnded(float velocity);
- void showCurrentUserToast(int msgResId, int msgLength);
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl
deleted file mode 100644
index e977144..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/IRecentsSystemUserCallbacks.aidl
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents;
-
-import android.graphics.Rect;
-
-/**
- * Due to the fact that RecentsActivity is per-user, we need to establish an
- * interface (this) for the non-system user to register itself for callbacks and to
- * callback to the system user to update internal state.
- */
-oneway interface IRecentsSystemUserCallbacks {
- void registerNonSystemUserCallbacks(IBinder nonSystemUserCallbacks, int userId);
-
- void updateRecentsVisibility(boolean visible);
- void startScreenPinning(int taskId);
- void sendRecentsDrawnEvent();
- void sendDockingTopTaskEvent(in Rect initialRect);
- void sendLaunchRecentsEvent();
- void sendDockedFirstAnimationFrameEvent();
- void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart);
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java
deleted file mode 100644
index a150de9..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS;
-
-import android.app.ActivityManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.hardware.display.DisplayManager;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.util.EventLog;
-import android.util.Log;
-import android.view.Display;
-import android.widget.Toast;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.EventLogConstants;
-import com.android.systemui.EventLogTags;
-import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
-import com.android.systemui.pip.PipUI;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
-import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
-import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
-import com.android.systemui.recents.events.component.ExpandPipEvent;
-import com.android.systemui.recents.events.component.HidePipMenuEvent;
-import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
-import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
-import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
-import com.android.systemui.recents.events.component.ShowUserToastEvent;
-import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
-import com.android.systemui.recents.events.ui.RecentsGrowingEvent;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.model.RecentsTaskLoader;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-import com.android.systemui.stackdivider.Divider;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * An implementation of the SystemUI recents component, which supports both system and secondary
- * users.
- */
-public class LegacyRecentsImpl implements RecentsImplementation {
-
- private final static String TAG = "Recents";
-
- public final static int EVENT_BUS_PRIORITY = 1;
- public final static int BIND_TO_SYSTEM_USER_RETRY_DELAY = 5000;
-
- public final static Set<String> RECENTS_ACTIVITIES = new HashSet<>();
- static {
- RECENTS_ACTIVITIES.add(RecentsImpl.RECENTS_ACTIVITY);
- }
-
- private static final String COUNTER_WINDOW_SUPPORTED = "window_enter_supported";
- private static final String COUNTER_WINDOW_UNSUPPORTED = "window_enter_unsupported";
- private static final String COUNTER_WINDOW_INCOMPATIBLE = "window_enter_incompatible";
-
- private static SystemServicesProxy sSystemServicesProxy;
- private static RecentsDebugFlags sDebugFlags;
- private static RecentsTaskLoader sTaskLoader;
- private static RecentsConfiguration sConfiguration;
-
- private Context mContext;
- private SysUiServiceProvider mSysUiServiceProvider;
- private Handler mHandler;
- private RecentsImpl mImpl;
-
- // Only For system user, this is the callbacks instance we return to each secondary user
- private RecentsSystemUser mSystemToUserCallbacks;
-
- // Only for secondary users, this is the callbacks instance provided by the system user to make
- // calls back
- private IRecentsSystemUserCallbacks mUserToSystemCallbacks;
-
- // The set of runnables to run after binding to the system user's service.
- private final ArrayList<Runnable> mOnConnectRunnables = new ArrayList<>();
-
- // Only for secondary users, this is the death handler for the binder from the system user
- private final IBinder.DeathRecipient mUserToSystemCallbacksDeathRcpt = new IBinder.DeathRecipient() {
- @Override
- public void binderDied() {
- mUserToSystemCallbacks = null;
- EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
- EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_SYSTEM_UNBOUND,
- sSystemServicesProxy.getProcessUser());
-
- // Retry after a fixed duration
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- registerWithSystemUser();
- }
- }, BIND_TO_SYSTEM_USER_RETRY_DELAY);
- }
- };
-
- // Only for secondary users, this is the service connection we use to connect to the system user
- private final ServiceConnection mUserToSystemServiceConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- if (service != null) {
- mUserToSystemCallbacks = IRecentsSystemUserCallbacks.Stub.asInterface(
- service);
- EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
- EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_SYSTEM_BOUND,
- sSystemServicesProxy.getProcessUser());
-
- // Listen for system user's death, so that we can reconnect later
- try {
- service.linkToDeath(mUserToSystemCallbacksDeathRcpt, 0);
- } catch (RemoteException e) {
- Log.e(TAG, "Lost connection to (System) SystemUI", e);
- }
-
- // Run each of the queued runnables
- runAndFlushOnConnectRunnables();
- }
-
- // Unbind ourselves now that we've registered our callbacks. The
- // binder to the system user are still valid at this point.
- mContext.unbindService(this);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- // Do nothing
- }
- };
-
- /**
- * Returns the callbacks interface that non-system users can call.
- */
- public IBinder getSystemUserCallbacks() {
- return mSystemToUserCallbacks;
- }
-
- public static RecentsTaskLoader getTaskLoader() {
- return sTaskLoader;
- }
-
-
- public static SystemServicesProxy getSystemServices() {
- return sSystemServicesProxy;
- }
-
- public static RecentsConfiguration getConfiguration() {
- return sConfiguration;
- }
-
- public static RecentsDebugFlags getDebugFlags() {
- return sDebugFlags;
- }
-
- @Override
- public void onStart(Context context, SysUiServiceProvider sysUiServiceProvider) {
- mContext = context;
- mSysUiServiceProvider = sysUiServiceProvider;
- final Resources res = mContext.getResources();
- final int defaultTaskBarBackgroundColor =
- mContext.getColor(R.color.recents_task_bar_default_background_color);
- final int defaultTaskViewBackgroundColor =
- mContext.getColor(R.color.recents_task_view_default_background_color);
- sDebugFlags = new RecentsDebugFlags();
- sSystemServicesProxy = SystemServicesProxy.getInstance(mContext);
- sConfiguration = new RecentsConfiguration(mContext);
- sTaskLoader = new RecentsTaskLoader(mContext,
- // TODO: Once we start building the AAR, move these into the loader
- res.getInteger(R.integer.config_recents_max_thumbnail_count),
- res.getInteger(R.integer.config_recents_max_icon_count),
- res.getInteger(R.integer.recents_svelte_level));
- sTaskLoader.setDefaultColors(defaultTaskBarBackgroundColor, defaultTaskViewBackgroundColor);
- mHandler = new Handler();
- mImpl = new RecentsImpl(mContext);
-
- // Register with the event bus
- EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
- EventBus.getDefault().register(sSystemServicesProxy, EVENT_BUS_PRIORITY);
- EventBus.getDefault().register(sTaskLoader, EVENT_BUS_PRIORITY);
-
- // Due to the fact that RecentsActivity is per-user, we need to establish and interface for
- // the system user's Recents component to pass events (like show/hide/toggleRecents) to the
- // secondary user, and vice versa (like visibility change, screen pinning).
- final int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- // For the system user, initialize an instance of the interface that we can pass to the
- // secondary user
- mSystemToUserCallbacks = new RecentsSystemUser(mContext, mImpl);
- } else {
- // For the secondary user, bind to the primary user's service to get a persistent
- // interface to register its implementation and to later update its state
- registerWithSystemUser();
- }
- }
-
- @Override
- public void onBootCompleted() {
- mImpl.onBootCompleted();
- }
-
-
- @Override
- public void growRecents() {
- EventBus.getDefault().send(new RecentsGrowingEvent());
- }
-
- /**
- * Shows the Recents.
- */
- @Override
- public void showRecentApps(boolean triggeredFromAltTab) {
- ActivityManagerWrapper.getInstance().closeSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
- int recentsGrowTarget = getComponent(Divider.class).getView().growsRecents();
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
- true /* animate */, recentsGrowTarget);
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.showRecents(triggeredFromAltTab, false /* draggingInRecents */,
- true /* animate */, recentsGrowTarget);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- /**
- * Hides the Recents.
- */
- @Override
- public void hideRecentApps(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- /**
- * Toggles the Recents activity.
- */
- @Override
- public void toggleRecentApps() {
- int growTarget = getComponent(Divider.class).getView().growsRecents();
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.toggleRecents(growTarget);
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.toggleRecents(growTarget);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- /**
- * Preloads info for the Recents activity.
- */
- @Override
- public void preloadRecentApps() {
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.preloadRecents();
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.preloadRecents();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- @Override
- public void cancelPreloadRecentApps() {
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.cancelPreloadingRecents();
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.cancelPreloadingRecents();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- @Override
- public boolean splitPrimaryTask(int stackCreateMode, Rect initialBounds, int metricsDockAction) {
- Point realSize = new Point();
- if (initialBounds == null) {
- mContext.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY)
- .getRealSize(realSize);
- initialBounds = new Rect(0, 0, realSize.x, realSize.y);
- }
-
- int currentUser = sSystemServicesProxy.getCurrentUser();
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- final int activityType = runningTask != null
- ? runningTask.configuration.windowConfiguration.getActivityType()
- : ACTIVITY_TYPE_UNDEFINED;
- boolean screenPinningActive = ActivityManagerWrapper.getInstance().isScreenPinningActive();
- boolean isRunningTaskInHomeOrRecentsStack =
- activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS;
- if (runningTask != null && !isRunningTaskInHomeOrRecentsStack && !screenPinningActive) {
- logDockAttempt(mContext, runningTask.topActivity, runningTask.resizeMode);
- if (runningTask.supportsSplitScreenMultiWindow) {
- if (metricsDockAction != -1) {
- MetricsLogger.action(mContext, metricsDockAction,
- runningTask.topActivity.flattenToShortString());
- }
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.splitPrimaryTask(runningTask.id, stackCreateMode, initialBounds);
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.splitPrimaryTask(runningTask.id, stackCreateMode,
- initialBounds);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
-
- return true;
- } else {
- EventBus.getDefault().send(new ShowUserToastEvent(
- R.string.dock_non_resizeble_failed_to_dock_text, Toast.LENGTH_SHORT));
- return false;
- }
- } else {
- return false;
- }
- }
-
- public static void logDockAttempt(Context ctx, ComponentName activity, int resizeMode) {
- if (resizeMode == ActivityInfo.RESIZE_MODE_UNRESIZEABLE) {
- MetricsLogger.action(ctx, MetricsEvent.ACTION_WINDOW_DOCK_UNRESIZABLE,
- activity.flattenToShortString());
- }
- MetricsLogger.count(ctx, getMetricsCounterForResizeMode(resizeMode), 1);
- }
-
- private static String getMetricsCounterForResizeMode(int resizeMode) {
- switch (resizeMode) {
- case ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE:
- return COUNTER_WINDOW_UNSUPPORTED;
- case ActivityInfo.RESIZE_MODE_RESIZEABLE:
- case ActivityInfo.RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION:
- return COUNTER_WINDOW_SUPPORTED;
- default:
- return COUNTER_WINDOW_INCOMPATIBLE;
- }
- }
-
- @Override
- public void onAppTransitionFinished() {
- if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- // Fallback, reset the flag once an app transition ends
- EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(
- false /* waitingForTransitionStart */));
- }
- }
-
- /**
- * Updates on configuration change.
- */
- public void onConfigurationChanged(Configuration newConfig) {
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.onConfigurationChanged();
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.onConfigurationChanged();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- /**
- * Handle Recents activity visibility changed.
- */
- public final void onBusEvent(final RecentsVisibilityChangedEvent event) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- int processUser = ssp.getProcessUser();
- if (ssp.isSystemUser(processUser)) {
- mImpl.onVisibilityChanged(event.applicationContext, event.visible);
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.updateRecentsVisibility(event.visible);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
-
- // This will catch the cases when a user launches from recents to another app
- // (and vice versa) that is not in the recents stack (such as home or bugreport) and it
- // would not reset the wait for transition flag. This will catch it and make sure that the
- // flag is reset.
- if (!event.visible) {
- mImpl.setWaitingForTransitionStart(false);
- }
- }
-
- public final void onBusEvent(DockedFirstAnimationFrameEvent event) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- int processUser = ssp.getProcessUser();
- if (ssp.isSystemUser(processUser)) {
- final Divider divider = getComponent(Divider.class);
- if (divider != null) {
- divider.onDockedFirstAnimationFrame();
- }
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.sendDockedFirstAnimationFrameEvent();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- /**
- * Handle screen pinning request.
- */
- public final void onBusEvent(final ScreenPinningRequestEvent event) {
- int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- mImpl.onStartScreenPinning(event.applicationContext, event.taskId);
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.startScreenPinning(event.taskId);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- public final void onBusEvent(final RecentsDrawnEvent event) {
- int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- final Divider divider = getComponent(Divider.class);
- if (divider != null) {
- divider.onRecentsDrawn();
- }
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.sendRecentsDrawnEvent();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- public final void onBusEvent(final DockedTopTaskEvent event) {
- int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- final Divider divider = getComponent(Divider.class);
- if (divider != null) {
- divider.onDockedTopTask();
- }
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.sendDockingTopTaskEvent(event.initialRect);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- public final void onBusEvent(final RecentsActivityStartingEvent event) {
- int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- final Divider divider = getComponent(Divider.class);
- if (divider != null) {
- divider.onRecentsActivityStarting();
- }
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.sendLaunchRecentsEvent();
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- public final void onBusEvent(LaunchTaskFailedEvent event) {
- // Reset the transition when tasks fail to launch
- mImpl.setWaitingForTransitionStart(false);
- }
-
- public final void onBusEvent(ConfigurationChangedEvent event) {
- // Update the configuration for the Recents component when the activity configuration
- // changes as well
- mImpl.onConfigurationChanged();
- }
-
- public final void onBusEvent(ShowUserToastEvent event) {
- int currentUser = sSystemServicesProxy.getCurrentUser();
- if (sSystemServicesProxy.isSystemUser(currentUser)) {
- mImpl.onShowCurrentUserToast(event.msgResId, event.msgLength);
- } else {
- if (mSystemToUserCallbacks != null) {
- IRecentsNonSystemUserCallbacks callbacks =
- mSystemToUserCallbacks.getNonSystemUserRecentsForUser(currentUser);
- if (callbacks != null) {
- try {
- callbacks.showCurrentUserToast(event.msgResId, event.msgLength);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- } else {
- Log.e(TAG, "No SystemUI callbacks found for user: " + currentUser);
- }
- }
- }
- }
-
- public final void onBusEvent(SetWaitingForTransitionStartEvent event) {
- int processUser = sSystemServicesProxy.getProcessUser();
- if (sSystemServicesProxy.isSystemUser(processUser)) {
- mImpl.setWaitingForTransitionStart(event.waitingForTransitionStart);
- } else {
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.setWaitingForTransitionStartEvent(
- event.waitingForTransitionStart);
- } catch (RemoteException e) {
- Log.e(TAG, "Callback failed", e);
- }
- }
- });
- }
- }
-
- public final void onBusEvent(ExpandPipEvent event) {
- PipUI pipUi = getComponent(PipUI.class);
- if (pipUi == null) {
- return;
- }
- pipUi.expandPip();
- }
-
- public final void onBusEvent(HidePipMenuEvent event) {
- PipUI pipUi = getComponent(PipUI.class);
- if (pipUi == null) {
- return;
- }
- event.getAnimationTrigger().increment();
- pipUi.hidePipMenu(() -> {
- event.getAnimationTrigger().increment();
- }, () -> {
- event.getAnimationTrigger().decrement();
- });
- event.getAnimationTrigger().decrement();
- }
-
- /**
- * Attempts to register with the system user.
- */
- private void registerWithSystemUser() {
- final int processUser = sSystemServicesProxy.getProcessUser();
- postToSystemUser(new Runnable() {
- @Override
- public void run() {
- try {
- mUserToSystemCallbacks.registerNonSystemUserCallbacks(
- new RecentsImplProxy(mImpl), processUser);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to register", e);
- }
- }
- });
- }
-
- /**
- * Runs the runnable in the system user's Recents context, connecting to the service if
- * necessary.
- */
- private void postToSystemUser(final Runnable onConnectRunnable) {
- mOnConnectRunnables.add(onConnectRunnable);
- if (mUserToSystemCallbacks == null) {
- Intent systemUserServiceIntent = new Intent();
- systemUserServiceIntent.setClass(mContext, RecentsSystemUserService.class);
- boolean bound = mContext.bindServiceAsUser(systemUserServiceIntent,
- mUserToSystemServiceConnection, Context.BIND_AUTO_CREATE, UserHandle.SYSTEM);
- EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
- EventLogConstants.SYSUI_RECENTS_CONNECTION_USER_BIND_SERVICE,
- sSystemServicesProxy.getProcessUser());
- if (!bound) {
- // Retry after a fixed duration
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- registerWithSystemUser();
- }
- }, BIND_TO_SYSTEM_USER_RETRY_DELAY);
- }
- } else {
- runAndFlushOnConnectRunnables();
- }
- }
-
- /**
- * Runs all the queued runnables after a service connection is made.
- */
- private void runAndFlushOnConnectRunnables() {
- for (Runnable r : mOnConnectRunnables) {
- r.run();
- }
- mOnConnectRunnables.clear();
- }
-
- private <T> T getComponent(Class<T> clazz) {
- return mSysUiServiceProvider.getComponent(clazz);
- }
-
- @Override
- public void dump(PrintWriter pw) {
- pw.println("Recents");
- pw.println(" currentUserId=" + SystemServicesProxy.getInstance(mContext).getCurrentUser());
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
deleted file mode 100644
index a7ccc3a..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivity.java
+++ /dev/null
@@ -1,858 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_HOME_KEY;
-
-import android.app.Activity;
-import android.app.ActivityOptions;
-import android.app.TaskStackBuilder;
-import android.app.WallpaperManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.res.Configuration;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.provider.Settings;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnPreDrawListener;
-import android.view.WindowManager;
-import android.view.WindowManager.LayoutParams;
-
-import com.android.internal.colorextraction.ColorExtractor;
-import com.android.internal.content.PackageMonitor;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.util.LatencyTracker;
-import com.android.systemui.DejankUtils;
-import com.android.systemui.Dependency;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.colorextraction.SysuiColorExtractor;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
-import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
-import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
-import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskSucceededEvent;
-import com.android.systemui.recents.events.activity.MultiWindowStateChangedEvent;
-import com.android.systemui.recents.events.activity.PackagesChangedEvent;
-import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
-import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
-import com.android.systemui.recents.events.component.ActivityUnpinnedEvent;
-import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
-import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
-import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
-import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
-import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
-import com.android.systemui.recents.events.ui.HideIncompatibleAppOverlayEvent;
-import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
-import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
-import com.android.systemui.recents.events.ui.ShowIncompatibleAppOverlayEvent;
-import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
-import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
-import com.android.systemui.recents.events.ui.UserInteractionEvent;
-import com.android.systemui.recents.events.ui.focus.DismissFocusedTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.FocusNextTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.FocusPreviousTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent.Direction;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.model.RecentsTaskLoadPlan;
-import com.android.systemui.recents.model.RecentsTaskLoader;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.recents.views.RecentsView;
-import com.android.systemui.recents.views.SystemBarScrimViews;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-/**
- * The main Recents activity that is started from RecentsComponent.
- */
-public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreDrawListener,
- ColorExtractor.OnColorsChangedListener {
-
- private final static String TAG = "RecentsActivity";
- private final static boolean DEBUG = false;
-
- public final static int EVENT_BUS_PRIORITY = LegacyRecentsImpl.EVENT_BUS_PRIORITY + 1;
- public final static int INCOMPATIBLE_APP_ALPHA_DURATION = 150;
-
- private PackageMonitor mPackageMonitor = new PackageMonitor() {
- @Override
- public void onPackageRemoved(String packageName, int uid) {
- RecentsActivity.this.onPackageChanged(packageName, getChangingUserId());
- }
-
- @Override
- public boolean onPackageChanged(String packageName, int uid, String[] components) {
- RecentsActivity.this.onPackageChanged(packageName, getChangingUserId());
- return true;
- }
-
- @Override
- public void onPackageModified(String packageName) {
- RecentsActivity.this.onPackageChanged(packageName, getChangingUserId());
- }
- };
- private Handler mHandler = new Handler();
- private long mLastTabKeyEventTime;
- private boolean mFinishedOnStartup;
- private boolean mIgnoreAltTabRelease;
- private boolean mIsVisible;
- private boolean mRecentsStartRequested;
- private Configuration mLastConfig;
-
- // Top level views
- private RecentsView mRecentsView;
- private SystemBarScrimViews mScrimViews;
- private View mIncompatibleAppOverlay;
-
- // Runnables to finish the Recents activity
- private Intent mHomeIntent;
-
- // The trigger to automatically launch the current task
- private int mFocusTimerDuration;
- private final UserInteractionEvent mUserInteractionEvent = new UserInteractionEvent();
-
- // Theme and colors
- private SysuiColorExtractor mColorExtractor;
- private boolean mUsingDarkText;
-
- /**
- * A common Runnable to finish Recents by launching Home with an animation depending on the
- * last activity launch state. Generally we always launch home when we exit Recents rather than
- * just finishing the activity since we don't know what is behind Recents in the task stack.
- */
- class LaunchHomeRunnable implements Runnable {
-
- Intent mLaunchIntent;
- ActivityOptions mOpts;
-
- /**
- * Creates a finish runnable that starts the specified intent.
- */
- public LaunchHomeRunnable(Intent launchIntent, ActivityOptions opts) {
- mLaunchIntent = launchIntent;
- mOpts = opts;
- }
-
- @Override
- public void run() {
- try {
- mHandler.post(() -> {
- ActivityOptions opts = mOpts;
- if (opts == null) {
- opts = ActivityOptions.makeCustomAnimation(RecentsActivity.this,
- R.anim.recents_to_launcher_enter, R.anim.recents_to_launcher_exit);
- }
- startActivityAsUser(mLaunchIntent, opts.toBundle(), UserHandle.CURRENT);
- });
- } catch (Exception e) {
- Log.e(TAG, getString(R.string.recents_launch_error_message, "Home"), e);
- }
- }
- }
-
- /**
- * Broadcast receiver to handle messages from the system
- */
- final BroadcastReceiver mSystemBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context ctx, Intent intent) {
- String action = intent.getAction();
- if (action.equals(Intent.ACTION_SCREEN_OFF)) {
- // When the screen turns off, dismiss Recents to Home
- dismissRecentsToHomeIfVisible(false);
- } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
- // When switching users, dismiss Recents to Home similar to screen off
- finish();
- }
- }
- };
-
- private final OnPreDrawListener mRecentsDrawnEventListener =
- new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
- EventBus.getDefault().post(new RecentsDrawnEvent());
- if (LatencyTracker.isEnabled(getApplicationContext())) {
- DejankUtils.postAfterTraversal(() -> LatencyTracker.getInstance(
- getApplicationContext()).onActionEnd(
- LatencyTracker.ACTION_TOGGLE_RECENTS));
- }
- DejankUtils.postAfterTraversal(() -> {
- LegacyRecentsImpl.getTaskLoader().startLoader(RecentsActivity.this);
- LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().setVisible(true);
- });
- return true;
- }
- };
-
- /**
- * Dismisses recents if we are already visible and the intent is to toggle the recents view.
- */
- boolean dismissRecentsToFocusedTask(int logCategory) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.isRecentsActivityVisible()) {
- // If we have a focused Task, launch that Task now
- if (mRecentsView.launchFocusedTask(logCategory)) return true;
- }
- return false;
- }
-
- /**
- * Dismisses recents back to the launch target task.
- */
- boolean dismissRecentsToLaunchTargetTaskOrHome() {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.isRecentsActivityVisible()) {
- // If we have a focused Task, launch that Task now
- if (mRecentsView.launchPreviousTask()) return true;
- // If none of the other cases apply, then just go Home
- dismissRecentsToHome(true /* animateTaskViews */);
- }
- return false;
- }
-
- /**
- * Dismisses recents if we are already visible and the intent is to toggle the recents view.
- */
- boolean dismissRecentsToFocusedTaskOrHome() {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.isRecentsActivityVisible()) {
- // If we have a focused Task, launch that Task now
- if (mRecentsView.launchFocusedTask(0 /* logCategory */)) return true;
- // If none of the other cases apply, then just go Home
- dismissRecentsToHome(true /* animateTaskViews */);
- return true;
- }
- return false;
- }
-
- /**
- * Dismisses Recents directly to Home without checking whether it is currently visible.
- */
- void dismissRecentsToHome(boolean animateTaskViews) {
- dismissRecentsToHome(animateTaskViews, null);
- }
-
- /**
- * Dismisses Recents directly to Home without checking whether it is currently visible.
- *
- * @param overrideAnimation If not null, will override the default animation that is based on
- * how Recents was launched.
- */
- void dismissRecentsToHome(boolean animateTaskViews, ActivityOptions overrideAnimation) {
- DismissRecentsToHomeAnimationStarted dismissEvent =
- new DismissRecentsToHomeAnimationStarted(animateTaskViews);
- dismissEvent.addPostAnimationCallback(new LaunchHomeRunnable(mHomeIntent,
- overrideAnimation));
- ActivityManagerWrapper.getInstance().closeSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY);
- EventBus.getDefault().send(dismissEvent);
- }
-
- /** Dismisses Recents directly to Home if we currently aren't transitioning. */
- boolean dismissRecentsToHomeIfVisible(boolean animated) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.isRecentsActivityVisible()) {
- // Return to Home
- dismissRecentsToHome(animated);
- return true;
- }
- return false;
- }
-
- /** Called with the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mFinishedOnStartup = false;
-
- // In the case that the activity starts up before the Recents component has initialized
- // (usually when debugging/pushing the SysUI apk), just finish this activity.
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp == null) {
- mFinishedOnStartup = true;
- finish();
- return;
- }
-
- // Register this activity with the event bus
- EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
-
- // Initialize the package monitor
- mPackageMonitor.register(this, Looper.getMainLooper(), UserHandle.ALL,
- true /* externalStorage */);
-
- // Select theme based on wallpaper colors
- mColorExtractor = Dependency.get(SysuiColorExtractor.class);
- mColorExtractor.addOnColorsChangedListener(this);
- mUsingDarkText = mColorExtractor.getColors(ColorExtractor.TYPE_DARK,
- WallpaperManager.FLAG_SYSTEM).supportsDarkText();
- setTheme(mUsingDarkText ? R.style.RecentsTheme_Wallpaper_Light
- : R.style.RecentsTheme_Wallpaper);
-
- // Set the Recents layout
- setContentView(R.layout.recents);
- takeKeyEvents(true);
- mRecentsView = findViewById(R.id.recents_view);
- mScrimViews = new SystemBarScrimViews(this);
- getWindow().getAttributes().privateFlags |=
- WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
-
- mLastConfig = new Configuration(Utilities.getAppConfiguration(this));
-
- // Set the window background
- mRecentsView.updateBackgroundScrim(getWindow(), isInMultiWindowMode());
-
- // Create the home intent runnable
- mHomeIntent = new Intent(Intent.ACTION_MAIN, null);
- mHomeIntent.addCategory(Intent.CATEGORY_HOME);
- mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
- Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
-
- // Register the broadcast receiver to handle messages when the screen is turned off
- IntentFilter filter = new IntentFilter();
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- filter.addAction(Intent.ACTION_USER_SWITCHED);
- registerReceiver(mSystemBroadcastReceiver, filter);
-
- getWindow().addPrivateFlags(LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- // Reload the stack view whenever we are made visible again
- reloadStackView();
-
- // Notify that recents is now visible
- EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, true));
- MetricsLogger.visible(this, MetricsEvent.OVERVIEW_ACTIVITY);
-
- // Getting system scrim colors ignoring wallpaper visibility since it should never be grey.
- ColorExtractor.GradientColors systemColors = mColorExtractor.getNeutralColors();
- // We don't want to interpolate colors because we're defining the initial state.
- // Gradient should be set/ready when you open "Recents".
- mRecentsView.setScrimColors(systemColors, false);
-
- // Notify of the next draw
- mRecentsView.getViewTreeObserver().addOnPreDrawListener(mRecentsDrawnEventListener);
-
- // If Recents was restarted, then it should complete the enter animation with partially
- // reset launch state with dock, app and home set to false
- Object isRelaunching = getLastNonConfigurationInstance();
- if (isRelaunching != null && isRelaunching instanceof Boolean && (boolean) isRelaunching) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- launchState.launchedViaDockGesture = false;
- launchState.launchedFromApp = false;
- launchState.launchedFromHome = false;
- onEnterAnimationComplete();
- }
- mRecentsStartRequested = false;
- }
-
- @Override
- public void onColorsChanged(ColorExtractor colorExtractor, int which) {
- if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
- ColorExtractor.GradientColors colors = mColorExtractor.getNeutralColors();
- boolean darkText = colors.supportsDarkText();
- if (darkText != mUsingDarkText) {
- mUsingDarkText = darkText;
- setTheme(mUsingDarkText ? R.style.RecentsTheme_Wallpaper_Light
- : R.style.RecentsTheme_Wallpaper);
- mRecentsView.reevaluateStyles();
- }
- mRecentsView.setScrimColors(colors, true /* animated */);
- }
- }
-
- /**
- * Reloads the stack views upon launching Recents.
- */
- private void reloadStackView() {
- // If the Recents component has preloaded a load plan, then use that to prevent
- // reconstructing the task stack
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan loadPlan = RecentsImpl.consumeInstanceLoadPlan();
- if (loadPlan == null) {
- loadPlan = new RecentsTaskLoadPlan(this);
- }
-
- // Start loading tasks according to the load plan
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- if (!loadPlan.hasTasks()) {
- loader.preloadTasks(loadPlan, launchState.launchedToTaskId);
- }
-
- RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
- loadOpts.runningTaskId = launchState.launchedToTaskId;
- loadOpts.numVisibleTasks = launchState.launchedNumVisibleTasks;
- loadOpts.numVisibleTaskThumbnails = launchState.launchedNumVisibleThumbnails;
- loader.loadTasks(loadPlan, loadOpts);
- TaskStack stack = loadPlan.getTaskStack();
- mRecentsView.onReload(stack, mIsVisible);
-
- // Update the nav bar scrim, but defer the animation until the enter-window event
- boolean animateNavBarScrim = !launchState.launchedViaDockGesture;
- mScrimViews.updateNavBarScrim(animateNavBarScrim, stack.getTaskCount() > 0, null);
-
- // If this is a new instance relaunched by AM, without going through the normal mechanisms,
- // then we have to manually trigger the enter animation state
- boolean wasLaunchedByAm = !launchState.launchedFromHome &&
- !launchState.launchedFromApp;
- if (wasLaunchedByAm) {
- EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
- }
-
- // Keep track of whether we launched from the nav bar button or via alt-tab
- if (launchState.launchedWithAltTab) {
- MetricsLogger.count(this, "overview_trigger_alttab", 1);
- } else {
- MetricsLogger.count(this, "overview_trigger_nav_btn", 1);
- }
-
- // Keep track of whether we launched from an app or from home
- if (launchState.launchedFromApp) {
- Task launchTarget = stack.getLaunchTarget();
- int launchTaskIndexInStack = launchTarget != null
- ? stack.indexOfTask(launchTarget)
- : 0;
- MetricsLogger.count(this, "overview_source_app", 1);
- // If from an app, track the stack index of the app in the stack (for affiliated tasks)
- MetricsLogger.histogram(this, "overview_source_app_index", launchTaskIndexInStack);
- } else {
- MetricsLogger.count(this, "overview_source_home", 1);
- }
-
- // Keep track of the total stack task count
- int taskCount = mRecentsView.getStack().getTaskCount();
- MetricsLogger.histogram(this, "overview_task_count", taskCount);
-
- // After we have resumed, set the visible state until the next onStop() call
- mIsVisible = true;
- }
-
- @Override
- public void onEnterAnimationComplete() {
- super.onEnterAnimationComplete();
- EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
-
- // Workaround for b/64694148: The animation started callback is not made (see
- // RecentsImpl.getThumbnailTransitionActivityOptions) so reset the transition-waiting state
- // once the enter animation has completed.
- EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(false));
- }
-
- @Override
- public Object onRetainNonConfigurationInstance() {
- return true;
- }
-
- @Override
- protected void onPause() {
- super.onPause();
-
- mIgnoreAltTabRelease = false;
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
-
- // Notify of the config change
- Configuration newDeviceConfiguration = Utilities.getAppConfiguration(this);
- int numStackTasks = mRecentsView.getStack().getTaskCount();
- EventBus.getDefault().send(new ConfigurationChangedEvent(false /* fromMultiWindow */,
- mLastConfig.orientation != newDeviceConfiguration.orientation,
- mLastConfig.densityDpi != newDeviceConfiguration.densityDpi, numStackTasks > 0));
-
- mLastConfig.updateFrom(newDeviceConfiguration);
- }
-
- @Override
- public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
- super.onMultiWindowModeChanged(isInMultiWindowMode);
-
- // Set the window background
- mRecentsView.updateBackgroundScrim(getWindow(), isInMultiWindowMode);
-
- // Reload the task stack view if we are still visible to pick up the change in tasks that
- // result from entering/exiting multi-window
- if (mIsVisible) {
- reloadTaskStack(isInMultiWindowMode, true /* sendConfigChangedEvent */);
- }
- }
-
- @Override
- protected void onStop() {
- super.onStop();
-
- // Notify that recents is now hidden
- mIsVisible = false;
- EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
- MetricsLogger.hidden(this, MetricsEvent.OVERVIEW_ACTIVITY);
- LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().setVisible(false);
-
- // When recents starts again before onStop, do not reset launch flags so entrance animation
- // can run
- if (!isChangingConfigurations() && !mRecentsStartRequested) {
- // Workaround for b/22542869, if the RecentsActivity is started again, but without going
- // through SystemUI, we need to reset the config launch flags to ensure that we do not
- // wait on the system to send a signal that was never queued.
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- launchState.reset();
- }
-
- // Force a gc to attempt to clean up bitmap references more quickly (b/38258699)
- LegacyRecentsImpl.getSystemServices().gc();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
-
- // In the case that the activity finished on startup, just skip the unregistration below
- if (mFinishedOnStartup) {
- return;
- }
-
- // Unregister the system broadcast receivers
- unregisterReceiver(mSystemBroadcastReceiver);
-
- // Unregister any broadcast receivers for the task loader
- mPackageMonitor.unregister();
-
- EventBus.getDefault().unregister(this);
- }
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- EventBus.getDefault().register(mScrimViews, EVENT_BUS_PRIORITY);
- }
-
- @Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- EventBus.getDefault().unregister(mScrimViews);
- }
-
- @Override
- public void onTrimMemory(int level) {
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- if (loader != null) {
- loader.onTrimMemory(level);
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_TAB: {
- int altTabKeyDelay = getResources().getInteger(R.integer.recents_alt_tab_key_delay);
- boolean hasRepKeyTimeElapsed = (SystemClock.elapsedRealtime() -
- mLastTabKeyEventTime) > altTabKeyDelay;
- if (event.getRepeatCount() <= 0 || hasRepKeyTimeElapsed) {
- // Focus the next task in the stack
- final boolean backward = event.isShiftPressed();
- if (backward) {
- EventBus.getDefault().send(new FocusPreviousTaskViewEvent());
- } else {
- EventBus.getDefault().send(new FocusNextTaskViewEvent());
- }
- mLastTabKeyEventTime = SystemClock.elapsedRealtime();
-
- // In the case of another ALT event, don't ignore the next release
- if (event.isAltPressed()) {
- mIgnoreAltTabRelease = false;
- }
- }
- return true;
- }
- case KeyEvent.KEYCODE_DPAD_UP:
- case KeyEvent.KEYCODE_DPAD_DOWN:
- case KeyEvent.KEYCODE_DPAD_LEFT:
- case KeyEvent.KEYCODE_DPAD_RIGHT: {
- final Direction direction = NavigateTaskViewEvent.getDirectionFromKeyCode(keyCode);
- EventBus.getDefault().send(new NavigateTaskViewEvent(direction));
- return true;
- }
- case KeyEvent.KEYCODE_DEL:
- case KeyEvent.KEYCODE_FORWARD_DEL: {
- if (event.getRepeatCount() <= 0) {
- EventBus.getDefault().send(new DismissFocusedTaskViewEvent());
-
- // Keep track of deletions by keyboard
- MetricsLogger.histogram(this, "overview_task_dismissed_source",
- Constants.Metrics.DismissSourceKeyboard);
- return true;
- }
- }
- default:
- break;
- }
- return super.onKeyDown(keyCode, event);
- }
-
- @Override
- public void onUserInteraction() {
- EventBus.getDefault().send(mUserInteractionEvent);
- }
-
- @Override
- public void onBackPressed() {
- // Back behaves like the recents button so just trigger a toggle event
- EventBus.getDefault().send(new ToggleRecentsEvent());
- }
-
- /**** EventBus events ****/
-
- public final void onBusEvent(ToggleRecentsEvent event) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- if (launchState.launchedFromHome) {
- dismissRecentsToHome(true /* animateTaskViews */);
- } else {
- dismissRecentsToLaunchTargetTaskOrHome();
- }
- }
-
- public final void onBusEvent(RecentsActivityStartingEvent event) {
- mRecentsStartRequested = true;
- }
-
- public final void onBusEvent(HideRecentsEvent event) {
- if (event.triggeredFromAltTab) {
- // If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
- if (!mIgnoreAltTabRelease) {
- dismissRecentsToFocusedTaskOrHome();
- }
- } else if (event.triggeredFromHomeKey) {
- dismissRecentsToHome(true /* animateTaskViews */);
-
- // Cancel any pending dozes
- EventBus.getDefault().send(mUserInteractionEvent);
- } else {
- // Do nothing
- }
- }
-
- public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
- mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
- mRecentsView.invalidate();
- }
-
- public final void onBusEvent(ExitRecentsWindowFirstAnimationFrameEvent event) {
- mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
- mRecentsView.invalidate();
- }
-
- public final void onBusEvent(DockedFirstAnimationFrameEvent event) {
- mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
- mRecentsView.invalidate();
- }
-
- public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- int launchToTaskId = launchState.launchedToTaskId;
- if (launchToTaskId != -1 &&
- (event.launchTask == null || launchToTaskId != event.launchTask.key.id)) {
- ActivityManagerWrapper am = ActivityManagerWrapper.getInstance();
- am.cancelWindowTransition(launchState.launchedToTaskId);
- }
- }
-
- public final void onBusEvent(ShowApplicationInfoEvent event) {
- // Create a new task stack with the application info details activity
- Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
- Uri.fromParts("package", event.task.key.getComponent().getPackageName(), null));
- intent.setComponent(intent.resolveActivity(getPackageManager()));
- TaskStackBuilder.create(this)
- .addNextIntentWithParentStack(intent).startActivities(null,
- new UserHandle(event.task.key.userId));
-
- // Keep track of app-info invocations
- MetricsLogger.count(this, "overview_app_info", 1);
- }
-
- public final void onBusEvent(ShowIncompatibleAppOverlayEvent event) {
- if (mIncompatibleAppOverlay == null) {
- mIncompatibleAppOverlay = Utilities.findViewStubById(this,
- R.id.incompatible_app_overlay_stub).inflate();
- mIncompatibleAppOverlay.setWillNotDraw(false);
- mIncompatibleAppOverlay.setVisibility(View.VISIBLE);
- }
- mIncompatibleAppOverlay.animate()
- .alpha(1f)
- .setDuration(INCOMPATIBLE_APP_ALPHA_DURATION)
- .setInterpolator(Interpolators.ALPHA_IN)
- .start();
- }
-
- public final void onBusEvent(HideIncompatibleAppOverlayEvent event) {
- if (mIncompatibleAppOverlay != null) {
- mIncompatibleAppOverlay.animate()
- .alpha(0f)
- .setDuration(INCOMPATIBLE_APP_ALPHA_DURATION)
- .setInterpolator(Interpolators.ALPHA_OUT)
- .start();
- }
- }
-
- public final void onBusEvent(DeleteTaskDataEvent event) {
- // Remove any stored data from the loader
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- loader.deleteTaskData(event.task, false);
-
- // Remove the task from activity manager
- ActivityManagerWrapper.getInstance().removeTask(event.task.key.id);
- }
-
- public final void onBusEvent(TaskViewDismissedEvent event) {
- mRecentsView.updateScrimOpacity();
- }
-
- public final void onBusEvent(AllTaskViewsDismissedEvent event) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.hasDockedTask()) {
- mRecentsView.showEmptyView(event.msgResId);
- } else {
- // Just go straight home (no animation necessary because there are no more task views)
- dismissRecentsToHome(false /* animateTaskViews */);
- }
-
- // Keep track of all-deletions
- MetricsLogger.count(this, "overview_task_all_dismissed", 1);
- }
-
- public final void onBusEvent(LaunchTaskSucceededEvent event) {
- MetricsLogger.histogram(this, "overview_task_launch_index", event.taskIndexFromStackFront);
- }
-
- public final void onBusEvent(LaunchTaskFailedEvent event) {
- // Return to Home
- dismissRecentsToHome(true /* animateTaskViews */);
-
- MetricsLogger.count(this, "overview_task_launch_failed", 1);
- }
-
- public final void onBusEvent(ScreenPinningRequestEvent event) {
- MetricsLogger.count(this, "overview_screen_pinned", 1);
- }
-
- public final void onBusEvent(StackViewScrolledEvent event) {
- // Once the user has scrolled while holding alt-tab, then we should ignore the release of
- // the key
- mIgnoreAltTabRelease = true;
- }
-
- public final void onBusEvent(final DockedTopTaskEvent event) {
- mRecentsView.getViewTreeObserver().addOnPreDrawListener(mRecentsDrawnEventListener);
- mRecentsView.invalidate();
- }
-
- public final void onBusEvent(final ActivityUnpinnedEvent event) {
- if (mIsVisible) {
- // Skip the configuration change event as the PiP activity does not actually affect the
- // config of recents
- reloadTaskStack(isInMultiWindowMode(), false /* sendConfigChangedEvent */);
- }
- }
-
- private void reloadTaskStack(boolean isInMultiWindowMode, boolean sendConfigChangedEvent) {
- // Reload the task stack completely
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan loadPlan = new RecentsTaskLoadPlan(this);
- loader.preloadTasks(loadPlan, -1 /* runningTaskId */);
-
- RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
- loadOpts.numVisibleTasks = launchState.launchedNumVisibleTasks;
- loadOpts.numVisibleTaskThumbnails = launchState.launchedNumVisibleThumbnails;
- loader.loadTasks(loadPlan, loadOpts);
-
- TaskStack stack = loadPlan.getTaskStack();
- int numStackTasks = stack.getTaskCount();
- boolean showDeferredAnimation = numStackTasks > 0;
-
- if (sendConfigChangedEvent) {
- EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
- false /* fromDeviceOrientationChange */, false /* fromDisplayDensityChange */,
- numStackTasks > 0));
- }
- EventBus.getDefault().send(new MultiWindowStateChangedEvent(isInMultiWindowMode,
- showDeferredAnimation, stack));
- }
-
- @Override
- public boolean onPreDraw() {
- mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
- return true;
- }
-
- public void onPackageChanged(String packageName, int userId) {
- LegacyRecentsImpl.getTaskLoader().onPackageChanged(packageName);
- EventBus.getDefault().send(new PackagesChangedEvent(packageName, userId));
- }
-
- @Override
- public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
- super.dump(prefix, fd, writer, args);
- EventBus.getDefault().dump(prefix, writer);
- LegacyRecentsImpl.getTaskLoader().dump(prefix, writer);
-
- String id = Integer.toHexString(System.identityHashCode(this));
-
- writer.print(prefix); writer.print(TAG);
- writer.print(" visible="); writer.print(mIsVisible ? "Y" : "N");
- writer.print(" currentTime="); writer.print(System.currentTimeMillis());
- writer.print(" [0x"); writer.print(id); writer.print("]");
- writer.println();
-
- if (mRecentsView != null) {
- mRecentsView.dump(prefix, writer);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivityLaunchState.java
deleted file mode 100644
index 14fda95..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsActivityLaunchState.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-/**
- * The launch state of the RecentsActivity.
- *
- * Current Constraints:
- * - needed in onStart() before onNewIntent()
- * - needs to be reset when Recents is hidden
- * - needs to be computed in Recents component
- * - needs to be accessible by views
- */
-public class RecentsActivityLaunchState {
-
- public boolean launchedWithAltTab;
- public boolean launchedFromApp;
- // Set if the activity that we launched from entered PiP during the transition into Recents
- public boolean launchedFromPipApp;
- // Set if the next activity that quick-switch will launch is the PiP activity
- public boolean launchedWithNextPipApp;
- public boolean launchedFromHome;
- public boolean launchedViaDragGesture;
- public boolean launchedViaDockGesture;
- public int launchedToTaskId;
- public int launchedNumVisibleTasks;
- public int launchedNumVisibleThumbnails;
-
- public void reset() {
- launchedFromHome = false;
- launchedFromApp = false;
- launchedFromPipApp = false;
- launchedWithNextPipApp = false;
- launchedToTaskId = -1;
- launchedWithAltTab = false;
- launchedViaDragGesture = false;
- launchedViaDockGesture = false;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsConfiguration.java
deleted file mode 100644
index ee53734..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsConfiguration.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-import android.app.ActivityManager;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-
-import android.os.SystemProperties;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.views.DockState;
-
-/**
- * Represents the dock regions for each orientation.
- */
-class DockRegion {
- public static DockState[] PHONE_LANDSCAPE = {
- // We only allow docking to the left in landscape for now on small devices
- DockState.LEFT
- };
- public static DockState[] PHONE_PORTRAIT = {
- // We only allow docking to the top for now on small devices
- DockState.TOP
- };
- public static DockState[] TABLET_LANDSCAPE = {
- DockState.LEFT,
- DockState.RIGHT
- };
- public static DockState[] TABLET_PORTRAIT = PHONE_PORTRAIT;
-}
-
-/**
- * Application resources that can be retrieved from the application context and are not specifically
- * tied to the current activity.
- */
-public class RecentsConfiguration {
-
- private static final int LARGE_SCREEN_MIN_DP = 600;
- private static final int XLARGE_SCREEN_MIN_DP = 720;
-
- // Launch states
- public RecentsActivityLaunchState mLaunchState = new RecentsActivityLaunchState();
-
- // Since the positions in Recents has to be calculated globally (before the RecentsActivity
- // starts), we need to calculate some resource values ourselves, instead of relying on framework
- // resources.
- public final boolean isLargeScreen;
- public final boolean isXLargeScreen;
- public final int smallestWidth;
-
- /** Misc **/
- public boolean fakeShadows;
- public int svelteLevel;
-
- // Whether this product supports Grid-based Recents. If this is field is set to true, then
- // 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) {
- // Load only resources that can not change after the first load either through developer
- // settings or via multi window
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- mAppContext = context.getApplicationContext();
- Resources res = mAppContext.getResources();
- 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();
- isLargeScreen = smallestWidth >= (int) (screenDensity * LARGE_SCREEN_MIN_DP);
- isXLargeScreen = smallestWidth >= (int) (screenDensity * XLARGE_SCREEN_MIN_DP);
- }
-
- /**
- * Returns the activity launch state.
- * TODO: This will be refactored out of RecentsConfiguration.
- */
- public RecentsActivityLaunchState getLaunchState() {
- return mLaunchState;
- }
-
- /**
- * Returns the preferred dock states for the current orientation.
- * @return a list of dock states for device and its orientation
- */
- public DockState[] getDockStatesForCurrentOrientation() {
- boolean isLandscape = mAppContext.getResources().getConfiguration().orientation ==
- Configuration.ORIENTATION_LANDSCAPE;
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- if (config.isLargeScreen) {
- return isLandscape ? DockRegion.TABLET_LANDSCAPE : DockRegion.TABLET_PORTRAIT;
- } else {
- return isLandscape ? DockRegion.PHONE_LANDSCAPE : DockRegion.PHONE_PORTRAIT;
- }
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsDebugFlags.java
deleted file mode 100644
index 1918593..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents;
-
-public class RecentsDebugFlags {
-
- public static class Static {
- // Enables debug drawing for the transition thumbnail
- public static final boolean EnableTransitionThumbnailDebugMode = false;
-
- // Disables enter and exit transitions for other tasks for low ram devices
- public static final boolean DisableRecentsLowRamEnterExitAnimation = false;
-
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImpl.java
deleted file mode 100644
index 3e5acab..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImpl.java
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
-import static android.view.View.MeasureSpec;
-
-import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS;
-
-import android.app.ActivityManager;
-import android.app.ActivityOptions;
-import android.app.trust.TrustManager;
-import android.content.ActivityNotFoundException;
-import android.content.ComponentCallbacks2;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.SystemClock;
-import android.util.ArraySet;
-import android.util.Log;
-import android.util.MutableBoolean;
-import android.util.Pair;
-import android.view.LayoutInflater;
-import android.view.ViewConfiguration;
-import android.view.WindowManager;
-
-import android.widget.Toast;
-
-import com.android.systemui.Dependency;
-import com.android.systemui.SysUiServiceProvider;
-import com.android.systemui.pip.phone.ForegroundThread;
-import com.google.android.collect.Lists;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.policy.DockedDividerUtils;
-import com.android.systemui.R;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent;
-import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
-import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
-import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
-import com.android.systemui.recents.events.component.ActivityPinnedEvent;
-import com.android.systemui.recents.events.component.ActivityUnpinnedEvent;
-import com.android.systemui.recents.events.component.HidePipMenuEvent;
-import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
-import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
-import com.android.systemui.recents.events.ui.DraggingInRecentsEndedEvent;
-import com.android.systemui.recents.events.ui.DraggingInRecentsEvent;
-import com.android.systemui.recents.events.ui.TaskSnapshotChangedEvent;
-import com.android.systemui.recents.misc.DozeTrigger;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.misc.SysUiTaskStackChangeListener;
-import com.android.systemui.recents.model.RecentsTaskLoadPlan;
-import com.android.systemui.recents.model.RecentsTaskLoader;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.recents.views.TaskStackLayoutAlgorithm;
-import com.android.systemui.recents.views.TaskStackLayoutAlgorithm.VisibilityReport;
-import com.android.systemui.recents.views.TaskStackView;
-import com.android.systemui.recents.views.TaskViewHeader;
-import com.android.systemui.recents.views.TaskViewTransform;
-import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm;
-import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat;
-import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
-import com.android.systemui.shared.recents.view.RecentsTransition;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-import com.android.systemui.stackdivider.DividerView;
-import com.android.systemui.statusbar.phone.StatusBar;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An implementation of the Recents component for the current user. For secondary users, this can
- * be called remotely from the system user.
- */
-public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener {
-
- private final static String TAG = "RecentsImpl";
-
- // The minimum amount of time between each recents button press that we will handle
- private final static int MIN_TOGGLE_DELAY_MS = 350;
-
- // The duration within which the user releasing the alt tab (from when they pressed alt tab)
- // that the fast alt-tab animation will run. If the user's alt-tab takes longer than this
- // duration, then we will toggle recents after this duration.
- private final static int FAST_ALT_TAB_DELAY_MS = 225;
-
- private final static ArraySet<TaskKey> EMPTY_SET = new ArraySet<>();
-
- public final static String RECENTS_PACKAGE = "com.android.systemui";
- public final static String RECENTS_ACTIVITY = "com.android.systemui.recents.RecentsActivity";
-
- /**
- * An implementation of SysUiTaskStackChangeListener, that allows us to listen for changes to the system
- * task stacks and update recents accordingly.
- */
- class TaskStackListenerImpl extends SysUiTaskStackChangeListener {
-
- private OverviewProxyService mOverviewProxyService;
-
- public TaskStackListenerImpl() {
- mOverviewProxyService = Dependency.get(OverviewProxyService.class);
- }
-
- @Override
- public void onTaskStackChangedBackground() {
- // Skip background preloading recents in SystemUI if the overview services is bound
- if (mOverviewProxyService.isEnabled()) {
- return;
- }
-
- // Check this is for the right user
- if (!checkCurrentUserId(mContext, false /* debug */)) {
- return;
- }
-
- // Preloads the next task
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- if (config.svelteLevel == RecentsTaskLoader.SVELTE_NONE) {
- Rect windowRect = getWindowRect(null /* windowRectOverride */);
- if (windowRect.isEmpty()) {
- return;
- }
-
- // Load the next task only if we aren't svelte
- ActivityManager.RunningTaskInfo runningTaskInfo =
- ActivityManagerWrapper.getInstance().getRunningTask();
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
- loader.preloadTasks(plan, -1);
- TaskStack stack = plan.getTaskStack();
- RecentsActivityLaunchState launchState = new RecentsActivityLaunchState();
- RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
-
- synchronized (mBackgroundLayoutAlgorithm) {
- // This callback is made when a new activity is launched and the old one is
- // paused so ignore the current activity and try and preload the thumbnail for
- // the previous one.
- updateDummyStackViewLayout(mBackgroundLayoutAlgorithm, stack, windowRect);
-
- // Launched from app is always the worst case (in terms of how many
- // thumbnails/tasks visible)
- launchState.launchedFromApp = true;
- mBackgroundLayoutAlgorithm.update(plan.getTaskStack(), EMPTY_SET, launchState,
- -1 /* lastScrollPPresent */);
- VisibilityReport visibilityReport =
- mBackgroundLayoutAlgorithm.computeStackVisibilityReport(
- stack.getTasks());
-
- launchOpts.runningTaskId = runningTaskInfo != null ? runningTaskInfo.id : -1;
- launchOpts.numVisibleTasks = visibilityReport.numVisibleTasks;
- launchOpts.numVisibleTaskThumbnails = visibilityReport.numVisibleThumbnails;
- launchOpts.onlyLoadForCache = true;
- launchOpts.onlyLoadPausedActivities = true;
- launchOpts.loadThumbnails = true;
- }
- loader.loadTasks(plan, launchOpts);
- }
- }
-
- @Override
- public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
- // Check this is for the right user
- if (!checkCurrentUserId(mContext, false /* debug */)) {
- return;
- }
-
- // This time needs to be fetched the same way the last active time is fetched in
- // {@link TaskRecord#touchActiveTime}
- LegacyRecentsImpl.getConfiguration().getLaunchState().launchedFromPipApp = true;
- LegacyRecentsImpl.getConfiguration().getLaunchState().launchedWithNextPipApp = false;
- EventBus.getDefault().send(new ActivityPinnedEvent(taskId));
- consumeInstanceLoadPlan();
- sLastPipTime = System.currentTimeMillis();
- }
-
- @Override
- public void onActivityUnpinned() {
- // Check this is for the right user
- if (!checkCurrentUserId(mContext, false /* debug */)) {
- return;
- }
-
- EventBus.getDefault().send(new ActivityUnpinnedEvent());
- sLastPipTime = -1;
- }
-
- @Override
- public void onTaskSnapshotChanged(int taskId, ThumbnailData snapshot) {
- // Check this is for the right user
- if (!checkCurrentUserId(mContext, false /* debug */)) {
- return;
- }
-
- EventBus.getDefault().send(new TaskSnapshotChangedEvent(taskId, snapshot));
- }
- }
-
- protected static RecentsTaskLoadPlan sInstanceLoadPlan;
- // Stores the last pinned task time
- protected static long sLastPipTime = -1;
- // Stores whether we are waiting for a transition to/from recents to start. During this time,
- // we disallow the user from manually toggling recents until the transition has started.
- private static boolean mWaitingForTransitionStart = false;
- // Stores whether or not the user toggled while we were waiting for a transition to/from
- // recents. In this case, we defer the toggle state until then and apply it immediately after.
- private static boolean mToggleFollowingTransitionStart = true;
-
- private Runnable mResetToggleFlagListener = new Runnable() {
- @Override
- public void run() {
- setWaitingForTransitionStart(false);
- }
- };
-
- private TrustManager mTrustManager;
- protected Context mContext;
- protected Handler mHandler;
- TaskStackListenerImpl mTaskStackListener;
- boolean mDraggingInRecents;
- boolean mLaunchedWhileDocking;
-
- // Task launching
- Rect mTmpBounds = new Rect();
- TaskViewTransform mTmpTransform = new TaskViewTransform();
- int mTaskBarHeight;
-
- // Header (for transition)
- TaskViewHeader mHeaderBar;
- final Object mHeaderBarLock = new Object();
- private TaskStackView mDummyStackView;
- private TaskStackLayoutAlgorithm mBackgroundLayoutAlgorithm;
-
- // Variables to keep track of if we need to start recents after binding
- protected boolean mTriggeredFromAltTab;
- protected long mLastToggleTime;
- DozeTrigger mFastAltTabTrigger = new DozeTrigger(FAST_ALT_TAB_DELAY_MS, new Runnable() {
- @Override
- public void run() {
- // When this fires, then the user has not released alt-tab for at least
- // FAST_ALT_TAB_DELAY_MS milliseconds
- showRecents(mTriggeredFromAltTab, false /* draggingInRecents */, true /* animate */,
- DividerView.INVALID_RECENTS_GROW_TARGET);
- }
- });
-
- private OverviewProxyService.OverviewProxyListener mOverviewProxyListener =
- new OverviewProxyService.OverviewProxyListener() {
- @Override
- public void onConnectionChanged(boolean isConnected) {
- if (!isConnected) {
- // Clear everything when the connection to the overview service
- LegacyRecentsImpl.getTaskLoader().onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
- }
- }
- };
-
- // Used to reset the dummy stack view
- private final TaskStack mEmptyTaskStack = new TaskStack();
-
- public RecentsImpl(Context context) {
- mContext = context;
- mHandler = new Handler();
- mBackgroundLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, null);
-
- // Initialize the static foreground thread
- ForegroundThread.get();
-
- // Register the task stack listener
- mTaskStackListener = new TaskStackListenerImpl();
- ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
-
- // Initialize the static configuration resources
- mDummyStackView = new TaskStackView(mContext);
- reloadResources();
-
- mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
- }
-
- public void onBootCompleted() {
- // Skip preloading tasks if we are already bound to the service
- if (Dependency.get(OverviewProxyService.class).isEnabled()) {
- return;
- }
-
- // When we start, preload the data associated with the previous recent tasks.
- // We can use a new plan since the caches will be the same.
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
- loader.preloadTasks(plan, -1);
- RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
- launchOpts.numVisibleTasks = loader.getIconCacheSize();
- launchOpts.numVisibleTaskThumbnails = loader.getThumbnailCacheSize();
- launchOpts.onlyLoadForCache = true;
- loader.loadTasks(plan, launchOpts);
- }
-
- public void onConfigurationChanged() {
- reloadResources();
- mDummyStackView.reloadOnConfigurationChange();
- synchronized (mBackgroundLayoutAlgorithm) {
- mBackgroundLayoutAlgorithm.reloadOnConfigurationChange(mContext);
- }
- }
-
- /**
- * This is only called from the system user's Recents. Secondary users will instead proxy their
- * visibility change events through to the system user via
- * {@link LegacyRecentsImpl#onBusEvent(RecentsVisibilityChangedEvent)}.
- */
- public void onVisibilityChanged(Context context, boolean visible) {
- LegacyRecentsImpl.getSystemServices().setRecentsVisibility(visible);
- }
-
- /**
- * This is only called from the system user's Recents. Secondary users will instead proxy their
- * visibility change events through to the system user via
- * {@link LegacyRecentsImpl#onBusEvent(ScreenPinningRequestEvent)}.
- */
- public void onStartScreenPinning(Context context, int taskId) {
- final StatusBar statusBar = getStatusBar();
- if (statusBar != null) {
- statusBar.showScreenPinningRequest(taskId, false);
- }
- }
-
- public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents,
- boolean animate, int growTarget) {
- final SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- final MutableBoolean isHomeStackVisible = new MutableBoolean(true);
- final boolean isRecentsVisible = LegacyRecentsImpl.getSystemServices().isRecentsActivityVisible(
- isHomeStackVisible);
- final boolean fromHome = isHomeStackVisible.value;
- final boolean launchedWhileDockingTask =
- LegacyRecentsImpl.getSystemServices().getSplitScreenPrimaryStack() != null;
-
- mTriggeredFromAltTab = triggeredFromAltTab;
- mDraggingInRecents = draggingInRecents;
- mLaunchedWhileDocking = launchedWhileDockingTask;
- if (mFastAltTabTrigger.isAsleep()) {
- // Fast alt-tab duration has elapsed, fall through to showing Recents and reset
- mFastAltTabTrigger.stopDozing();
- } else if (mFastAltTabTrigger.isDozing()) {
- // Fast alt-tab duration has not elapsed. If this is triggered by a different
- // showRecents() call, then ignore that call for now.
- // TODO: We can not handle quick tabs that happen between the initial showRecents() call
- // that started the activity and the activity starting up. The severity of this
- // is inversely proportional to the FAST_ALT_TAB_DELAY_MS duration though.
- if (!triggeredFromAltTab) {
- return;
- }
- mFastAltTabTrigger.stopDozing();
- } else if (triggeredFromAltTab) {
- // The fast alt-tab detector is not yet running, so start the trigger and wait for the
- // hideRecents() call, or for the fast alt-tab duration to elapse
- mFastAltTabTrigger.startDozing();
- return;
- }
-
- try {
- // Check if the top task is in the home stack, and start the recents activity
- final boolean forceVisible = launchedWhileDockingTask || draggingInRecents;
- if (forceVisible || !isRecentsVisible) {
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- startRecentsActivityAndDismissKeyguardIfNeeded(runningTask,
- isHomeStackVisible.value || fromHome, animate, growTarget);
- }
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "Failed to launch RecentsActivity", e);
- }
- }
-
- public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
- if (triggeredFromAltTab && mFastAltTabTrigger.isDozing()) {
- // The user has released alt-tab before the trigger has run, so just show the next
- // task immediately
- showNextTask();
-
- // Cancel the fast alt-tab trigger
- mFastAltTabTrigger.stopDozing();
- return;
- }
-
- // Defer to the activity to handle hiding recents, if it handles it, then it must still
- // be visible
- EventBus.getDefault().post(new HideRecentsEvent(triggeredFromAltTab,
- triggeredFromHomeKey));
- }
-
- public void toggleRecents(int growTarget) {
- if (ActivityManagerWrapper.getInstance().isScreenPinningActive()) {
- return;
- }
-
- // Skip this toggle if we are already waiting to trigger recents via alt-tab
- if (mFastAltTabTrigger.isDozing()) {
- return;
- }
-
- if (mWaitingForTransitionStart) {
- mToggleFollowingTransitionStart = true;
- return;
- }
-
- mDraggingInRecents = false;
- mLaunchedWhileDocking = false;
- mTriggeredFromAltTab = false;
-
- try {
- MutableBoolean isHomeStackVisible = new MutableBoolean(true);
- long elapsedTime = SystemClock.elapsedRealtime() - mLastToggleTime;
-
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (ssp.isRecentsActivityVisible(isHomeStackVisible)) {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- if (!launchState.launchedWithAltTab) {
- if (LegacyRecentsImpl.getConfiguration().isGridEnabled) {
- // Has the user tapped quickly?
- boolean isQuickTap = elapsedTime < ViewConfiguration.getDoubleTapTimeout();
- if (isQuickTap) {
- EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
- } else {
- EventBus.getDefault().post(new LaunchMostRecentTaskRequestEvent());
- }
- } else {
- // Launch the next focused task
- EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
- }
- } else {
- // If the user has toggled it too quickly, then just eat up the event here (it's
- // better than showing a janky screenshot).
- // NOTE: Ideally, the screenshot mechanism would take the window transform into
- // account
- if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
- return;
- }
-
- EventBus.getDefault().post(new ToggleRecentsEvent());
- mLastToggleTime = SystemClock.elapsedRealtime();
- }
- return;
- } else {
- // If the user has toggled it too quickly, then just eat up the event here (it's
- // better than showing a janky screenshot).
- // NOTE: Ideally, the screenshot mechanism would take the window transform into
- // account
- if (elapsedTime < MIN_TOGGLE_DELAY_MS) {
- return;
- }
-
- // Otherwise, start the recents activity
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- startRecentsActivityAndDismissKeyguardIfNeeded(runningTask,
- isHomeStackVisible.value, true /* animate */, growTarget);
-
- // Only close the other system windows if we are actually showing recents
- ActivityManagerWrapper.getInstance().closeSystemWindows(
- SYSTEM_DIALOG_REASON_RECENT_APPS);
- mLastToggleTime = SystemClock.elapsedRealtime();
- }
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "Failed to launch RecentsActivity", e);
- }
- }
-
- public void preloadRecents() {
- if (ActivityManagerWrapper.getInstance().isScreenPinningActive()) {
- return;
- }
-
- // Skip preloading recents when keyguard is showing
- final StatusBar statusBar = getStatusBar();
- if (statusBar != null && statusBar.isKeyguardShowing()) {
- return;
- }
-
- // Preload only the raw task list into a new load plan (which will be consumed by the
- // RecentsActivity) only if there is a task to animate to. Post this to ensure that we
- // don't block the touch feedback on the nav bar button which triggers this.
- mHandler.post(() -> {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (!ssp.isRecentsActivityVisible(null)) {
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- if (runningTask == null) {
- return;
- }
-
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- sInstanceLoadPlan = new RecentsTaskLoadPlan(mContext);
- loader.preloadTasks(sInstanceLoadPlan, runningTask.id);
- TaskStack stack = sInstanceLoadPlan.getTaskStack();
- if (stack.getTaskCount() > 0) {
- // Only preload the icon (but not the thumbnail since it may not have been taken
- // for the pausing activity)
- preloadIcon(runningTask.id);
-
- // At this point, we don't know anything about the stack state. So only
- // calculate the dimensions of the thumbnail that we need for the transition
- // into Recents, but do not draw it until we construct the activity options when
- // we start Recents
- updateHeaderBarLayout(stack, null /* window rect override*/);
- }
- }
- });
- }
-
- public void cancelPreloadingRecents() {
- // Do nothing
- }
-
- public void onDraggingInRecents(float distanceFromTop) {
- EventBus.getDefault().sendOntoMainThread(new DraggingInRecentsEvent(distanceFromTop));
- }
-
- public void onDraggingInRecentsEnded(float velocity) {
- EventBus.getDefault().sendOntoMainThread(new DraggingInRecentsEndedEvent(velocity));
- }
-
- public void onShowCurrentUserToast(int msgResId, int msgLength) {
- Toast.makeText(mContext, msgResId, msgLength).show();
- }
-
- /**
- * Transitions to the next recent task in the stack.
- */
- public void showNextTask() {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
- loader.preloadTasks(plan, -1);
- TaskStack focusedStack = plan.getTaskStack();
-
- // Return early if there are no tasks in the focused stack
- if (focusedStack == null || focusedStack.getTaskCount() == 0) return;
-
- // Return early if there is no running task
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- if (runningTask == null) return;
-
- // Find the task in the recents list
- boolean isRunningTaskInHomeStack =
- runningTask.configuration.windowConfiguration.getActivityType()
- == ACTIVITY_TYPE_HOME;
- ArrayList<Task> tasks = focusedStack.getTasks();
- Task toTask = null;
- ActivityOptions launchOpts = null;
- int taskCount = tasks.size();
- for (int i = taskCount - 1; i >= 1; i--) {
- Task task = tasks.get(i);
- if (isRunningTaskInHomeStack) {
- toTask = tasks.get(i - 1);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_next_affiliated_task_target,
- R.anim.recents_fast_toggle_app_home_exit);
- break;
- } else if (task.key.id == runningTask.id) {
- toTask = tasks.get(i - 1);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_target,
- R.anim.recents_launch_prev_affiliated_task_source);
- break;
- }
- }
-
- // Return early if there is no next task
- if (toTask == null) {
- ssp.startInPlaceAnimationOnFrontMostApplication(
- ActivityOptions.makeCustomInPlaceAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_bounce));
- return;
- }
-
- // Launch the task
- ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(toTask.key, launchOpts,
- null /* resultCallback */, null /* resultCallbackHandler */);
- }
-
- /**
- * Transitions to the next affiliated task.
- */
- public void showRelativeAffiliatedTask(boolean showNextTask) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsTaskLoadPlan plan = new RecentsTaskLoadPlan(mContext);
- loader.preloadTasks(plan, -1);
- TaskStack focusedStack = plan.getTaskStack();
-
- // Return early if there are no tasks in the focused stack
- if (focusedStack == null || focusedStack.getTaskCount() == 0) return;
-
- // Return early if there is no running task (can't determine affiliated tasks in this case)
- ActivityManager.RunningTaskInfo runningTask =
- ActivityManagerWrapper.getInstance().getRunningTask();
- final int activityType = runningTask.configuration.windowConfiguration.getActivityType();
- if (runningTask == null) return;
- // Return early if the running task is in the home/recents stack (optimization)
- if (activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS) return;
-
- // Find the task in the recents list
- ArrayList<Task> tasks = focusedStack.getTasks();
- Task toTask = null;
- ActivityOptions launchOpts = null;
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- if (task.key.id == runningTask.id) {
- if (showNextTask) {
- if ((i + 1) < taskCount) {
- toTask = tasks.get(i + 1);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_next_affiliated_task_target,
- R.anim.recents_launch_next_affiliated_task_source);
- }
- } else {
- if ((i - 1) >= 0) {
- toTask = tasks.get(i - 1);
- launchOpts = ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_target,
- R.anim.recents_launch_prev_affiliated_task_source);
- }
- }
- break;
- }
- }
-
- // Return early if there is no next task
- if (toTask == null) {
- if (showNextTask) {
- ssp.startInPlaceAnimationOnFrontMostApplication(
- ActivityOptions.makeCustomInPlaceAnimation(mContext,
- R.anim.recents_launch_next_affiliated_task_bounce));
- } else {
- ssp.startInPlaceAnimationOnFrontMostApplication(
- ActivityOptions.makeCustomInPlaceAnimation(mContext,
- R.anim.recents_launch_prev_affiliated_task_bounce));
- }
- return;
- }
-
- // Keep track of actually launched affiliated tasks
- MetricsLogger.count(mContext, "overview_affiliated_task_launch", 1);
-
- // Launch the task
- ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(toTask.key, launchOpts,
- null /* resultListener */, null /* resultCallbackHandler */);
- }
-
- public void splitPrimaryTask(int taskId, int stackCreateMode, Rect initialBounds) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
-
- // Make sure we inform DividerView before we actually start the activity so we can change
- // the resize mode already.
- if (ssp.setTaskWindowingModeSplitScreenPrimary(taskId, stackCreateMode, initialBounds)) {
- EventBus.getDefault().send(new DockedTopTaskEvent(initialBounds));
- }
- }
-
- public void setWaitingForTransitionStart(boolean waitingForTransitionStart) {
- if (mWaitingForTransitionStart == waitingForTransitionStart) {
- return;
- }
-
- mWaitingForTransitionStart = waitingForTransitionStart;
- if (!waitingForTransitionStart && mToggleFollowingTransitionStart) {
- mHandler.post(() -> toggleRecents(DividerView.INVALID_RECENTS_GROW_TARGET));
- }
- mToggleFollowingTransitionStart = false;
- }
-
- /**
- * Returns the preloaded load plan and invalidates it.
- */
- public static RecentsTaskLoadPlan consumeInstanceLoadPlan() {
- RecentsTaskLoadPlan plan = sInstanceLoadPlan;
- sInstanceLoadPlan = null;
- return plan;
- }
-
- /**
- * @return the time at which a task last entered picture-in-picture.
- */
- public static long getLastPipTime() {
- return sLastPipTime;
- }
-
- /**
- * Clears the time at which a task last entered picture-in-picture.
- */
- public static void clearLastPipTime() {
- sLastPipTime = -1;
- }
-
- /**
- * Reloads all the resources for the current configuration.
- */
- private void reloadResources() {
- Resources res = mContext.getResources();
-
- mTaskBarHeight = TaskStackLayoutAlgorithm.getDimensionForDevice(mContext,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_grid_task_view_header_height);
-
- LayoutInflater inflater = LayoutInflater.from(mContext);
- mHeaderBar = (TaskViewHeader) inflater.inflate(R.layout.recents_task_view_header,
- null, false);
- mHeaderBar.setLayoutDirection(res.getConfiguration().getLayoutDirection());
- }
-
- private void updateDummyStackViewLayout(TaskStackLayoutAlgorithm stackLayout,
- TaskStack stack, Rect windowRect) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- Rect displayRect = ssp.getDisplayRect();
- Rect systemInsets = new Rect();
- ssp.getStableInsets(systemInsets);
-
- // When docked, the nav bar insets are consumed and the activity is measured without insets.
- // However, the window bounds include the insets, so we need to subtract them here to make
- // them identical.
- if (ssp.hasDockedTask()) {
- if (systemInsets.bottom < windowRect.height()) {
- // Only apply inset if it isn't going to cause the rect height to go negative.
- windowRect.bottom -= systemInsets.bottom;
- }
- systemInsets.bottom = 0;
- }
- calculateWindowStableInsets(systemInsets, windowRect, displayRect);
- windowRect.offsetTo(0, 0);
-
- // Rebind the header bar and draw it for the transition
- stackLayout.setSystemInsets(systemInsets);
- if (stack != null) {
- stackLayout.getTaskStackBounds(displayRect, windowRect, systemInsets.top,
- systemInsets.left, systemInsets.right, mTmpBounds);
- stackLayout.reset();
- stackLayout.initialize(displayRect, windowRect, mTmpBounds);
- }
- }
-
- private Rect getWindowRect(Rect windowRectOverride) {
- return windowRectOverride != null
- ? new Rect(windowRectOverride)
- : LegacyRecentsImpl.getSystemServices().getWindowRect();
- }
-
- /**
- * Prepares the header bar layout for the next transition, if the task view bounds has changed
- * since the last call, it will attempt to re-measure and layout the header bar to the new size.
- *
- * @param stack the stack to initialize the stack layout with
- * @param windowRectOverride the rectangle to use when calculating the stack state which can
- * be different from the current window rect if recents is resizing
- * while being launched
- */
- private void updateHeaderBarLayout(TaskStack stack, Rect windowRectOverride) {
- Rect windowRect = getWindowRect(windowRectOverride);
- int taskViewWidth = 0;
- boolean useGridLayout = mDummyStackView.useGridLayout();
- updateDummyStackViewLayout(mDummyStackView.getStackAlgorithm(), stack, windowRect);
- if (stack != null) {
- TaskStackLayoutAlgorithm stackLayout = mDummyStackView.getStackAlgorithm();
- mDummyStackView.getStack().removeAllTasks(false /* notifyStackChanges */);
- mDummyStackView.setTasks(stack, false /* allowNotifyStackChanges */);
- // Get the width of a task view so that we know how wide to draw the header bar.
- if (useGridLayout) {
- TaskGridLayoutAlgorithm gridLayout = mDummyStackView.getGridAlgorithm();
- gridLayout.initialize(windowRect);
- taskViewWidth = (int) gridLayout.getTransform(0 /* taskIndex */,
- stack.getTaskCount(), new TaskViewTransform(),
- stackLayout).rect.width();
- } else {
- Rect taskViewBounds = stackLayout.getUntransformedTaskViewBounds();
- if (!taskViewBounds.isEmpty()) {
- taskViewWidth = taskViewBounds.width();
- }
- }
- }
-
- if (stack != null && taskViewWidth > 0) {
- synchronized (mHeaderBarLock) {
- if (mHeaderBar.getMeasuredWidth() != taskViewWidth ||
- mHeaderBar.getMeasuredHeight() != mTaskBarHeight) {
- if (useGridLayout) {
- mHeaderBar.setShouldDarkenBackgroundColor(true);
- mHeaderBar.setNoUserInteractionState();
- }
- mHeaderBar.forceLayout();
- mHeaderBar.measure(
- MeasureSpec.makeMeasureSpec(taskViewWidth, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(mTaskBarHeight, MeasureSpec.EXACTLY));
- }
- mHeaderBar.layout(0, 0, taskViewWidth, mTaskBarHeight);
- }
- }
- }
-
- /**
- * Given the stable insets and the rect for our window, calculates the insets that affect our
- * window.
- */
- private void calculateWindowStableInsets(Rect inOutInsets, Rect windowRect, Rect displayRect) {
-
- // Display rect without insets - available app space
- Rect appRect = new Rect(displayRect);
- appRect.inset(inOutInsets);
-
- // Our window intersected with available app space
- Rect windowRectWithInsets = new Rect(windowRect);
- windowRectWithInsets.intersect(appRect);
- inOutInsets.left = windowRectWithInsets.left - windowRect.left;
- inOutInsets.top = windowRectWithInsets.top - windowRect.top;
- inOutInsets.right = windowRect.right - windowRectWithInsets.right;
- inOutInsets.bottom = windowRect.bottom - windowRectWithInsets.bottom;
- }
-
- /**
- * Preloads the icon of a task.
- */
- private void preloadIcon(int runningTaskId) {
- // Ensure that we load the running task's icon
- RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
- launchOpts.runningTaskId = runningTaskId;
- launchOpts.loadThumbnails = false;
- launchOpts.onlyLoadForCache = true;
- LegacyRecentsImpl.getTaskLoader().loadTasks(sInstanceLoadPlan, launchOpts);
- }
-
- /**
- * Creates the activity options for a unknown state->recents transition.
- */
- protected ActivityOptions getUnknownTransitionActivityOptions() {
- return ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_from_unknown_enter,
- R.anim.recents_from_unknown_exit,
- mHandler, null);
- }
-
- /**
- * Creates the activity options for a home->recents transition.
- */
- protected ActivityOptions getHomeTransitionActivityOptions() {
- return ActivityOptions.makeCustomAnimation(mContext,
- R.anim.recents_from_launcher_enter,
- R.anim.recents_from_launcher_exit,
- mHandler, null);
- }
-
- /**
- * Creates the activity options for an app->recents transition.
- */
- private Pair<ActivityOptions, AppTransitionAnimationSpecsFuture>
- getThumbnailTransitionActivityOptions(ActivityManager.RunningTaskInfo runningTask,
- Rect windowOverrideRect) {
- final boolean isLowRamDevice = LegacyRecentsImpl.getConfiguration().isLowRamDevice;
-
- // Update the destination rect
- Task toTask = new Task();
- TaskViewTransform toTransform = getThumbnailTransitionTransform(mDummyStackView, toTask,
- windowOverrideRect);
-
- RectF toTaskRect = toTransform.rect;
- AppTransitionAnimationSpecsFuture future = new AppTransitionAnimationSpecsFuture(mHandler) {
- @Override
- public List<AppTransitionAnimationSpecCompat> composeSpecs() {
- Rect rect = new Rect();
- toTaskRect.round(rect);
- Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform);
- return Lists.newArrayList(new AppTransitionAnimationSpecCompat(toTask.key.id,
- thumbnail, rect));
- }
- };
-
- // For low end ram devices, wait for transition flag is reset when Recents entrance
- // animation is complete instead of when the transition animation starts
- return new Pair<>(RecentsTransition.createAspectScaleAnimation(mContext, mHandler,
- false /* scaleUp */, future, isLowRamDevice ? null : mResetToggleFlagListener),
- future);
- }
-
- /**
- * Returns the transition rect for the given task id.
- */
- private TaskViewTransform getThumbnailTransitionTransform(TaskStackView stackView,
- Task runningTaskOut, Rect windowOverrideRect) {
- // Find the running task in the TaskStack
- TaskStack stack = stackView.getStack();
- Task launchTask = stack.getLaunchTarget();
- if (launchTask != null) {
- runningTaskOut.copyFrom(launchTask);
- } else {
- // If no task is specified or we can not find the task just use the front most one
- launchTask = stack.getFrontMostTask();
- runningTaskOut.copyFrom(launchTask);
- }
-
- // Get the transform for the running task
- stackView.updateLayoutAlgorithm(true /* boundScroll */);
- stackView.updateToInitialState();
- stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
- stackView.getScroller().getStackScroll(), mTmpTransform, null, windowOverrideRect);
- return mTmpTransform;
- }
-
- /**
- * Draws the header of a task used for the window animation into a bitmap.
- */
- private Bitmap drawThumbnailTransitionBitmap(Task toTask,
- TaskViewTransform toTransform) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- int width = (int) toTransform.rect.width();
- int height = (int) toTransform.rect.height();
- if (toTransform != null && toTask.key != null && width > 0 && height > 0) {
- synchronized (mHeaderBarLock) {
- boolean disabledInSafeMode = !toTask.isSystemApp && ssp.isInSafeMode();
- mHeaderBar.onTaskViewSizeChanged(width, height);
- if (RecentsDebugFlags.Static.EnableTransitionThumbnailDebugMode) {
- return RecentsTransition.drawViewIntoHardwareBitmap(width, mTaskBarHeight,
- null, 1f, 0xFFff0000);
- } else {
- // Workaround for b/27815919, reset the callback so that we do not trigger an
- // invalidate on the header bar as a result of updating the icon
- Drawable icon = mHeaderBar.getIconView().getDrawable();
- if (icon != null) {
- icon.setCallback(null);
- }
- mHeaderBar.bindToTask(toTask, false /* touchExplorationEnabled */,
- disabledInSafeMode);
- mHeaderBar.onTaskDataLoaded();
- mHeaderBar.setDimAlpha(toTransform.dimAlpha);
- return RecentsTransition.drawViewIntoHardwareBitmap(width, mTaskBarHeight,
- mHeaderBar, 1f, 0);
- }
- }
- }
- return null;
- }
-
- /**
- * Shows the recents activity after dismissing the keyguard if visible
- */
- protected void startRecentsActivityAndDismissKeyguardIfNeeded(
- final ActivityManager.RunningTaskInfo runningTask, final boolean isHomeStackVisible,
- final boolean animate, final int growTarget) {
- // Preload only if device for current user is unlocked
- final StatusBar statusBar = getStatusBar();
- if (statusBar != null && statusBar.isKeyguardShowing()) {
- statusBar.executeRunnableDismissingKeyguard(() -> {
- // Flush trustmanager before checking device locked per user when preloading
- mTrustManager.reportKeyguardShowingChanged();
- mHandler.post(() -> startRecentsActivity(runningTask, isHomeStackVisible,
- animate, growTarget));
- }, null, true /* dismissShade */, false /* afterKeyguardGone */,
- true /* deferred */);
- } else {
- startRecentsActivity(runningTask, isHomeStackVisible, animate, growTarget);
- }
- }
-
- private void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask,
- boolean isHomeStackVisible, boolean animate, int growTarget) {
- RecentsTaskLoader loader = LegacyRecentsImpl.getTaskLoader();
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
-
- int runningTaskId = !mLaunchedWhileDocking && (runningTask != null)
- ? runningTask.id
- : -1;
-
- // In the case where alt-tab is triggered, we never get a preloadRecents() call, so we
- // should always preload the tasks now. If we are dragging in recents, reload them as
- // the stacks might have changed.
- if (mLaunchedWhileDocking || mTriggeredFromAltTab || sInstanceLoadPlan == null) {
- // Create a new load plan if preloadRecents() was never triggered
- sInstanceLoadPlan = new RecentsTaskLoadPlan(mContext);
- }
- if (mLaunchedWhileDocking || mTriggeredFromAltTab || !sInstanceLoadPlan.hasTasks()) {
- loader.preloadTasks(sInstanceLoadPlan, runningTaskId);
- }
-
- TaskStack stack = sInstanceLoadPlan.getTaskStack();
- boolean hasRecentTasks = stack.getTaskCount() > 0;
- boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible &&
- hasRecentTasks;
-
- // Update the launch state that we need in updateHeaderBarLayout()
- launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking;
- launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking;
- launchState.launchedFromPipApp = false;
- launchState.launchedWithNextPipApp =
- stack.isNextLaunchTargetPip(RecentsImpl.getLastPipTime());
- launchState.launchedViaDockGesture = mLaunchedWhileDocking;
- launchState.launchedViaDragGesture = mDraggingInRecents;
- launchState.launchedToTaskId = runningTaskId;
- launchState.launchedWithAltTab = mTriggeredFromAltTab;
-
- // Disable toggling of recents between starting the activity and it is visible and the app
- // has started its transition into recents.
- setWaitingForTransitionStart(useThumbnailTransition);
-
- // Preload the icon (this will be a null-op if we have preloaded the icon already in
- // preloadRecents())
- preloadIcon(runningTaskId);
-
- // Update the header bar if necessary
- Rect windowOverrideRect = getWindowRectOverride(growTarget);
- updateHeaderBarLayout(stack, windowOverrideRect);
-
- // Prepare the dummy stack for the transition
- TaskStackLayoutAlgorithm.VisibilityReport stackVr =
- mDummyStackView.computeStackVisibilityReport();
-
- // Update the remaining launch state
- launchState.launchedNumVisibleTasks = stackVr.numVisibleTasks;
- launchState.launchedNumVisibleThumbnails = stackVr.numVisibleThumbnails;
-
- if (!animate) {
- startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1),
- null /* future */);
- return;
- }
-
- Pair<ActivityOptions, AppTransitionAnimationSpecsFuture> pair;
- if (useThumbnailTransition) {
- // Try starting with a thumbnail transition
- pair = getThumbnailTransitionActivityOptions(runningTask, windowOverrideRect);
- } else {
- // If there is no thumbnail transition, but is launching from home into recents, then
- // use a quick home transition
- pair = new Pair<>(hasRecentTasks
- ? getHomeTransitionActivityOptions()
- : getUnknownTransitionActivityOptions(), null);
- }
- startRecentsActivity(pair.first, pair.second);
- mLastToggleTime = SystemClock.elapsedRealtime();
- }
-
- private Rect getWindowRectOverride(int growTarget) {
- if (growTarget == DividerView.INVALID_RECENTS_GROW_TARGET) {
- return SystemServicesProxy.getInstance(mContext).getWindowRect();
- }
- Rect result = new Rect();
- Rect displayRect = LegacyRecentsImpl.getSystemServices().getDisplayRect();
- DockedDividerUtils.calculateBoundsForPosition(growTarget, WindowManager.DOCKED_BOTTOM,
- result, displayRect.width(), displayRect.height(),
- LegacyRecentsImpl.getSystemServices().getDockedDividerSize(mContext));
- return result;
- }
-
- private StatusBar getStatusBar() {
- return SysUiServiceProvider.getComponent(mContext, StatusBar.class);
- }
-
- /**
- * Starts the recents activity.
- */
- private void startRecentsActivity(ActivityOptions opts,
- final AppTransitionAnimationSpecsFuture future) {
- Intent intent = new Intent();
- intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
- HidePipMenuEvent hideMenuEvent = new HidePipMenuEvent();
- hideMenuEvent.addPostAnimationCallback(() -> {
- LegacyRecentsImpl.getSystemServices().startActivityAsUserAsync(intent, opts);
- EventBus.getDefault().send(new RecentsActivityStartingEvent());
- if (future != null) {
- future.composeSpecsSynchronous();
- }
- });
- EventBus.getDefault().send(hideMenuEvent);
-
- // Once we have launched the activity, reset the dummy stack view tasks so we don't hold
- // onto references to the same tasks consumed by the activity
- mDummyStackView.setTasks(mEmptyTaskStack, false /* notifyStackChanges */);
- }
-
- /**** OnAnimationFinishedListener Implementation ****/
-
- @Override
- public void onAnimationFinished() {
- EventBus.getDefault().post(new EnterRecentsWindowLastAnimationFrameEvent());
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImplProxy.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImplProxy.java
deleted file mode 100644
index a1da785..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsImplProxy.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents;
-
-import android.graphics.Rect;
-import android.os.Handler;
-import android.os.Message;
-import android.os.RemoteException;
-
-import com.android.internal.os.SomeArgs;
-
-/**
- * A proxy class which directs all methods from {@link IRecentsNonSystemUserCallbacks} to
- * {@link RecentsImpl} and makes sure they are called from the main thread.
- */
-public class RecentsImplProxy extends IRecentsNonSystemUserCallbacks.Stub {
-
- private static final int MSG_PRELOAD_RECENTS = 1;
- private static final int MSG_CANCEL_PRELOADING_RECENTS = 2;
- private static final int MSG_SHOW_RECENTS = 3;
- private static final int MSG_HIDE_RECENTS = 4;
- private static final int MSG_TOGGLE_RECENTS = 5;
- private static final int MSG_ON_CONFIGURATION_CHANGED = 6;
- private static final int MSG_DOCK_TOP_TASK = 7;
- private static final int MSG_ON_DRAGGING_IN_RECENTS = 8;
- private static final int MSG_ON_DRAGGING_IN_RECENTS_ENDED = 9;
- private static final int MSG_SHOW_USER_TOAST = 10;
-
- private RecentsImpl mImpl;
-
- public RecentsImplProxy(RecentsImpl recentsImpl) {
- mImpl = recentsImpl;
- }
-
- @Override
- public void preloadRecents() throws RemoteException {
- mHandler.sendEmptyMessage(MSG_PRELOAD_RECENTS);
- }
-
- @Override
- public void cancelPreloadingRecents() throws RemoteException {
- mHandler.sendEmptyMessage(MSG_CANCEL_PRELOADING_RECENTS);
- }
-
- @Override
- public void showRecents(boolean triggeredFromAltTab, boolean draggingInRecents, boolean animate,
- int growTarget) throws RemoteException {
- SomeArgs args = SomeArgs.obtain();
- args.argi1 = triggeredFromAltTab ? 1 : 0;
- args.argi2 = draggingInRecents ? 1 : 0;
- args.argi3 = animate ? 1 : 0;
- args.argi4 = growTarget;
- mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_RECENTS, args));
- }
-
- @Override
- public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey)
- throws RemoteException {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_HIDE_RECENTS, triggeredFromAltTab ? 1 :0,
- triggeredFromHomeKey ? 1 : 0));
- }
-
- @Override
- public void toggleRecents(int growTarget) throws RemoteException {
- SomeArgs args = SomeArgs.obtain();
- args.argi1 = growTarget;
- mHandler.sendMessage(mHandler.obtainMessage(MSG_TOGGLE_RECENTS, args));
- }
-
- @Override
- public void onConfigurationChanged() throws RemoteException {
- mHandler.sendEmptyMessage(MSG_ON_CONFIGURATION_CHANGED);
- }
-
- @Override
- public void splitPrimaryTask(int topTaskId, int stackCreateMode, Rect initialBounds)
- throws RemoteException {
- SomeArgs args = SomeArgs.obtain();
- args.argi1 = topTaskId;
- args.argi2 = stackCreateMode;
- args.arg1 = initialBounds;
- mHandler.sendMessage(mHandler.obtainMessage(MSG_DOCK_TOP_TASK, args));
- }
-
- @Override
- public void onDraggingInRecents(float distanceFromTop) throws RemoteException {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_DRAGGING_IN_RECENTS, distanceFromTop));
- }
-
- @Override
- public void onDraggingInRecentsEnded(float velocity) throws RemoteException {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_DRAGGING_IN_RECENTS_ENDED, velocity));
- }
-
- @Override
- public void showCurrentUserToast(int msgResId, int msgLength) {
- mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_USER_TOAST, msgResId, msgLength));
- }
-
- private final Handler mHandler = new Handler() {
-
- @Override
- public void handleMessage(Message msg) {
- SomeArgs args;
- switch (msg.what) {
- case MSG_PRELOAD_RECENTS:
- mImpl.preloadRecents();
- break;
- case MSG_CANCEL_PRELOADING_RECENTS:
- mImpl.cancelPreloadingRecents();
- break;
- case MSG_SHOW_RECENTS:
- args = (SomeArgs) msg.obj;
- mImpl.showRecents(args.argi1 != 0, args.argi2 != 0, args.argi3 != 0,
- args.argi4);
- break;
- case MSG_HIDE_RECENTS:
- mImpl.hideRecents(msg.arg1 != 0, msg.arg2 != 0);
- break;
- case MSG_TOGGLE_RECENTS:
- args = (SomeArgs) msg.obj;
- mImpl.toggleRecents(args.argi1);
- break;
- case MSG_ON_CONFIGURATION_CHANGED:
- mImpl.onConfigurationChanged();
- break;
- case MSG_DOCK_TOP_TASK:
- args = (SomeArgs) msg.obj;
- mImpl.splitPrimaryTask(args.argi1, args.argi2 = 0,
- (Rect) args.arg1);
- break;
- case MSG_ON_DRAGGING_IN_RECENTS:
- mImpl.onDraggingInRecents((Float) msg.obj);
- break;
- case MSG_ON_DRAGGING_IN_RECENTS_ENDED:
- mImpl.onDraggingInRecentsEnded((Float) msg.obj);
- break;
- case MSG_SHOW_USER_TOAST:
- mImpl.onShowCurrentUserToast(msg.arg1, msg.arg2);
- break;
- default:
- super.handleMessage(msg);
- }
- super.handleMessage(msg);
- }
- };
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUser.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUser.java
deleted file mode 100644
index c5e9f04..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUser.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.EventLog;
-import android.util.Log;
-import android.util.SparseArray;
-
-import com.android.systemui.EventLogConstants;
-import com.android.systemui.EventLogTags;
-import com.android.systemui.pip.phone.ForegroundThread;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
-import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
-import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
-import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
-
-/**
- * An implementation of the system user's Recents interface to be called remotely by secondary
- * users.
- */
-public class RecentsSystemUser extends IRecentsSystemUserCallbacks.Stub {
-
- private static final String TAG = "RecentsSystemUser";
-
- private Context mContext;
- private RecentsImpl mImpl;
- private final SparseArray<IRecentsNonSystemUserCallbacks> mNonSystemUserRecents =
- new SparseArray<>();
-
- public RecentsSystemUser(Context context, RecentsImpl impl) {
- mContext = context;
- mImpl = impl;
- }
-
- @Override
- public void registerNonSystemUserCallbacks(final IBinder nonSystemUserCallbacks,
- final int userId) {
- try {
- final IRecentsNonSystemUserCallbacks callback =
- IRecentsNonSystemUserCallbacks.Stub.asInterface(nonSystemUserCallbacks);
- nonSystemUserCallbacks.linkToDeath(new IBinder.DeathRecipient() {
- @Override
- public void binderDied() {
- mNonSystemUserRecents.removeAt(mNonSystemUserRecents.indexOfValue(callback));
- EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
- EventLogConstants.SYSUI_RECENTS_CONNECTION_SYSTEM_UNREGISTER_USER,
- userId);
- }
- }, 0);
- mNonSystemUserRecents.put(userId, callback);
- EventLog.writeEvent(EventLogTags.SYSUI_RECENTS_CONNECTION,
- EventLogConstants.SYSUI_RECENTS_CONNECTION_SYSTEM_REGISTER_USER, userId);
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to register NonSystemUserCallbacks", e);
- }
- }
-
- public IRecentsNonSystemUserCallbacks getNonSystemUserRecentsForUser(int userId) {
- return mNonSystemUserRecents.get(userId);
- }
-
- @Override
- public void updateRecentsVisibility(boolean visible) {
- ForegroundThread.getHandler().post(() -> {
- mImpl.onVisibilityChanged(mContext, visible);
- });
- }
-
- @Override
- public void startScreenPinning(int taskId) {
- ForegroundThread.getHandler().post(() -> {
- mImpl.onStartScreenPinning(mContext, taskId);
- });
- }
-
- @Override
- public void sendRecentsDrawnEvent() {
- EventBus.getDefault().post(new RecentsDrawnEvent());
- }
-
- @Override
- public void sendDockingTopTaskEvent(Rect initialRect) throws RemoteException {
- EventBus.getDefault().post(new DockedTopTaskEvent(initialRect));
- }
-
- @Override
- public void sendLaunchRecentsEvent() throws RemoteException {
- EventBus.getDefault().post(new RecentsActivityStartingEvent());
- }
-
- @Override
- public void sendDockedFirstAnimationFrameEvent() throws RemoteException {
- EventBus.getDefault().post(new DockedFirstAnimationFrameEvent());
- }
-
- @Override
- public void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart) {
- EventBus.getDefault().post(new SetWaitingForTransitionStartEvent(
- waitingForTransitionStart));
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUserService.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUserService.java
deleted file mode 100644
index b5a0181..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/RecentsSystemUserService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2010 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.systemui.recents;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-import android.util.Log;
-
-import com.android.systemui.SysUiServiceProvider;
-
-/**
- * A strictly system-user service that is started by the secondary user's Recents (with a limited
- * lifespan), to get the interface that the secondary user's Recents can call through to the system
- * user's Recents.
- */
-public class RecentsSystemUserService extends Service {
-
- private static final String TAG = "RecentsSystemUserService";
- private static final boolean DEBUG = false;
-
- @Override
- public void onCreate() {
- super.onCreate();
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- LegacyRecentsImpl recents = SysUiServiceProvider.getComponent(this, LegacyRecentsImpl.class);
- if (DEBUG) {
- Log.d(TAG, "onBind: " + recents);
- }
- if (recents != null) {
- return recents.getSystemUserCallbacks();
- }
- return null;
- }
-}
-
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/EventBus.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/EventBus.java
deleted file mode 100644
index 177362c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/EventBus.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.events;
-
-import android.os.Handler;
-import android.os.Looper;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.util.Log;
-
-import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-
-import java.io.PrintWriter;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Represents a subscriber, which implements various event bus handler methods.
- */
-class Subscriber {
- private WeakReference<Object> mSubscriber;
-
- long registrationTime;
-
- Subscriber(Object subscriber, long registrationTime) {
- mSubscriber = new WeakReference<>(subscriber);
- this.registrationTime = registrationTime;
- }
-
- public String toString(int priority) {
- Object sub = mSubscriber.get();
- String id = Integer.toHexString(System.identityHashCode(sub));
- return sub.getClass().getSimpleName() + " [0x" + id + ", P" + priority + "]";
- }
-
- public Object getReference() {
- return mSubscriber.get();
- }
-}
-
-/**
- * Represents an event handler with a priority.
- */
-class EventHandler {
- int priority;
- Subscriber subscriber;
- EventHandlerMethod method;
-
- EventHandler(Subscriber subscriber, EventHandlerMethod method, int priority) {
- this.subscriber = subscriber;
- this.method = method;
- this.priority = priority;
- }
-
- @Override
- public String toString() {
- return subscriber.toString(priority) + " " + method.toString();
- }
-}
-
-/**
- * Represents the low level method handling a particular event.
- */
-class EventHandlerMethod {
- private Method mMethod;
- Class<? extends EventBus.Event> eventType;
-
- EventHandlerMethod(Method method, Class<? extends EventBus.Event> eventType) {
- mMethod = method;
- mMethod.setAccessible(true);
- this.eventType = eventType;
- }
-
- public void invoke(Object target, EventBus.Event event)
- throws InvocationTargetException, IllegalAccessException {
- mMethod.invoke(target, event);
- }
-
- @Override
- public String toString() {
- return mMethod.getName() + "(" + eventType.getSimpleName() + ")";
- }
-}
-
-/**
- * A simple in-process event bus. It is simple because we can make assumptions about the state of
- * SystemUI and Recent's lifecycle.
- *
- * <p>
- * Currently, there is a single EventBus that handles {@link EventBus.Event}s for each subscriber
- * on the main application thread. Publishers can send() events to synchronously call subscribers
- * of that event, or post() events to be processed in the next run of the {@link Looper}.
- *
- * <p>
- * Subscribers must be registered with a particular EventBus before they will receive events, and
- * handler methods must match a specific signature.
- *
- * <p>
- * Event method signature:<ul>
- * <li>Methods must be public final
- * <li>Methods must return void
- * <li>Methods must be called "onBusEvent"
- * <li>Methods must take one parameter, of class type deriving from {@link EventBus.Event}
- * </ul>
- *
- * </p>
- * Each subscriber can be registered with a given priority (default 1), and events will be dispatch
- * in decreasing order of priority. For subscribers with the same priority, events will be
- * dispatched by latest registration time to earliest.
- *
- * <p>
- * Caveats:<ul>
- * <li>The EventBus keeps a {@link WeakReference} to the publisher to prevent memory leaks, so
- * there must be another strong reference to the publisher for it to not get garbage-collected and
- * continue receiving events.
- * <li>Because the event handlers are called back using reflection, the EventBus is not intended
- * for use in tight, performance criticial loops. For most user input/system callback events, this
- * is generally of low enough frequency to use the EventBus.
- * <li>Because the event handlers are called back using reflection, there will often be no
- * references to them from actual code. The proguard configuration will be need to be updated to
- * keep these extra methods:
- *
- * -keepclassmembers class ** {
- * public void onBusEvent(**);
- * public void onInterprocessBusEvent(**);
- * }
- * -keepclassmembers class ** extends **.EventBus$InterprocessEvent {
- * public <init>(android.os.Bundle);
- * }
- *
- * <li>Subscriber registration can be expensive depending on the subscriber's {@link Class}. This
- * is only done once per class type, but if possible, it is best to pre-register an instance of
- * that class beforehand or when idle.
- * <li>Each event should be sent once. Events may hold internal information about the current
- * dispatch, or may be queued to be dispatched on another thread (if posted from a non-main thread),
- * so it may be unsafe to edit, change, or re-send the event again.
- * <li>Events should follow a pattern of public-final POD (plain old data) objects, where they are
- * initialized by the constructor and read by each subscriber of that event. Subscribers should
- * never alter events as they are processed, and this enforces that pattern.
- * </ul>
- *
- * <p>
- * Future optimizations:
- * <li>throw exception/log when a subscriber loses the reference
- * <li>trace cost per registration & invocation
- * <li>trace cross-process invocation
- * <li>register(subscriber, Class<?>...) -- pass in exact class types you want registered
- * <li>setSubscriberEventHandlerPriority(subscriber, Class<Event>, priority)
- * <li>allow subscribers to implement interface, ie. EventBus.Subscriber, which lets then test a
- * message before invocation (ie. check if task id == this task id)
- * <li>add postOnce() which automatically debounces
- * <li>add postDelayed() which delays / postDelayedOnce() which delays and bounces
- * <li>consolidate register() and registerInterprocess()
- * <li>sendForResult<ReturnType>(Event) to send and get a result, but who will send the
- * result?
- * </p>
- */
-public class EventBus {
-
- private static final String TAG = "EventBus";
- private static final boolean DEBUG_TRACE_ALL = false;
-
- /**
- * An event super class that allows us to track internal event state across subscriber
- * invocations.
- *
- * Events should not be edited by subscribers.
- */
- public static class Event implements Cloneable {
- // Indicates that this event's dispatch should be traced and logged to logcat
- boolean trace;
- // Indicates that this event must be posted on the EventBus's looper thread before invocation
- boolean requiresPost;
- // Not currently exposed, allows a subscriber to cancel further dispatch of this event
- boolean cancelled;
-
- // Only accessible from derived events
- protected Event() {}
-
- /**
- * Called by the EventBus prior to dispatching this event to any subscriber of this event.
- */
- void onPreDispatch() {
- // Do nothing
- }
-
- /**
- * Called by the EventBus after dispatching this event to every subscriber of this event.
- */
- void onPostDispatch() {
- // Do nothing
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- Event evt = (Event) super.clone();
- // When cloning an event, reset the cancelled-dispatch state
- evt.cancelled = false;
- return evt;
- }
- }
-
- /**
- * An event that represents an animated state change, which allows subscribers to coordinate
- * callbacks which happen after the animation has taken place.
- *
- * Internally, it is guaranteed that increment() and decrement() will be called before and the
- * after the event is dispatched.
- */
- public static class AnimatedEvent extends Event {
-
- private final ReferenceCountedTrigger mTrigger = new ReferenceCountedTrigger();
-
- // Only accessible from derived events
- protected AnimatedEvent() {}
-
- /**
- * Returns the reference counted trigger that coordinates the animations for this event.
- */
- public ReferenceCountedTrigger getAnimationTrigger() {
- return mTrigger;
- }
-
- /**
- * Adds a callback that is guaranteed to be called after the state has changed regardless of
- * whether an actual animation took place.
- */
- public void addPostAnimationCallback(Runnable r) {
- mTrigger.addLastDecrementRunnable(r);
- }
-
- @Override
- void onPreDispatch() {
- mTrigger.increment();
- }
-
- @Override
- void onPostDispatch() {
- mTrigger.decrement();
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- throw new CloneNotSupportedException();
- }
- }
-
- /**
- * An event that can be reusable, only used for situations where we want to reduce memory
- * allocations when events are sent frequently (ie. on scroll).
- */
- public static class ReusableEvent extends Event {
-
- private int mDispatchCount;
-
- protected ReusableEvent() {}
-
- @Override
- void onPostDispatch() {
- super.onPostDispatch();
- mDispatchCount++;
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- throw new CloneNotSupportedException();
- }
- }
-
- /**
- * Proguard must also know, and keep, all methods matching this signature.
- *
- * -keepclassmembers class ** {
- * public void onBusEvent(**);
- * public void onInterprocessBusEvent(**);
- * }
- */
- private static final String METHOD_PREFIX = "onBusEvent";
-
- // The default priority of all subscribers
- private static final int DEFAULT_SUBSCRIBER_PRIORITY = 1;
-
- // Orders the handlers by priority and registration time
- private static final Comparator<EventHandler> EVENT_HANDLER_COMPARATOR = new Comparator<EventHandler>() {
- @Override
- public int compare(EventHandler h1, EventHandler h2) {
- // Rank the handlers by priority descending, followed by registration time descending.
- // aka. the later registered
- if (h1.priority != h2.priority) {
- return h2.priority - h1.priority;
- } else {
- return Long.compare(h2.subscriber.registrationTime, h1.subscriber.registrationTime);
- }
- }
- };
-
- // Used for initializing the default bus
- private static final Object sLock = new Object();
- private static volatile EventBus sDefaultBus;
-
- // The handler to post all events
- private Handler mHandler;
-
- /**
- * Map from event class -> event handler list. Keeps track of the actual mapping from event
- * to subscriber method.
- */
- private HashMap<Class<? extends Event>, ArrayList<EventHandler>> mEventTypeMap = new HashMap<>();
-
- /**
- * Map from subscriber class -> event handler method lists. Used to determine upon registration
- * of a new subscriber whether we need to read all the subscriber's methods again using
- * reflection or whether we can just add the subscriber to the event type map.
- */
- private HashMap<Class<? extends Object>, ArrayList<EventHandlerMethod>> mSubscriberTypeMap = new HashMap<>();
-
- /**
- * Set of all currently registered subscribers
- */
- private ArrayList<Subscriber> mSubscribers = new ArrayList<>();
-
- // For tracing
- private int mCallCount;
- private long mCallDurationMicros;
-
- /**
- * Private constructor to create an event bus for a given looper.
- */
- private EventBus(Looper looper) {
- mHandler = new Handler(looper);
- }
-
- /**
- * @return the default event bus for the application's main thread.
- */
- public static EventBus getDefault() {
- if (sDefaultBus == null)
- synchronized (sLock) {
- if (sDefaultBus == null) {
- if (DEBUG_TRACE_ALL) {
- logWithPid("New EventBus");
- }
- sDefaultBus = new EventBus(Looper.getMainLooper());
- }
- }
- return sDefaultBus;
- }
-
- /**
- * Registers a subscriber to receive events with the default priority.
- *
- * @param subscriber the subscriber to handle events. If this is the first instance of the
- * subscriber's class type that has been registered, the class's methods will
- * be scanned for appropriate event handler methods.
- */
- public void register(Object subscriber) {
- registerSubscriber(subscriber, DEFAULT_SUBSCRIBER_PRIORITY);
- }
-
- /**
- * Registers a subscriber to receive events with the given priority.
- *
- * @param subscriber the subscriber to handle events. If this is the first instance of the
- * subscriber's class type that has been registered, the class's methods will
- * be scanned for appropriate event handler methods.
- * @param priority the priority that this subscriber will receive events relative to other
- * subscribers
- */
- public void register(Object subscriber, int priority) {
- registerSubscriber(subscriber, priority);
- }
-
- /**
- * Remove all EventHandlers pointing to the specified subscriber. This does not remove the
- * mapping of subscriber type to event handler method, in case new instances of this subscriber
- * are registered.
- */
- public void unregister(Object subscriber) {
- if (DEBUG_TRACE_ALL) {
- logWithPid("unregister()");
- }
-
- // Fail immediately if we are being called from the non-main thread
- long callingThreadId = Thread.currentThread().getId();
- if (callingThreadId != mHandler.getLooper().getThread().getId()) {
- throw new RuntimeException("Can not unregister() a subscriber from a non-main thread.");
- }
-
- // Return early if this is not a registered subscriber
- if (!findRegisteredSubscriber(subscriber, true /* removeFoundSubscriber */)) {
- return;
- }
-
- Class<?> subscriberType = subscriber.getClass();
- ArrayList<EventHandlerMethod> subscriberMethods = mSubscriberTypeMap.get(subscriberType);
- if (subscriberMethods != null) {
- // For each of the event handlers the subscriber handles, remove all references of that
- // handler
- for (EventHandlerMethod method : subscriberMethods) {
- ArrayList<EventHandler> eventHandlers = mEventTypeMap.get(method.eventType);
- for (int i = eventHandlers.size() - 1; i >= 0; i--) {
- if (eventHandlers.get(i).subscriber.getReference() == subscriber) {
- eventHandlers.remove(i);
- }
- }
- }
- }
- }
-
- /**
- * Sends an event to the subscribers of the given event type immediately. This can only be
- * called from the same thread as the EventBus's looper thread (for the default EventBus, this
- * is the main application thread).
- */
- public void send(Event event) {
- // Fail immediately if we are being called from the non-main thread
- long callingThreadId = Thread.currentThread().getId();
- if (callingThreadId != mHandler.getLooper().getThread().getId()) {
- throw new RuntimeException("Can not send() a message from a non-main thread.");
- }
-
- if (DEBUG_TRACE_ALL) {
- logWithPid("send(" + event.getClass().getSimpleName() + ")");
- }
-
- // Reset the event's cancelled state
- event.requiresPost = false;
- event.cancelled = false;
- queueEvent(event);
- }
-
- /**
- * Post a message to the subscribers of the given event type. The messages will be posted on
- * the EventBus's looper thread (for the default EventBus, this is the main application thread).
- */
- public void post(Event event) {
- if (DEBUG_TRACE_ALL) {
- logWithPid("post(" + event.getClass().getSimpleName() + ")");
- }
-
- // Reset the event's cancelled state
- event.requiresPost = true;
- event.cancelled = false;
- queueEvent(event);
- }
-
- /**
- * If this method is called from the main thread, it will be handled directly. If this method
- * is not called from the main thread, it will be posted onto the main thread.
- */
- public void sendOntoMainThread(Event event) {
- long callingThreadId = Thread.currentThread().getId();
- if (callingThreadId != mHandler.getLooper().getThread().getId()) {
- post(event);
- } else {
- send(event);
- }
- }
-
- /**
- * @return a dump of the current state of the EventBus
- */
- public void dump(String prefix, PrintWriter writer) {
- writer.println(dumpInternal(prefix));
- }
-
- public String dumpInternal(String prefix) {
- String innerPrefix = prefix + " ";
- String innerInnerPrefix = innerPrefix + " ";
- StringBuilder output = new StringBuilder();
- output.append(prefix);
- output.append("Registered class types:");
- output.append("\n");
- ArrayList<Class<?>> subsciberTypes = new ArrayList<>(mSubscriberTypeMap.keySet());
- Collections.sort(subsciberTypes, new Comparator<Class<?>>() {
- @Override
- public int compare(Class<?> o1, Class<?> o2) {
- return o1.getSimpleName().compareTo(o2.getSimpleName());
- }
- });
- for (int i = 0; i < subsciberTypes.size(); i++) {
- Class<?> clz = subsciberTypes.get(i);
- output.append(innerPrefix);
- output.append(clz.getSimpleName());
- output.append("\n");
- }
- output.append(prefix);
- output.append("Event map:");
- output.append("\n");
- ArrayList<Class<?>> classes = new ArrayList<>(mEventTypeMap.keySet());
- Collections.sort(classes, new Comparator<Class<?>>() {
- @Override
- public int compare(Class<?> o1, Class<?> o2) {
- return o1.getSimpleName().compareTo(o2.getSimpleName());
- }
- });
- for (int i = 0; i < classes.size(); i++) {
- Class<?> clz = classes.get(i);
- output.append(innerPrefix);
- output.append(clz.getSimpleName());
- output.append(" -> ");
- output.append("\n");
- ArrayList<EventHandler> handlers = mEventTypeMap.get(clz);
- for (EventHandler handler : handlers) {
- Object subscriber = handler.subscriber.getReference();
- if (subscriber != null) {
- String id = Integer.toHexString(System.identityHashCode(subscriber));
- output.append(innerInnerPrefix);
- output.append(subscriber.getClass().getSimpleName());
- output.append(" [0x" + id + ", #" + handler.priority + "]");
- output.append("\n");
- }
- }
- }
- return output.toString();
- }
-
- /**
- * Registers a new subscriber.
- */
- private void registerSubscriber(Object subscriber, int priority) {
- // Fail immediately if we are being called from the non-main thread
- long callingThreadId = Thread.currentThread().getId();
- if (callingThreadId != mHandler.getLooper().getThread().getId()) {
- throw new RuntimeException("Can not register() a subscriber from a non-main thread.");
- }
-
- // Return immediately if this exact subscriber is already registered
- if (findRegisteredSubscriber(subscriber, false /* removeFoundSubscriber */)) {
- return;
- }
-
- long t1 = 0;
- if (DEBUG_TRACE_ALL) {
- t1 = SystemClock.currentTimeMicro();
- logWithPid("registerSubscriber(" + subscriber.getClass().getSimpleName() + ")");
- }
- Subscriber sub = new Subscriber(subscriber, SystemClock.uptimeMillis());
- Class<?> subscriberType = subscriber.getClass();
- ArrayList<EventHandlerMethod> subscriberMethods = mSubscriberTypeMap.get(subscriberType);
- if (subscriberMethods != null) {
- if (DEBUG_TRACE_ALL) {
- logWithPid("Subscriber class type already registered");
- }
-
- // If we've parsed this subscriber type before, just add to the set for all the known
- // events
- for (EventHandlerMethod method : subscriberMethods) {
- ArrayList<EventHandler> eventTypeHandlers = mEventTypeMap.get(method.eventType);
- eventTypeHandlers.add(new EventHandler(sub, method, priority));
- sortEventHandlersByPriority(eventTypeHandlers);
- }
- mSubscribers.add(sub);
- return;
- } else {
- if (DEBUG_TRACE_ALL) {
- logWithPid("Subscriber class type requires registration");
- }
-
- // If we are parsing this type from scratch, ensure we add it to the subscriber type
- // map, and pull out he handler methods below
- subscriberMethods = new ArrayList<>();
- mSubscriberTypeMap.put(subscriberType, subscriberMethods);
- mSubscribers.add(sub);
- }
-
- // Find all the valid event bus handler methods of the subscriber
- Method[] methods = subscriberType.getDeclaredMethods();
- for (Method m : methods) {
- Class<?>[] parameterTypes = m.getParameterTypes();
- if (isValidEventBusHandlerMethod(m, parameterTypes)) {
- Class<? extends Event> eventType = (Class<? extends Event>) parameterTypes[0];
- ArrayList<EventHandler> eventTypeHandlers = mEventTypeMap.get(eventType);
- if (eventTypeHandlers == null) {
- eventTypeHandlers = new ArrayList<>();
- mEventTypeMap.put(eventType, eventTypeHandlers);
- }
- EventHandlerMethod method = new EventHandlerMethod(m, eventType);
- EventHandler handler = new EventHandler(sub, method, priority);
- eventTypeHandlers.add(handler);
- subscriberMethods.add(method);
- sortEventHandlersByPriority(eventTypeHandlers);
-
- if (DEBUG_TRACE_ALL) {
- logWithPid(" * Method: " + m.getName() +
- " event: " + parameterTypes[0].getSimpleName());
- }
- }
- }
- if (DEBUG_TRACE_ALL) {
- logWithPid("Registered " + subscriber.getClass().getSimpleName() + " in " +
- (SystemClock.currentTimeMicro() - t1) + " microseconds");
- }
- }
-
- /**
- * Adds a new message.
- */
- private void queueEvent(final Event event) {
- ArrayList<EventHandler> eventHandlers = mEventTypeMap.get(event.getClass());
- if (eventHandlers == null) {
- // This is just an optimization to return early if there are no handlers. However, we
- // should still ensure that we call pre/post dispatch callbacks so that AnimatedEvents
- // are still cleaned up correctly if a listener has not been registered to handle them
- event.onPreDispatch();
- event.onPostDispatch();
- return;
- }
-
- // Prepare this event
- boolean hasPostedEvent = false;
- event.onPreDispatch();
-
- // We need to clone the list in case a subscriber unregisters itself during traversal
- // TODO: Investigate whether we can skip the object creation here
- eventHandlers = (ArrayList<EventHandler>) eventHandlers.clone();
- int eventHandlerCount = eventHandlers.size();
- for (int i = 0; i < eventHandlerCount; i++) {
- final EventHandler eventHandler = eventHandlers.get(i);
- if (eventHandler.subscriber.getReference() != null) {
- if (event.requiresPost) {
- mHandler.post(() -> processEvent(eventHandler, event));
- hasPostedEvent = true;
- } else {
- processEvent(eventHandler, event);
- }
- }
- }
-
- // Clean up after this event, deferring until all subscribers have been called
- if (hasPostedEvent) {
- mHandler.post(event::onPostDispatch);
- } else {
- event.onPostDispatch();
- }
- }
-
- /**
- * Processes and dispatches the given event to the given event handler, on the thread of whoever
- * calls this method.
- */
- private void processEvent(final EventHandler eventHandler, final Event event) {
- // Skip if the event was already cancelled
- if (event.cancelled) {
- if (event.trace || DEBUG_TRACE_ALL) {
- logWithPid("Event dispatch cancelled");
- }
- return;
- }
-
- try {
- if (event.trace || DEBUG_TRACE_ALL) {
- logWithPid(" -> " + eventHandler.toString());
- }
- Object sub = eventHandler.subscriber.getReference();
- if (sub != null) {
- long t1 = 0;
- if (DEBUG_TRACE_ALL) {
- t1 = SystemClock.currentTimeMicro();
- }
- eventHandler.method.invoke(sub, event);
- if (DEBUG_TRACE_ALL) {
- long duration = (SystemClock.currentTimeMicro() - t1);
- mCallDurationMicros += duration;
- mCallCount++;
- logWithPid(eventHandler.method.toString() + " duration: " + duration +
- " microseconds, avg: " + (mCallDurationMicros / mCallCount));
- }
- } else {
- Log.e(TAG, "Failed to deliver event to null subscriber");
- }
- } catch (IllegalAccessException e) {
- Log.e(TAG, "Failed to invoke method", e.getCause());
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
- }
- }
-
- /**
- * Returns whether this subscriber is currently registered. If {@param removeFoundSubscriber}
- * is true, then remove the subscriber before returning.
- */
- private boolean findRegisteredSubscriber(Object subscriber, boolean removeFoundSubscriber) {
- for (int i = mSubscribers.size() - 1; i >= 0; i--) {
- Subscriber sub = mSubscribers.get(i);
- if (sub.getReference() == subscriber) {
- if (removeFoundSubscriber) {
- mSubscribers.remove(i);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return whether {@param method} is a valid (normal or interprocess) event bus handler method
- */
- private boolean isValidEventBusHandlerMethod(Method method, Class<?>[] parameterTypes) {
- int modifiers = method.getModifiers();
- if (Modifier.isPublic(modifiers) &&
- Modifier.isFinal(modifiers) &&
- method.getReturnType().equals(Void.TYPE) &&
- parameterTypes.length == 1) {
- if (EventBus.Event.class.isAssignableFrom(parameterTypes[0]) &&
- method.getName().startsWith(METHOD_PREFIX)) {
- return true;
- } else {
- if (DEBUG_TRACE_ALL) {
- if (!EventBus.Event.class.isAssignableFrom(parameterTypes[0])) {
- logWithPid(" Expected method take an Event-based parameter: " + method.getName());
- }
- }
- }
- } else {
- if (DEBUG_TRACE_ALL) {
- if (!Modifier.isPublic(modifiers)) {
- logWithPid(" Expected method to be public: " + method.getName());
- } else if (!Modifier.isFinal(modifiers)) {
- logWithPid(" Expected method to be final: " + method.getName());
- } else if (!method.getReturnType().equals(Void.TYPE)) {
- logWithPid(" Expected method to return null: " + method.getName());
- }
- }
- }
- return false;
- }
-
- /**
- * Sorts the event handlers by priority and registration time.
- */
- private void sortEventHandlersByPriority(List<EventHandler> eventHandlers) {
- Collections.sort(eventHandlers, EVENT_HANDLER_COMPARATOR);
- }
-
- /**
- * Helper method to log the given {@param text} with the current process and user id.
- */
- private static void logWithPid(String text) {
- Log.d(TAG, "[" + android.os.Process.myPid() + ", u" + UserHandle.myUserId() + "] " + text);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/AppTransitionFinishedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/AppTransitionFinishedEvent.java
deleted file mode 100644
index 4738eed..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/AppTransitionFinishedEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Sent when an app transition has finished playing.
- */
-public class AppTransitionFinishedEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/CancelEnterRecentsWindowAnimationEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/CancelEnterRecentsWindowAnimationEvent.java
deleted file mode 100644
index fec34e3..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/CancelEnterRecentsWindowAnimationEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-
-/**
- * This is sent when we want to cancel the enter-recents window animation for the launch task.
- */
-public class CancelEnterRecentsWindowAnimationEvent extends EventBus.Event {
-
- // This is set for the task that is launching, which allows us to ensure that we are not
- // cancelling the same task animation (it will just be overwritten instead)
- public final Task launchTask;
-
- public CancelEnterRecentsWindowAnimationEvent(Task launchTask) {
- this.launchTask = launchTask;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ConfigurationChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ConfigurationChangedEvent.java
deleted file mode 100644
index 294c1e7..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ConfigurationChangedEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the Recents activity configuration has changed.
- */
-public class ConfigurationChangedEvent extends EventBus.AnimatedEvent {
-
- public final boolean fromMultiWindow;
- public final boolean fromDeviceOrientationChange;
- public final boolean fromDisplayDensityChange;
- public final boolean hasStackTasks;
-
- public ConfigurationChangedEvent(boolean fromMultiWindow, boolean fromDeviceOrientationChange,
- boolean fromDisplayDensityChange, boolean hasStackTasks) {
- this.fromMultiWindow = fromMultiWindow;
- this.fromDeviceOrientationChange = fromDeviceOrientationChange;
- this.fromDisplayDensityChange = fromDisplayDensityChange;
- this.hasStackTasks = hasStackTasks;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DismissRecentsToHomeAnimationStarted.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DismissRecentsToHomeAnimationStarted.java
deleted file mode 100644
index e7be858..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DismissRecentsToHomeAnimationStarted.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the task animation when dismissing Recents starts.
- */
-public class DismissRecentsToHomeAnimationStarted extends EventBus.AnimatedEvent {
-
- public final boolean animated;
-
- public DismissRecentsToHomeAnimationStarted(boolean animated) {
- this.animated = animated;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedFirstAnimationFrameEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedFirstAnimationFrameEvent.java
deleted file mode 100644
index 32d9a70..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedFirstAnimationFrameEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus.Event;
-
-/**
- * Sent when the window animation has started when docking a task
- */
-public class DockedFirstAnimationFrameEvent extends Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedTopTaskEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedTopTaskEvent.java
deleted file mode 100644
index 9e3ced3..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/DockedTopTaskEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import android.graphics.Rect;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Fires when the user invoked the gesture to dock the top/left task after we called into window
- * manager and before we start recents.
- */
-public class DockedTopTaskEvent extends EventBus.Event {
-
- public Rect initialRect;
-
- public DockedTopTaskEvent(Rect initialRect) {
- this.initialRect = initialRect;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowAnimationCompletedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowAnimationCompletedEvent.java
deleted file mode 100644
index b31f320..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowAnimationCompletedEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the window animation into Recents completes. We use this signal to know when
- * we can start in-app animations so that they don't conflict with the window transition into
- * Recents.
- */
-public class EnterRecentsWindowAnimationCompletedEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowLastAnimationFrameEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowLastAnimationFrameEvent.java
deleted file mode 100644
index fd023d8..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/EnterRecentsWindowLastAnimationFrameEvent.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-public class EnterRecentsWindowLastAnimationFrameEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ExitRecentsWindowFirstAnimationFrameEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ExitRecentsWindowFirstAnimationFrameEvent.java
deleted file mode 100644
index fa806eb..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ExitRecentsWindowFirstAnimationFrameEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Event sent when the exit animation is started.
- *
- * This is sent so parts of UI can synchronize on this event and adjust their appearance. An example
- * of that is hiding the tasks when the launched application window becomes visible.
- */
-public class ExitRecentsWindowFirstAnimationFrameEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideRecentsEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideRecentsEvent.java
deleted file mode 100644
index bf9b421..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideRecentsEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the user taps on the Home button or finishes alt-tabbing to hide the Recents
- * activity.
- */
-public class HideRecentsEvent extends EventBus.Event {
-
- public final boolean triggeredFromAltTab;
- public final boolean triggeredFromHomeKey;
-
- public HideRecentsEvent(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) {
- this.triggeredFromAltTab = triggeredFromAltTab;
- this.triggeredFromHomeKey = triggeredFromHomeKey;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideStackActionButtonEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideStackActionButtonEvent.java
deleted file mode 100644
index e4a4f59..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/HideStackActionButtonEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the stack action button should be hidden.
- */
-public class HideStackActionButtonEvent extends EventBus.Event {
-
- // Whether or not to translate the stack action button when hiding it
- public final boolean translate;
-
- public HideStackActionButtonEvent() {
- this(true);
- }
-
- public HideStackActionButtonEvent(boolean translate) {
- this.translate = translate;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchMostRecentTaskRequestEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchMostRecentTaskRequestEvent.java
deleted file mode 100644
index 24913a4..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchMostRecentTaskRequestEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This event is sent to request that the most recent task is launched.
- */
-public class LaunchMostRecentTaskRequestEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java
deleted file mode 100644
index 11604b5..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchNextTaskRequestEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This event is sent to request that the next task is launched after a double-tap on the Recents
- * button.
- */
-public class LaunchNextTaskRequestEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskEvent.java
deleted file mode 100644
index 2409f39..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-
-import android.graphics.Rect;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent to request that a particular task is launched.
- */
-public class LaunchTaskEvent extends EventBus.Event {
-
- public final TaskView taskView;
- public final Task task;
- public final Rect targetTaskBounds;
- public final int targetWindowingMode;
- public final int targetActivityType;
- public final boolean screenPinningRequested;
-
- public LaunchTaskEvent(TaskView taskView, Task task, Rect targetTaskBounds,
- boolean screenPinningRequested) {
- this(taskView, task, targetTaskBounds, screenPinningRequested,
- WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_UNDEFINED);
- }
-
- public LaunchTaskEvent(TaskView taskView, Task task, Rect targetTaskBounds,
- boolean screenPinningRequested, int windowingMode, int activityType) {
- this.taskView = taskView;
- this.task = task;
- this.targetTaskBounds = targetTaskBounds;
- this.targetWindowingMode = windowingMode;
- this.targetActivityType = activityType;
- this.screenPinningRequested = screenPinningRequested;
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskFailedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskFailedEvent.java
deleted file mode 100644
index 3a2d58c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskFailedEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when we fail to launch a task.
- */
-public class LaunchTaskFailedEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskStartedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskStartedEvent.java
deleted file mode 100644
index 3925ab1..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskStartedEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent following {@link LaunchTaskEvent} after the call to the system is made to
- * start the task.
- */
-public class LaunchTaskStartedEvent extends EventBus.AnimatedEvent {
-
- public final TaskView taskView;
- public final boolean screenPinningRequested;
-
- public LaunchTaskStartedEvent(TaskView taskView, boolean screenPinningRequested) {
- this.taskView = taskView;
- this.screenPinningRequested = screenPinningRequested;
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskSucceededEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskSucceededEvent.java
deleted file mode 100644
index ec5089f..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/LaunchTaskSucceededEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when we successfully launch a task.
- */
-public class LaunchTaskSucceededEvent extends EventBus.Event {
-
- public final int taskIndexFromStackFront;
-
- public LaunchTaskSucceededEvent(int taskIndexFromStackFront) {
- this.taskIndexFromStackFront = taskIndexFromStackFront;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/MultiWindowStateChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/MultiWindowStateChangedEvent.java
deleted file mode 100644
index 64eeafa..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/MultiWindowStateChangedEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.model.TaskStack;
-
-/**
- * This is sent by the activity whenever the multi-window state has changed.
- */
-public class MultiWindowStateChangedEvent extends EventBus.AnimatedEvent {
-
- public final boolean inMultiWindow;
- // This flag is only used when undocking a task
- public final boolean showDeferredAnimation;
- public final TaskStack stack;
-
- public MultiWindowStateChangedEvent(boolean inMultiWindow, boolean showDeferredAnimation,
- TaskStack stack) {
- this.inMultiWindow = inMultiWindow;
- this.showDeferredAnimation = showDeferredAnimation;
- this.stack = stack;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/PackagesChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/PackagesChangedEvent.java
deleted file mode 100644
index 47670e0..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/PackagesChangedEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.views.TaskStackView;
-import com.android.systemui.recents.RecentsActivity;
-
-/**
- * This event is sent by {@link RecentsActivity} when a package on the the system changes.
- * {@link TaskStackView}s listen for this event, and remove the tasks associated with the removed
- * packages.
- */
-public class PackagesChangedEvent extends EventBus.Event {
-
- public final String packageName;
- public final int userId;
-
- public PackagesChangedEvent(String packageName, int userId) {
- this.packageName = packageName;
- this.userId = userId;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/RecentsActivityStartingEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/RecentsActivityStartingEvent.java
deleted file mode 100644
index a2ecfe2..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/RecentsActivityStartingEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Called after recents activity is being started, i.e. startActivity has just been called.
- */
-public class RecentsActivityStartingEvent extends EventBus.Event{
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowEmptyViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowEmptyViewEvent.java
deleted file mode 100644
index 75bfd7b..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowEmptyViewEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Sent when the stack should be hidden and the empty view shown.
- */
-public class ShowEmptyViewEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowStackActionButtonEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowStackActionButtonEvent.java
deleted file mode 100644
index d81f89c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ShowStackActionButtonEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the stack action view button should be shown.
- */
-public class ShowStackActionButtonEvent extends EventBus.Event {
-
- // Whether or not to translate the stack action button when showing it
- public final boolean translate;
-
- public ShowStackActionButtonEvent(boolean translate) {
- this.translate = translate;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java
deleted file mode 100644
index 0d614e8c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.model.TaskStack;
-
-/**
- * This is sent by the activity whenever the task stach has changed.
- */
-public class TaskStackUpdatedEvent extends EventBus.AnimatedEvent {
-
- /**
- * A new TaskStack instance representing the latest stack state.
- */
- public final TaskStack stack;
- public final boolean inMultiWindow;
-
- public TaskStackUpdatedEvent(TaskStack stack, boolean inMultiWindow) {
- this.stack = stack;
- this.inMultiWindow = inMultiWindow;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ToggleRecentsEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ToggleRecentsEvent.java
deleted file mode 100644
index 49655b4..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/ToggleRecentsEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the user taps on the Overview button to toggle the Recents activity.
- */
-public class ToggleRecentsEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java
deleted file mode 100644
index d5083a8..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/activity/UndockingTaskEvent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.activity;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Fires when the user invoked the gesture to undock the task in the docked stack.
- */
-public class UndockingTaskEvent extends EventBus.Event {
-
- public UndockingTaskEvent() {
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityPinnedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityPinnedEvent.java
deleted file mode 100644
index f4d2fcf..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityPinnedEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when an activity is pinned.
- */
-public class ActivityPinnedEvent extends EventBus.Event {
-
- public final int taskId;
-
- public ActivityPinnedEvent(int taskId) {
- this.taskId = taskId;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityUnpinnedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityUnpinnedEvent.java
deleted file mode 100644
index 48c5f0b..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ActivityUnpinnedEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when an activity is unpinned.
- */
-public class ActivityUnpinnedEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ExpandPipEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ExpandPipEvent.java
deleted file mode 100644
index 37266f6..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ExpandPipEvent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the PiP should be expanded due to being relaunched.
- */
-public class ExpandPipEvent extends EventBus.Event {
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/HidePipMenuEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/HidePipMenuEvent.java
deleted file mode 100644
index ce4f207..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/HidePipMenuEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the PiP menu should be hidden.
- */
-public class HidePipMenuEvent extends EventBus.AnimatedEvent {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/RecentsVisibilityChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/RecentsVisibilityChangedEvent.java
deleted file mode 100644
index 8843eb4..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/RecentsVisibilityChangedEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import android.content.Context;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when the visibility of the RecentsActivity for the current user changes. Handlers
- * of this event should not alter the UI, as the activity may still be visible.
- */
-public class RecentsVisibilityChangedEvent extends EventBus.Event {
-
- public final Context applicationContext;
- public final boolean visible;
-
- public RecentsVisibilityChangedEvent(Context context, boolean visible) {
- this.applicationContext = context.getApplicationContext();
- this.visible = visible;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ScreenPinningRequestEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ScreenPinningRequestEvent.java
deleted file mode 100644
index d460917..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ScreenPinningRequestEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import android.content.Context;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when we want to start screen pinning.
- */
-public class ScreenPinningRequestEvent extends EventBus.Event {
-
- public final Context applicationContext;
- public final int taskId;
-
- public ScreenPinningRequestEvent(Context context, int taskId) {
- this.applicationContext = context.getApplicationContext();
- this.taskId = taskId;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/SetWaitingForTransitionStartEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/SetWaitingForTransitionStartEvent.java
deleted file mode 100644
index d9cf5fb..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/SetWaitingForTransitionStartEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when we are setting/resetting the flag to wait for the transition to start.
- */
-public class SetWaitingForTransitionStartEvent extends EventBus.Event {
-
- public final boolean waitingForTransitionStart;
-
- public SetWaitingForTransitionStartEvent(boolean waitingForTransitionStart) {
- this.waitingForTransitionStart = waitingForTransitionStart;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ShowUserToastEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ShowUserToastEvent.java
deleted file mode 100644
index e2b39c3..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/component/ShowUserToastEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.component;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when we want to show a toast for the current user.
- */
-public class ShowUserToastEvent extends EventBus.Event {
-
- public final int msgResId;
- public final int msgLength;
-
- public ShowUserToastEvent(int msgResId, int msgLength) {
- this.msgResId = msgResId;
- this.msgLength = msgLength;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java
deleted file mode 100644
index 0352161..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/AllTaskViewsDismissedEvent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent whenever all the task views in a stack have been dismissed.
- */
-public class AllTaskViewsDismissedEvent extends EventBus.Event {
-
- public final int msgResId;
-
- public AllTaskViewsDismissedEvent(int msgResId) {
- this.msgResId = msgResId;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DeleteTaskDataEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DeleteTaskDataEvent.java
deleted file mode 100644
index b52e83b..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DeleteTaskDataEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-
-/**
- * This is sent when the data associated with a given {@link Task} should be deleted from the
- * system.
- */
-public class DeleteTaskDataEvent extends EventBus.Event {
-
- public final Task task;
-
- public DeleteTaskDataEvent(Task task) {
- this.task = task;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissAllTaskViewsEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissAllTaskViewsEvent.java
deleted file mode 100644
index f8b59c7..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissAllTaskViewsEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent to request that all the {@link TaskView}s are dismissed.
- */
-public class DismissAllTaskViewsEvent extends EventBus.AnimatedEvent {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissTaskViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissTaskViewEvent.java
deleted file mode 100644
index 1f8c644..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DismissTaskViewEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent to request that the given {@link TaskView} is dismissed.
- */
-public class DismissTaskViewEvent extends EventBus.AnimatedEvent {
-
- public final TaskView taskView;
-
- public DismissTaskViewEvent(TaskView taskView) {
- this.taskView = taskView;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEndedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEndedEvent.java
deleted file mode 100644
index 9be8eb1..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEndedEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus.Event;
-
-/**
- * This event is sent when the user finished dragging in recents.
- */
-public class DraggingInRecentsEndedEvent extends Event {
-
- public final float velocity;
-
- public DraggingInRecentsEndedEvent(float velocity) {
- this.velocity = velocity;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEvent.java
deleted file mode 100644
index 5e8bfd4..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/DraggingInRecentsEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus.Event;
-
-/**
- * This event is sent when the user changed how far they are dragging in recents.
- */
-public class DraggingInRecentsEvent extends Event {
-
- public final float distanceFromTop;
-
- public DraggingInRecentsEvent(float distanceFromTop) {
- this.distanceFromTop = distanceFromTop;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/HideIncompatibleAppOverlayEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/HideIncompatibleAppOverlayEvent.java
deleted file mode 100644
index d6ef636..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/HideIncompatibleAppOverlayEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when a user stops draggin an incompatible app task.
- */
-public class HideIncompatibleAppOverlayEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsDrawnEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsDrawnEvent.java
deleted file mode 100644
index 5483166..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsDrawnEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Fired when recents was launched and has drawn its first frame.
- */
-public class RecentsDrawnEvent extends EventBus.Event {
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsGrowingEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsGrowingEvent.java
deleted file mode 100644
index d9b0027..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/RecentsGrowingEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Sent when recents is about to grow in multi-window mode when entering recents.
- */
-public class RecentsGrowingEvent extends EventBus.Event {
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowApplicationInfoEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowApplicationInfoEvent.java
deleted file mode 100644
index da19384..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowApplicationInfoEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-
-/**
- * This is sent when a user wants to show the application info for a {@link Task}.
- */
-public class ShowApplicationInfoEvent extends EventBus.Event {
-
- public final Task task;
-
- public ShowApplicationInfoEvent(Task task) {
- this.task = task;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowIncompatibleAppOverlayEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowIncompatibleAppOverlayEvent.java
deleted file mode 100644
index 3a4350e..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/ShowIncompatibleAppOverlayEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent when a user starts dragging an incompatible app task.
- */
-public class ShowIncompatibleAppOverlayEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/StackViewScrolledEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/StackViewScrolledEvent.java
deleted file mode 100644
index c4b47c0..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/StackViewScrolledEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import android.util.MutableInt;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent whenever a new scroll gesture happens on a stack view.
- */
-public class StackViewScrolledEvent extends EventBus.ReusableEvent {
-
- public final MutableInt yMovement;
-
- public StackViewScrolledEvent() {
- yMovement = new MutableInt(0);
- }
-
- public void updateY(int y) {
- yMovement.value = y;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskSnapshotChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskSnapshotChangedEvent.java
deleted file mode 100644
index f082928..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskSnapshotChangedEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-
-/**
- * Sent when a task snapshot has changed.
- */
-public class TaskSnapshotChangedEvent extends EventBus.Event {
-
- public final int taskId;
- public final ThumbnailData thumbnailData;
-
- public TaskSnapshotChangedEvent(int taskId, ThumbnailData thumbnailData) {
- this.taskId = taskId;
- this.thumbnailData = thumbnailData;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskViewDismissedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskViewDismissedEvent.java
deleted file mode 100644
index 9738124..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/TaskViewDismissedEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent when a {@link TaskView} has been dismissed and is no longer visible.
- */
-public class TaskViewDismissedEvent extends EventBus.Event {
-
- public final Task task;
- public final TaskView taskView;
- public final AnimationProps animation;
-
- public TaskViewDismissedEvent(Task task, TaskView taskView, AnimationProps animation) {
- this.task = task;
- this.taskView = taskView;
- this.animation = animation;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/UserInteractionEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/UserInteractionEvent.java
deleted file mode 100644
index 39e4c1d..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/UserInteractionEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * This is sent whenever the user interacts with the activity.
- */
-public class UserInteractionEvent extends EventBus.ReusableEvent {
- // Simple Event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragDropTargetChangedEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragDropTargetChangedEvent.java
deleted file mode 100644
index cf61b1e..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragDropTargetChangedEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.dragndrop;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.DropTarget;
-
-/**
- * This event is sent when a user drags in/out of a drop target.
- */
-public class DragDropTargetChangedEvent extends EventBus.AnimatedEvent {
-
- // The task that is currently being dragged
- public final Task task;
- public final DropTarget dropTarget;
-
- public DragDropTargetChangedEvent(Task task, DropTarget dropTarget) {
- this.task = task;
- this.dropTarget = dropTarget;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndCancelledEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndCancelledEvent.java
deleted file mode 100644
index c11936e..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndCancelledEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.events.ui.dragndrop;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent whenever a drag end is cancelled because of an error.
- */
-public class DragEndCancelledEvent extends EventBus.AnimatedEvent {
-
- public final TaskStack stack;
- public final Task task;
- public final TaskView taskView;
-
- public DragEndCancelledEvent(TaskStack stack, Task task, TaskView taskView) {
- this.stack = stack;
- this.task = task;
- this.taskView = taskView;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java
deleted file mode 100644
index 73cbde9..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragEndEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.dragndrop;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.DropTarget;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent whenever a drag ends.
- */
-public class DragEndEvent extends EventBus.AnimatedEvent {
-
- public final Task task;
- public final TaskView taskView;
- public final DropTarget dropTarget;
-
- public DragEndEvent(Task task, TaskView taskView, DropTarget dropTarget) {
- this.task = task;
- this.taskView = taskView;
- this.dropTarget = dropTarget;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java
deleted file mode 100644
index 021be77..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartEvent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.dragndrop;
-
-import android.graphics.Point;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent whenever a drag starts.
- */
-public class DragStartEvent extends EventBus.Event {
-
- public final Task task;
- public final TaskView taskView;
- public final Point tlOffset;
- public final boolean isUserTouchInitiated;
-
- public DragStartEvent(Task task, TaskView taskView, Point tlOffset) {
- this(task, taskView, tlOffset, true);
- }
-
- public DragStartEvent(Task task, TaskView taskView, Point tlOffset,
- boolean isUserTouchInitiated) {
- this.task = task;
- this.taskView = taskView;
- this.tlOffset = tlOffset;
- this.isUserTouchInitiated = isUserTouchInitiated;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java
deleted file mode 100644
index 64ba574..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.dragndrop;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.RecentsViewTouchHandler;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent by the drag manager when it requires drop targets to register themselves for
- * the current drag gesture.
- */
-public class DragStartInitializeDropTargetsEvent extends EventBus.Event {
-
- public final Task task;
- public final TaskView taskView;
- public final RecentsViewTouchHandler handler;
-
- public DragStartInitializeDropTargetsEvent(Task task, TaskView taskView,
- RecentsViewTouchHandler handler) {
- this.task = task;
- this.taskView = taskView;
- this.handler = handler;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/DismissFocusedTaskViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/DismissFocusedTaskViewEvent.java
deleted file mode 100644
index df74018..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/DismissFocusedTaskViewEvent.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.focus;
-
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.views.TaskView;
-
-/**
- * This event is sent to request that the currently focused {@link TaskView} is dismissed.
- */
-public class DismissFocusedTaskViewEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusNextTaskViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusNextTaskViewEvent.java
deleted file mode 100644
index 171ab5e..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusNextTaskViewEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.focus;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Focuses the next task view in the stack.
- */
-public class FocusNextTaskViewEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusPreviousTaskViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusPreviousTaskViewEvent.java
deleted file mode 100644
index 22469e7..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/FocusPreviousTaskViewEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.focus;
-
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Focuses the previous task view in the stack.
- */
-public class FocusPreviousTaskViewEvent extends EventBus.Event {
- // Simple event
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/NavigateTaskViewEvent.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/NavigateTaskViewEvent.java
deleted file mode 100644
index 5508d26..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/events/ui/focus/NavigateTaskViewEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.events.ui.focus;
-
-import android.view.KeyEvent;
-import com.android.systemui.recents.events.EventBus;
-
-/**
- * Navigates the task view by arrow keys.
- */
-public class NavigateTaskViewEvent extends EventBus.Event {
- public enum Direction {
- UNDEFINED, UP, DOWN, LEFT, RIGHT;
- }
-
- public Direction direction;
- public NavigateTaskViewEvent(Direction direction) {
- this.direction = direction;
- }
-
- public static Direction getDirectionFromKeyCode(int keyCode) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_UP:
- return Direction.UP;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- return Direction.DOWN;
- case KeyEvent.KEYCODE_DPAD_LEFT:
- return Direction.LEFT;
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- return Direction.RIGHT;
- default:
- return Direction.UNDEFINED;
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/DozeTrigger.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/DozeTrigger.java
deleted file mode 100644
index 574ea03..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/DozeTrigger.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.misc;
-
-import android.os.Handler;
-import android.view.ViewDebug;
-
-/**
- * A dozer is a class that fires a trigger after it falls asleep.
- * You can occasionally poke the trigger to wake it up, but it will fall asleep if left untouched.
- */
-public class DozeTrigger {
-
- Handler mHandler;
-
- @ViewDebug.ExportedProperty(category="recents")
- boolean mIsDozing;
- @ViewDebug.ExportedProperty(category="recents")
- boolean mIsAsleep;
- @ViewDebug.ExportedProperty(category="recents")
- int mDozeDurationMilliseconds;
- Runnable mOnSleepRunnable;
-
- // Sleep-runnable
- Runnable mDozeRunnable = new Runnable() {
- @Override
- public void run() {
- mIsDozing = false;
- mIsAsleep = true;
- mOnSleepRunnable.run();
- }
- };
-
- public DozeTrigger(int dozeDurationMilliseconds, Runnable onSleepRunnable) {
- mHandler = new Handler();
- mDozeDurationMilliseconds = dozeDurationMilliseconds;
- mOnSleepRunnable = onSleepRunnable;
- }
-
- /**
- * Starts dozing and queues the onSleepRunnable to be called. This also resets the trigger flag.
- */
- public void startDozing() {
- forcePoke();
- mIsAsleep = false;
- }
-
- /**
- * Stops dozing and prevents the onSleepRunnable from being called.
- */
- public void stopDozing() {
- mHandler.removeCallbacks(mDozeRunnable);
- mIsDozing = false;
- mIsAsleep = false;
- }
-
- /**
- * Updates the duration that we have to wait until dozing triggers.
- */
- public void setDozeDuration(int duration) {
- mDozeDurationMilliseconds = duration;
- }
-
- /**
- * Poke this dozer to wake it up if it is dozing, delaying the onSleepRunnable from being
- * called for a for the doze duration.
- */
- public void poke() {
- if (mIsDozing) {
- forcePoke();
- }
- }
-
- /**
- * Poke this dozer to wake it up even if it is not currently dozing.
- */
- void forcePoke() {
- mHandler.removeCallbacks(mDozeRunnable);
- mHandler.postDelayed(mDozeRunnable, mDozeDurationMilliseconds);
- mIsDozing = true;
- }
-
- /** Returns whether we are dozing or not. */
- public boolean isDozing() {
- return mIsDozing;
- }
-
- /** Returns whether the trigger has fired at least once. */
- public boolean isAsleep() {
- return mIsAsleep;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/FreePathInterpolator.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/FreePathInterpolator.java
deleted file mode 100644
index 720c952..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/FreePathInterpolator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.misc;
-
-import android.graphics.Path;
-import android.view.animation.BaseInterpolator;
-import android.view.animation.Interpolator;
-
-/**
- * An interpolator that can traverse a Path. The x coordinate along the <code>Path</code>
- * is the input value and the output is the y coordinate of the line at that point.
- * This means that the Path must conform to a function <code>y = f(x)</code>.
- *
- * <p>The <code>Path</code> must not have gaps in the x direction and must not
- * loop back on itself such that there can be two points sharing the same x coordinate.
- * It is alright to have a disjoint line in the vertical direction:</p>
- * <p><blockquote><pre>
- * Path path = new Path();
- * path.lineTo(0.25f, 0.25f);
- * path.moveTo(0.25f, 0.5f);
- * path.lineTo(1f, 1f);
- * </pre></blockquote></p>
- */
-public class FreePathInterpolator extends BaseInterpolator {
-
- // This governs how accurate the approximation of the Path is.
- private static final float PRECISION = 0.002f;
-
- private float[] mX;
- private float[] mY;
- private float mArcLength;
-
- /**
- * Create an interpolator for an arbitrary <code>Path</code>.
- *
- * @param path The <code>Path</code> to use to make the line representing the interpolator.
- */
- public FreePathInterpolator(Path path) {
- initPath(path);
- }
-
- private void initPath(Path path) {
- float[] pointComponents = path.approximate(PRECISION);
-
- int numPoints = pointComponents.length / 3;
-
- mX = new float[numPoints];
- mY = new float[numPoints];
- mArcLength = 0;
- float prevX = 0;
- float prevY = 0;
- float prevFraction = 0;
- int componentIndex = 0;
- for (int i = 0; i < numPoints; i++) {
- float fraction = pointComponents[componentIndex++];
- float x = pointComponents[componentIndex++];
- float y = pointComponents[componentIndex++];
- if (fraction == prevFraction && x != prevX) {
- throw new IllegalArgumentException(
- "The Path cannot have discontinuity in the X axis.");
- }
- if (x < prevX) {
- throw new IllegalArgumentException("The Path cannot loop back on itself.");
- }
- mX[i] = x;
- mY[i] = y;
- mArcLength += Math.hypot(x - prevX, y - prevY);
- prevX = x;
- prevY = y;
- prevFraction = fraction;
- }
- }
-
- /**
- * Using the line in the Path in this interpolator that can be described as
- * <code>y = f(x)</code>, finds the y coordinate of the line given <code>t</code>
- * as the x coordinate.
- *
- * @param t Treated as the x coordinate along the line.
- * @return The y coordinate of the Path along the line where x = <code>t</code>.
- * @see Interpolator#getInterpolation(float)
- */
- @Override
- public float getInterpolation(float t) {
- int startIndex = 0;
- int endIndex = mX.length - 1;
-
- // Return early if out of bounds
- if (t <= 0) {
- return mY[startIndex];
- } else if (t >= 1) {
- return mY[endIndex];
- }
-
- // Do a binary search for the correct x to interpolate between.
- while (endIndex - startIndex > 1) {
- int midIndex = (startIndex + endIndex) / 2;
- if (t < mX[midIndex]) {
- endIndex = midIndex;
- } else {
- startIndex = midIndex;
- }
- }
-
- float xRange = mX[endIndex] - mX[startIndex];
- if (xRange == 0) {
- return mY[startIndex];
- }
-
- float tInRange = t - mX[startIndex];
- float fraction = tInRange / xRange;
-
- float startY = mY[startIndex];
- float endY = mY[endIndex];
- return startY + (fraction * (endY - startY));
- }
-
- /**
- * Finds the x that provides the given <code>y = f(x)</code>.
- *
- * @param y a value from (0,1) that is in this path.
- */
- public float getX(float y) {
- int startIndex = 0;
- int endIndex = mY.length - 1;
-
- // Return early if out of bounds
- if (y <= 0) {
- return mX[endIndex];
- } else if (y >= 1) {
- return mX[startIndex];
- }
-
- // Do a binary search for index that bounds the y
- while (endIndex - startIndex > 1) {
- int midIndex = (startIndex + endIndex) / 2;
- if (y < mY[midIndex]) {
- startIndex = midIndex;
- } else {
- endIndex = midIndex;
- }
- }
-
- float yRange = mY[endIndex] - mY[startIndex];
- if (yRange == 0) {
- return mX[startIndex];
- }
-
- float tInRange = y - mY[startIndex];
- float fraction = tInRange / yRange;
-
- float startX = mX[startIndex];
- float endX = mX[endIndex];
- return startX + (fraction * (endX - startX));
- }
-
- /**
- * Returns the arclength of the path we are interpolating.
- */
- public float getArcLength() {
- return mArcLength;
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/ReferenceCountedTrigger.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/ReferenceCountedTrigger.java
deleted file mode 100644
index 2637d88..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/ReferenceCountedTrigger.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.misc;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-
-import java.util.ArrayList;
-
-/**
- * A ref counted trigger that does some logic when the count is first incremented, or last
- * decremented. Not thread safe as it's not currently needed.
- */
-public class ReferenceCountedTrigger {
-
- int mCount;
- ArrayList<Runnable> mFirstIncRunnables = new ArrayList<>();
- ArrayList<Runnable> mLastDecRunnables = new ArrayList<>();
- Runnable mErrorRunnable;
-
- // Convenience runnables
- Runnable mIncrementRunnable = new Runnable() {
- @Override
- public void run() {
- increment();
- }
- };
- Runnable mDecrementRunnable = new Runnable() {
- @Override
- public void run() {
- decrement();
- }
- };
-
- public ReferenceCountedTrigger() {
- this(null, null, null);
- }
-
- public ReferenceCountedTrigger(Runnable firstIncRunnable, Runnable lastDecRunnable,
- Runnable errorRunanable) {
- if (firstIncRunnable != null) mFirstIncRunnables.add(firstIncRunnable);
- if (lastDecRunnable != null) mLastDecRunnables.add(lastDecRunnable);
- mErrorRunnable = errorRunanable;
- }
-
- /** Increments the ref count */
- public void increment() {
- if (mCount == 0 && !mFirstIncRunnables.isEmpty()) {
- int numRunnables = mFirstIncRunnables.size();
- for (int i = 0; i < numRunnables; i++) {
- mFirstIncRunnables.get(i).run();
- }
- }
- mCount++;
- }
-
- /** Convenience method to increment this trigger as a runnable */
- public Runnable incrementAsRunnable() {
- return mIncrementRunnable;
- }
-
- /** Adds a runnable to the last-decrement runnables list. */
- public void addLastDecrementRunnable(Runnable r) {
- mLastDecRunnables.add(r);
- }
-
- /** Decrements the ref count */
- public void decrement() {
- mCount--;
- if (mCount == 0) {
- flushLastDecrementRunnables();
- } else if (mCount < 0) {
- if (mErrorRunnable != null) {
- mErrorRunnable.run();
- } else {
- throw new RuntimeException("Invalid ref count");
- }
- }
- }
-
- /**
- * Runs and clears all the last-decrement runnables now.
- */
- public void flushLastDecrementRunnables() {
- if (!mLastDecRunnables.isEmpty()) {
- int numRunnables = mLastDecRunnables.size();
- for (int i = 0; i < numRunnables; i++) {
- mLastDecRunnables.get(i).run();
- }
- }
- mLastDecRunnables.clear();
- }
-
- /**
- * Convenience method to decrement this trigger as a animator listener. This listener is
- * guarded to prevent being called back multiple times, and will trigger a decrement once and
- * only once.
- */
- public Animator.AnimatorListener decrementOnAnimationEnd() {
- return new AnimatorListenerAdapter() {
- private boolean hasEnded;
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (hasEnded) return;
- decrement();
- hasEnded = true;
- }
- };
- }
-
- /** Returns the current ref count */
- public int getCount() {
- return mCount;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SysUiTaskStackChangeListener.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SysUiTaskStackChangeListener.java
deleted file mode 100644
index 5d7f1ba..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SysUiTaskStackChangeListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.misc;
-
-import android.content.Context;
-
-import com.android.systemui.shared.system.TaskStackChangeListener;
-
-/**
- * An implementation of {@link TaskStackChangeListener}.
- */
-public abstract class SysUiTaskStackChangeListener extends TaskStackChangeListener {
-
- /**
- * Checks that the current user matches the user's SystemUI process.
- */
- protected final boolean checkCurrentUserId(Context context, boolean debug) {
- int currentUserId = SystemServicesProxy.getInstance(context).getCurrentUser();
- return checkCurrentUserId(currentUserId, debug);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SystemServicesProxy.java
deleted file mode 100644
index 44354bc1..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.misc;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-
-import android.app.ActivityManager;
-import android.app.ActivityManager.StackInfo;
-import android.app.ActivityOptions;
-import android.app.ActivityTaskManager;
-import android.app.AppGlobals;
-import android.app.IActivityManager;
-import android.app.IActivityTaskManager;
-import android.app.WindowConfiguration;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.service.dreams.DreamService;
-import android.service.dreams.IDreamManager;
-import android.util.Log;
-import android.util.MutableBoolean;
-import android.view.Display;
-import android.view.IDockedStackListener;
-import android.view.IWindowManager;
-import android.view.WindowManager;
-import android.view.WindowManager.KeyboardShortcutsReceiver;
-import android.view.WindowManagerGlobal;
-import android.view.accessibility.AccessibilityManager;
-
-import com.android.internal.app.AssistUtils;
-import com.android.internal.os.BackgroundThread;
-import com.android.systemui.Dependency;
-import com.android.systemui.UiOffloadThread;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsImpl;
-import com.android.systemui.statusbar.policy.UserInfoController;
-
-import java.util.List;
-
-/**
- * Acts as a shim around the real system services that we need to access data from, and provides
- * a point of injection when testing UI.
- */
-public class SystemServicesProxy {
- final static String TAG = "SystemServicesProxy";
-
- final static BitmapFactory.Options sBitmapOptions;
- static {
- sBitmapOptions = new BitmapFactory.Options();
- sBitmapOptions.inMutable = true;
- sBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
- }
-
- private static SystemServicesProxy sSystemServicesProxy;
-
- AccessibilityManager mAccm;
- ActivityManager mAm;
- IActivityManager mIam;
- IActivityTaskManager mIatm;
- PackageManager mPm;
- IPackageManager mIpm;
- private final IDreamManager mDreamManager;
- private final Context mContext;
- AssistUtils mAssistUtils;
- WindowManager mWm;
- IWindowManager mIwm;
- UserManager mUm;
- Display mDisplay;
- String mRecentsPackage;
- private int mCurrentUserId;
-
- boolean mIsSafeMode;
-
- int mDummyThumbnailWidth;
- int mDummyThumbnailHeight;
- Paint mBgProtectionPaint;
- Canvas mBgProtectionCanvas;
-
- private final Runnable mGcRunnable = new Runnable() {
- @Override
- public void run() {
- System.gc();
- System.runFinalization();
- }
- };
-
- private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
-
- private final UserInfoController.OnUserInfoChangedListener mOnUserInfoChangedListener =
- (String name, Drawable picture, String userAccount) ->
- mCurrentUserId = mAm.getCurrentUser();
-
- /** Private constructor */
- private SystemServicesProxy(Context context) {
- mContext = context.getApplicationContext();
- mAccm = AccessibilityManager.getInstance(context);
- mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- mIam = ActivityManager.getService();
- mIatm = ActivityTaskManager.getService();
- mPm = context.getPackageManager();
- mIpm = AppGlobals.getPackageManager();
- mAssistUtils = new AssistUtils(context);
- mWm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- mIwm = WindowManagerGlobal.getWindowManagerService();
- mUm = UserManager.get(context);
- mDreamManager = IDreamManager.Stub.asInterface(
- ServiceManager.checkService(DreamService.DREAM_SERVICE));
- mDisplay = mWm.getDefaultDisplay();
- mRecentsPackage = context.getPackageName();
- mIsSafeMode = mPm.isSafeMode();
- mCurrentUserId = mAm.getCurrentUser();
-
- // Get the dummy thumbnail width/heights
- Resources res = context.getResources();
- int wId = com.android.internal.R.dimen.thumbnail_width;
- int hId = com.android.internal.R.dimen.thumbnail_height;
- mDummyThumbnailWidth = res.getDimensionPixelSize(wId);
- mDummyThumbnailHeight = res.getDimensionPixelSize(hId);
-
- // Create the protection paints
- mBgProtectionPaint = new Paint();
- mBgProtectionPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_ATOP));
- mBgProtectionPaint.setColor(0xFFffffff);
- mBgProtectionCanvas = new Canvas();
-
- // Since SystemServicesProxy can be accessed from a per-SysUI process component, create a
- // per-process listener to keep track of the current user id to reduce the number of binder
- // calls to fetch it.
- UserInfoController userInfoController = Dependency.get(UserInfoController.class);
- userInfoController.addCallback(mOnUserInfoChangedListener);
- }
-
- /**
- * Returns the single instance of the {@link SystemServicesProxy}.
- * This should only be called on the main thread.
- */
- public static synchronized SystemServicesProxy getInstance(Context context) {
- if (sSystemServicesProxy == null) {
- sSystemServicesProxy = new SystemServicesProxy(context);
- }
- return sSystemServicesProxy;
- }
-
- /**
- * Requests a gc() from the background thread.
- */
- public void gc() {
- BackgroundThread.getHandler().post(mGcRunnable);
- }
-
- /**
- * Returns whether the recents activity is currently visible.
- */
- public boolean isRecentsActivityVisible() {
- return isRecentsActivityVisible(null);
- }
-
- /**
- * Returns whether the recents activity is currently visible.
- *
- * @param isHomeStackVisible if provided, will return whether the home stack is visible
- * regardless of the recents visibility
- *
- * TODO(winsonc): Refactor this check to just use the recents activity lifecycle
- */
- public boolean isRecentsActivityVisible(MutableBoolean isHomeStackVisible) {
- if (mIam == null) return false;
-
- try {
- List<StackInfo> stackInfos = mIatm.getAllStackInfos();
- ActivityManager.StackInfo homeStackInfo = null;
- ActivityManager.StackInfo fullscreenStackInfo = null;
- ActivityManager.StackInfo recentsStackInfo = null;
- for (int i = 0; i < stackInfos.size(); i++) {
- final StackInfo stackInfo = stackInfos.get(i);
- final WindowConfiguration winConfig = stackInfo.configuration.windowConfiguration;
- final int activityType = winConfig.getActivityType();
- final int windowingMode = winConfig.getWindowingMode();
- if (homeStackInfo == null && activityType == ACTIVITY_TYPE_HOME) {
- homeStackInfo = stackInfo;
- } else if (fullscreenStackInfo == null && activityType == ACTIVITY_TYPE_STANDARD
- && (windowingMode == WINDOWING_MODE_FULLSCREEN
- || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY)) {
- fullscreenStackInfo = stackInfo;
- } else if (recentsStackInfo == null && activityType == ACTIVITY_TYPE_RECENTS) {
- recentsStackInfo = stackInfo;
- }
- }
- boolean homeStackVisibleNotOccluded = isStackNotOccluded(homeStackInfo,
- fullscreenStackInfo);
- boolean recentsStackVisibleNotOccluded = isStackNotOccluded(recentsStackInfo,
- fullscreenStackInfo);
- if (isHomeStackVisible != null) {
- isHomeStackVisible.value = homeStackVisibleNotOccluded;
- }
- ComponentName topActivity = recentsStackInfo != null ?
- recentsStackInfo.topActivity : null;
- return (recentsStackVisibleNotOccluded && topActivity != null
- && topActivity.getPackageName().equals(RecentsImpl.RECENTS_PACKAGE)
- && LegacyRecentsImpl.RECENTS_ACTIVITIES.contains(topActivity.getClassName()));
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- private boolean isStackNotOccluded(ActivityManager.StackInfo stackInfo,
- ActivityManager.StackInfo fullscreenStackInfo) {
- boolean stackVisibleNotOccluded = stackInfo == null || stackInfo.visible;
- if (fullscreenStackInfo != null && stackInfo != null) {
- boolean isFullscreenStackOccludingg = fullscreenStackInfo.visible &&
- fullscreenStackInfo.position > stackInfo.position;
- stackVisibleNotOccluded &= !isFullscreenStackOccludingg;
- }
- return stackVisibleNotOccluded;
- }
-
- /**
- * Returns whether this device is in the safe mode.
- */
- public boolean isInSafeMode() {
- return mIsSafeMode;
- }
-
- /** Moves an already resumed task to the side of the screen to initiate split screen. */
- public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode,
- Rect initialBounds) {
- if (mIatm == null) {
- return false;
- }
-
- try {
- return mIatm.setTaskWindowingModeSplitScreenPrimary(taskId, createMode,
- true /* onTop */, false /* animate */, initialBounds, true /* showRecents */);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- public ActivityManager.StackInfo getSplitScreenPrimaryStack() {
- try {
- return mIatm.getStackInfo(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_UNDEFINED);
- } catch (RemoteException e) {
- return null;
- }
- }
-
- /**
- * @return whether there are any docked tasks for the current user.
- */
- public boolean hasDockedTask() {
- if (mIam == null) return false;
-
- ActivityManager.StackInfo stackInfo = getSplitScreenPrimaryStack();
- if (stackInfo != null) {
- int userId = getCurrentUser();
- boolean hasUserTask = false;
- for (int i = stackInfo.taskUserIds.length - 1; i >= 0 && !hasUserTask; i--) {
- hasUserTask = (stackInfo.taskUserIds[i] == userId);
- }
- return hasUserTask;
- }
- return false;
- }
-
- /**
- * Returns whether there is a soft nav bar on specified display.
- *
- * @param displayId the id of display to check if there is a software navigation bar.
- */
- public boolean hasSoftNavigationBar(int displayId) {
- try {
- return mIwm.hasNavigationBar(displayId);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- /**
- * Returns whether the device has a transposed nav bar (on the right of the screen) in the
- * current display orientation.
- */
- public boolean hasTransposedNavigationBar() {
- Rect insets = new Rect();
- getStableInsets(insets);
- return insets.right > 0;
- }
-
- /** Set the task's windowing mode. */
- public void setTaskWindowingMode(int taskId, int windowingMode) {
- if (mIatm == null) return;
-
- try {
- mIatm.setTaskWindowingMode(taskId, windowingMode, false /* onTop */);
- } catch (RemoteException | IllegalArgumentException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Returns whether the provided {@param userId} represents the system user.
- */
- public boolean isSystemUser(int userId) {
- return userId == UserHandle.USER_SYSTEM;
- }
-
- /**
- * Returns the current user id. Used instead of KeyguardUpdateMonitor in SystemUI components
- * that run in the non-primary SystemUI process.
- */
- public int getCurrentUser() {
- return mCurrentUserId;
- }
-
- /**
- * Returns the processes user id.
- */
- public int getProcessUser() {
- if (mUm == null) return 0;
- return mUm.getUserHandle();
- }
-
- /**
- * Returns whether touch exploration is currently enabled.
- */
- public boolean isTouchExplorationEnabled() {
- if (mAccm == null) return false;
-
- return mAccm.isEnabled() && mAccm.isTouchExplorationEnabled();
- }
-
- /**
- * Returns whether the current task is in screen-pinning mode.
- */
- public boolean isScreenPinningActive() {
- if (mIam == null) return false;
-
- try {
- return mIatm.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_PINNED;
- } catch (RemoteException e) {
- return false;
- }
- }
-
- /**
- * Returns the smallest width/height.
- */
- public int getDeviceSmallestWidth() {
- if (mDisplay == null) return 0;
-
- Point smallestSizeRange = new Point();
- Point largestSizeRange = new Point();
- mDisplay.getCurrentSizeRange(smallestSizeRange, largestSizeRange);
- return smallestSizeRange.x;
- }
-
- /**
- * Returns the current display rect in the current display orientation.
- */
- public Rect getDisplayRect() {
- Rect displayRect = new Rect();
- if (mDisplay == null) return displayRect;
-
- Point p = new Point();
- mDisplay.getRealSize(p);
- displayRect.set(0, 0, p.x, p.y);
- return displayRect;
- }
-
- /**
- * Returns the window rect for the RecentsActivity, based on the dimensions of the recents stack
- */
- public Rect getWindowRect() {
- Rect windowRect = new Rect();
- if (mIam == null) return windowRect;
-
- try {
- // Use the recents stack bounds, fallback to fullscreen stack if it is null
- ActivityManager.StackInfo stackInfo =
- mIatm.getStackInfo(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS);
- if (stackInfo == null) {
- stackInfo = mIatm.getStackInfo(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
- }
- if (stackInfo != null) {
- windowRect.set(stackInfo.bounds);
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- } finally {
- return windowRect;
- }
- }
-
- public void startActivityAsUserAsync(Intent intent, ActivityOptions opts) {
- mUiOffloadThread.submit(() -> mContext.startActivityAsUser(intent,
- opts != null ? opts.toBundle() : null, UserHandle.CURRENT));
- }
-
- /** Starts an in-place animation on the front most application windows. */
- public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions opts) {
- if (mIam == null) return;
-
- try {
- mIatm.startInPlaceAnimationOnFrontMostApplication(
- opts == null ? null : opts.toBundle());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void registerDockedStackListener(IDockedStackListener listener) {
- if (mWm == null) return;
-
- try {
- mIwm.registerDockedStackListener(listener);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Calculates the size of the dock divider in the current orientation.
- */
- public int getDockedDividerSize(Context context) {
- Resources res = context.getResources();
- int dividerWindowWidth = res.getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_thickness);
- int dividerInsets = res.getDimensionPixelSize(
- com.android.internal.R.dimen.docked_stack_divider_insets);
- return dividerWindowWidth - 2 * dividerInsets;
- }
-
- public void requestKeyboardShortcuts(
- Context context, KeyboardShortcutsReceiver receiver, int deviceId) {
- mWm.requestAppKeyboardShortcuts(receiver, deviceId);
- }
-
- public void getStableInsets(Rect outStableInsets) {
- if (mWm == null) return;
-
- try {
- mIwm.getStableInsets(Display.DEFAULT_DISPLAY, outStableInsets);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Updates the visibility of recents.
- */
- public void setRecentsVisibility(final boolean visible) {
- mUiOffloadThread.submit(() -> {
- try {
- mIwm.setRecentsVisibility(visible);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to reach window manager", e);
- }
- });
- }
-
- /**
- * Updates the visibility of the picture-in-picture.
- */
- public void setPipVisibility(final boolean visible) {
- mUiOffloadThread.submit(() -> {
- try {
- mIwm.setPipVisibility(visible);
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to reach window manager", e);
- }
- });
- }
-
- public boolean isDreaming() {
- try {
- return mDreamManager.isDreaming();
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to query dream manager.", e);
- }
- return false;
- }
-
- public void awakenDreamsAsync() {
- mUiOffloadThread.submit(() -> {
- try {
- mDreamManager.awaken();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- });
- }
-
- public interface StartActivityFromRecentsResultListener {
- void onStartActivityResult(boolean succeeded);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/BackgroundTaskLoader.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/BackgroundTaskLoader.java
deleted file mode 100644
index e85a7fb..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/BackgroundTaskLoader.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.util.Log;
-
-import com.android.systemui.shared.recents.model.IconLoader;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-/**
- * Background task resource loader
- */
-class BackgroundTaskLoader implements Runnable {
- static String TAG = "BackgroundTaskLoader";
- static boolean DEBUG = false;
-
- private Context mContext;
- private final HandlerThread mLoadThread;
- private final Handler mLoadThreadHandler;
- private final Handler mMainThreadHandler;
-
- private final TaskResourceLoadQueue mLoadQueue;
- private final IconLoader mIconLoader;
-
- private boolean mStarted;
- private boolean mCancelled;
- private boolean mWaitingOnLoadQueue;
-
- private final OnIdleChangedListener mOnIdleChangedListener;
-
- /** Constructor, creates a new loading thread that loads task resources in the background */
- public BackgroundTaskLoader(TaskResourceLoadQueue loadQueue,
- IconLoader iconLoader, OnIdleChangedListener onIdleChangedListener) {
- mLoadQueue = loadQueue;
- mIconLoader = iconLoader;
- mMainThreadHandler = new Handler();
- mOnIdleChangedListener = onIdleChangedListener;
- mLoadThread = new HandlerThread("Recents-TaskResourceLoader",
- android.os.Process.THREAD_PRIORITY_BACKGROUND);
- mLoadThread.start();
- mLoadThreadHandler = new Handler(mLoadThread.getLooper());
- }
-
- /** Restarts the loader thread */
- void start(Context context) {
- mContext = context;
- mCancelled = false;
- if (!mStarted) {
- // Start loading on the load thread
- mStarted = true;
- mLoadThreadHandler.post(this);
- } else {
- // Notify the load thread to start loading again
- synchronized (mLoadThread) {
- mLoadThread.notifyAll();
- }
- }
- }
-
- /** Requests the loader thread to stop after the current iteration */
- void stop() {
- // Mark as cancelled for the thread to pick up
- mCancelled = true;
- // If we are waiting for the load queue for more tasks, then we can just reset the
- // Context now, since nothing is using it
- if (mWaitingOnLoadQueue) {
- mContext = null;
- }
- }
-
- @Override
- public void run() {
- while (true) {
- if (mCancelled) {
- // We have to unset the context here, since the background thread may be using it
- // when we call stop()
- mContext = null;
- // If we are cancelled, then wait until we are started again
- synchronized(mLoadThread) {
- try {
- mLoadThread.wait();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
- } else {
- // If we've stopped the loader, then fall through to the above logic to wait on
- // the load thread
- processLoadQueueItem();
-
- // If there are no other items in the list, then just wait until something is added
- if (!mCancelled && mLoadQueue.isEmpty()) {
- synchronized(mLoadQueue) {
- try {
- mWaitingOnLoadQueue = true;
- mMainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- mOnIdleChangedListener.onIdleChanged(true);
- }
- });
- mLoadQueue.wait();
- mMainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- mOnIdleChangedListener.onIdleChanged(false);
- }
- });
- mWaitingOnLoadQueue = false;
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
- }
- }
- }
- }
-
- /**
- * This needs to be in a separate method to work around an surprising interpreter behavior:
- * The register will keep the local reference to cachedThumbnailData even if it falls out of
- * scope. Putting it into a method fixes this issue.
- */
- private void processLoadQueueItem() {
- // Load the next item from the queue
- final Task t = mLoadQueue.nextTask();
- if (t != null) {
- final Drawable icon = mIconLoader.getIcon(t);
- if (DEBUG) Log.d(TAG, "Loading thumbnail: " + t.key);
- final ThumbnailData thumbnailData =
- ActivityManagerWrapper.getInstance().getTaskThumbnail(t.key.id,
- true /* reducedResolution */);
-
- if (!mCancelled) {
- // Notify that the task data has changed
- mMainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- t.notifyTaskDataLoaded(thumbnailData, icon);
- }
- });
- }
- }
- }
-
- interface OnIdleChangedListener {
- void onIdleChanged(boolean idle);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/FilteredTaskList.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/FilteredTaskList.java
deleted file mode 100644
index 005be75..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/FilteredTaskList.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import android.util.ArrayMap;
-import android.util.SparseArray;
-
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A list of filtered tasks.
- */
-class FilteredTaskList {
-
- private final ArrayList<Task> mTasks = new ArrayList<>();
- private final ArrayList<Task> mFilteredTasks = new ArrayList<>();
- private final ArrayMap<TaskKey, Integer> mFilteredTaskIndices = new ArrayMap<>();
- private TaskFilter mFilter;
-
- /** Sets the task filter, and returns whether the set of filtered tasks have changed. */
- boolean setFilter(TaskFilter filter) {
- ArrayList<Task> prevFilteredTasks = new ArrayList<>(mFilteredTasks);
- mFilter = filter;
- updateFilteredTasks();
- return !prevFilteredTasks.equals(mFilteredTasks);
- }
-
- /** Adds a new task to the task list */
- void add(Task t) {
- mTasks.add(t);
- updateFilteredTasks();
- }
-
- /** Sets the list of tasks */
- void set(List<Task> tasks) {
- mTasks.clear();
- mTasks.addAll(tasks);
- updateFilteredTasks();
- }
-
- /** Removes a task from the base list only if it is in the filtered list */
- boolean remove(Task t) {
- if (mFilteredTasks.contains(t)) {
- boolean removed = mTasks.remove(t);
- updateFilteredTasks();
- return removed;
- }
- return false;
- }
-
- /** Returns the index of this task in the list of filtered tasks */
- int indexOf(Task t) {
- if (t != null && mFilteredTaskIndices.containsKey(t.key)) {
- return mFilteredTaskIndices.get(t.key);
- }
- return -1;
- }
-
- /** Returns the size of the list of filtered tasks */
- int size() {
- return mFilteredTasks.size();
- }
-
- /** Returns whether the filtered list contains this task */
- boolean contains(Task t) {
- return mFilteredTaskIndices.containsKey(t.key);
- }
-
- /** Updates the list of filtered tasks whenever the base task list changes */
- private void updateFilteredTasks() {
- mFilteredTasks.clear();
- if (mFilter != null) {
- // Create a sparse array from task id to Task
- SparseArray<Task> taskIdMap = new SparseArray<>();
- int taskCount = mTasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task t = mTasks.get(i);
- taskIdMap.put(t.key.id, t);
- }
-
- for (int i = 0; i < taskCount; i++) {
- Task t = mTasks.get(i);
- if (mFilter.acceptTask(taskIdMap, t, i)) {
- mFilteredTasks.add(t);
- }
- }
- } else {
- mFilteredTasks.addAll(mTasks);
- }
- updateFilteredTaskIndices();
- }
-
- /** Updates the mapping of tasks to indices. */
- private void updateFilteredTaskIndices() {
- int taskCount = mFilteredTasks.size();
- mFilteredTaskIndices.clear();
- for (int i = 0; i < taskCount; i++) {
- Task t = mFilteredTasks.get(i);
- mFilteredTaskIndices.put(t.key, i);
- }
- }
-
- /** Returns the list of filtered tasks */
- ArrayList<Task> getTasks() {
- return mFilteredTasks;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/HighResThumbnailLoader.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/HighResThumbnailLoader.java
deleted file mode 100644
index 34bc334..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/HighResThumbnailLoader.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import static android.os.Process.setThreadPriority;
-
-import android.os.Handler;
-import android.os.Looper;
-import android.os.SystemClock;
-import android.util.ArraySet;
-
-import com.android.internal.annotations.GuardedBy;
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskCallbacks;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-
-/**
- * Loader class that loads full-resolution thumbnails when appropriate.
- */
-public class HighResThumbnailLoader implements
- TaskCallbacks, BackgroundTaskLoader.OnIdleChangedListener {
-
- private final ActivityManagerWrapper mActivityManager;
-
- @GuardedBy("mLoadQueue")
- private final ArrayDeque<Task> mLoadQueue = new ArrayDeque<>();
- @GuardedBy("mLoadQueue")
- private final ArraySet<Task> mLoadingTasks = new ArraySet<>();
- @GuardedBy("mLoadQueue")
- private boolean mLoaderIdling;
-
- private final ArrayList<Task> mVisibleTasks = new ArrayList<>();
-
- private final Thread mLoadThread;
- private final Handler mMainThreadHandler;
- private final boolean mIsLowRamDevice;
- private boolean mLoading;
- private boolean mVisible;
- private boolean mFlingingFast;
- private boolean mTaskLoadQueueIdle;
-
- public HighResThumbnailLoader(ActivityManagerWrapper activityManager, Looper looper,
- boolean isLowRamDevice) {
- mActivityManager = activityManager;
- mMainThreadHandler = new Handler(looper);
- mLoadThread = new Thread(mLoader, "Recents-HighResThumbnailLoader");
- mLoadThread.start();
- mIsLowRamDevice = isLowRamDevice;
- }
-
- public void setVisible(boolean visible) {
- if (mIsLowRamDevice) {
- return;
- }
- mVisible = visible;
- updateLoading();
- }
-
- public void setFlingingFast(boolean flingingFast) {
- if (mFlingingFast == flingingFast || mIsLowRamDevice) {
- return;
- }
- mFlingingFast = flingingFast;
- updateLoading();
- }
-
- @Override
- public void onIdleChanged(boolean idle) {
- setTaskLoadQueueIdle(idle);
- }
-
- /**
- * Sets whether the other task load queue is idling. Avoid double-loading bitmaps by not
- * starting this queue until the other queue is idling.
- */
- public void setTaskLoadQueueIdle(boolean idle) {
- if (mIsLowRamDevice) {
- return;
- }
- mTaskLoadQueueIdle = idle;
- updateLoading();
- }
-
- @VisibleForTesting
- boolean isLoading() {
- return mLoading;
- }
-
- private void updateLoading() {
- setLoading(mVisible && !mFlingingFast && mTaskLoadQueueIdle);
- }
-
- private void setLoading(boolean loading) {
- if (loading == mLoading) {
- return;
- }
- synchronized (mLoadQueue) {
- mLoading = loading;
- if (!loading) {
- stopLoading();
- } else {
- startLoading();
- }
- }
- }
-
- @GuardedBy("mLoadQueue")
- private void startLoading() {
- for (int i = mVisibleTasks.size() - 1; i >= 0; i--) {
- Task t = mVisibleTasks.get(i);
- if ((t.thumbnail == null || t.thumbnail.reducedResolution)
- && !mLoadQueue.contains(t) && !mLoadingTasks.contains(t)) {
- mLoadQueue.add(t);
- }
- }
- mLoadQueue.notifyAll();
- }
-
- @GuardedBy("mLoadQueue")
- private void stopLoading() {
- mLoadQueue.clear();
- mLoadQueue.notifyAll();
- }
-
- /**
- * Needs to be called when a task becomes visible. Note that this is different from
- * {@link TaskCallbacks#onTaskDataLoaded} as this method should only be called once when it
- * becomes visible, whereas onTaskDataLoaded can be called multiple times whenever some data
- * has been updated.
- */
- public void onTaskVisible(Task t) {
- t.addCallback(this);
- mVisibleTasks.add(t);
- if ((t.thumbnail == null || t.thumbnail.reducedResolution) && mLoading) {
- synchronized (mLoadQueue) {
- mLoadQueue.add(t);
- mLoadQueue.notifyAll();
- }
- }
- }
-
- /**
- * Needs to be called when a task becomes visible. See {@link #onTaskVisible} why this is
- * different from {@link TaskCallbacks#onTaskDataUnloaded()}
- */
- public void onTaskInvisible(Task t) {
- t.removeCallback(this);
- mVisibleTasks.remove(t);
- synchronized (mLoadQueue) {
- mLoadQueue.remove(t);
- }
- }
-
- @VisibleForTesting
- void waitForLoaderIdle() {
- while (true) {
- synchronized (mLoadQueue) {
- if (mLoadQueue.isEmpty() && mLoaderIdling) {
- return;
- }
- }
- SystemClock.sleep(100);
- }
- }
-
- @Override
- public void onTaskDataLoaded(Task task, ThumbnailData thumbnailData) {
- if (thumbnailData != null && !thumbnailData.reducedResolution) {
- synchronized (mLoadQueue) {
- mLoadQueue.remove(task);
- }
- }
- }
-
- @Override
- public void onTaskDataUnloaded() {
- }
-
- @Override
- public void onTaskWindowingModeChanged() {
- }
-
- private final Runnable mLoader = new Runnable() {
-
- @Override
- public void run() {
- setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND + 1);
- while (true) {
- Task next = null;
- synchronized (mLoadQueue) {
- if (!mLoading || mLoadQueue.isEmpty()) {
- try {
- mLoaderIdling = true;
- mLoadQueue.wait();
- mLoaderIdling = false;
- } catch (InterruptedException e) {
- // Don't care.
- }
- } else {
- next = mLoadQueue.poll();
- if (next != null) {
- mLoadingTasks.add(next);
- }
- }
- }
- if (next != null) {
- loadTask(next);
- }
- }
- }
-
- private void loadTask(final Task t) {
- final ThumbnailData thumbnail = mActivityManager.getTaskThumbnail(t.key.id,
- false /* reducedResolution */);
- mMainThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- synchronized (mLoadQueue) {
- mLoadingTasks.remove(t);
- }
- if (mVisibleTasks.contains(t)) {
- t.notifyTaskDataLoaded(thumbnail, t.icon);
- }
- }
- });
- }
- };
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
deleted file mode 100644
index 2df79d8..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.model;
-
-import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
-
-import android.app.ActivityManager;
-import android.app.ActivityTaskManager;
-import android.app.KeyguardManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.util.SparseBooleanArray;
-
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-
-/**
- * This class stores the loading state as it goes through multiple stages of loading:
- * 1) preloadRawTasks() will load the raw set of recents tasks from the system
- * 2) preloadPlan() will construct a new task stack with all metadata and only icons and
- * thumbnails that are currently in the cache
- * 3) executePlan() will actually load and fill in the icons and thumbnails according to the load
- * options specified, such that we can transition into the Recents activity seamlessly
- */
-public class RecentsTaskLoadPlan {
-
- /** The set of conditions to preload tasks. */
- public static class PreloadOptions {
- public boolean loadTitles = true;
- }
-
- /** The set of conditions to load tasks. */
- public static class Options {
- public int runningTaskId = -1;
- public boolean loadIcons = true;
- public boolean loadThumbnails = false;
- public boolean onlyLoadForCache = false;
- public boolean onlyLoadPausedActivities = false;
- public int numVisibleTasks = 0;
- public int numVisibleTaskThumbnails = 0;
- }
-
- private final Context mContext;
- private final KeyguardManager mKeyguardManager;
-
- private List<ActivityManager.RecentTaskInfo> mRawTasks;
- private TaskStack mStack;
-
- private final SparseBooleanArray mTmpLockedUsers = new SparseBooleanArray();
-
- public RecentsTaskLoadPlan(Context context) {
- mContext = context;
- mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
- }
-
- /**
- * Preloads the list of recent tasks from the system. After this call, the TaskStack will
- * have a list of all the recent tasks with their metadata, not including icons or
- * thumbnails which were not cached and have to be loaded.
- *
- * The tasks will be ordered by:
- * - least-recent to most-recent stack tasks
- *
- * Note: Do not lock, since this can be calling back to the loader, which separately also drives
- * this call (callers should synchronize on the loader before making this call).
- */
- public void preloadPlan(PreloadOptions opts, RecentsTaskLoader loader, int runningTaskId,
- int currentUserId) {
- Resources res = mContext.getResources();
- ArrayList<Task> allTasks = new ArrayList<>();
- if (mRawTasks == null) {
- mRawTasks = ActivityManagerWrapper.getInstance().getRecentTasks(
- ActivityTaskManager.getMaxRecentTasksStatic(), currentUserId);
-
- // Since the raw tasks are given in most-recent to least-recent order, we need to reverse it
- Collections.reverse(mRawTasks);
- }
-
- int taskCount = mRawTasks.size();
- for (int i = 0; i < taskCount; i++) {
- ActivityManager.RecentTaskInfo t = mRawTasks.get(i);
-
- // Compose the task key
- final ComponentName sourceComponent = t.origActivity != null
- // Activity alias if there is one
- ? t.origActivity
- // The real activity if there is no alias (or the target if there is one)
- : t.realActivity;
- final int windowingMode = t.configuration.windowConfiguration.getWindowingMode();
- TaskKey taskKey = new TaskKey(t.persistentId, windowingMode, t.baseIntent,
- sourceComponent, t.userId, t.lastActiveTime, t.displayId);
-
- boolean isFreeformTask = windowingMode == WINDOWING_MODE_FREEFORM;
- boolean isStackTask = !isFreeformTask;
- boolean isLaunchTarget = taskKey.id == runningTaskId;
-
- ActivityInfo info = loader.getAndUpdateActivityInfo(taskKey);
- if (info == null) {
- continue;
- }
-
- // Load the title, icon, and color
- String title = opts.loadTitles
- ? loader.getAndUpdateActivityTitle(taskKey, t.taskDescription)
- : "";
- String titleDescription = opts.loadTitles
- ? loader.getAndUpdateContentDescription(taskKey, t.taskDescription)
- : "";
- Drawable icon = isStackTask
- ? loader.getAndUpdateActivityIcon(taskKey, t.taskDescription, false)
- : null;
- ThumbnailData thumbnail = loader.getAndUpdateThumbnail(taskKey,
- false /* loadIfNotCached */, false /* storeInCache */);
- int activityColor = loader.getActivityPrimaryColor(t.taskDescription);
- int backgroundColor = loader.getActivityBackgroundColor(t.taskDescription);
- boolean isSystemApp = (info != null) &&
- ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
-
- // TODO: Refactor to not do this every preload
- if (mTmpLockedUsers.indexOfKey(t.userId) < 0) {
- mTmpLockedUsers.put(t.userId, mKeyguardManager.isDeviceLocked(t.userId));
- }
- boolean isLocked = mTmpLockedUsers.get(t.userId);
-
- // Add the task to the stack
- Task task = new Task(taskKey, icon,
- thumbnail, title, titleDescription, activityColor, backgroundColor,
- isLaunchTarget, isStackTask, isSystemApp, t.supportsSplitScreenMultiWindow,
- t.taskDescription, t.resizeMode, t.topActivity, isLocked);
-
- allTasks.add(task);
- }
-
- // Initialize the stacks
- mStack = new TaskStack();
- mStack.setTasks(allTasks, false /* notifyStackChanges */);
- }
-
- /**
- * Called to apply the actual loading based on the specified conditions.
- *
- * Note: Do not lock, since this can be calling back to the loader, which separately also drives
- * this call (callers should synchronize on the loader before making this call).
- */
- public void executePlan(Options opts, RecentsTaskLoader loader) {
- Resources res = mContext.getResources();
-
- // Iterate through each of the tasks and load them according to the load conditions.
- ArrayList<Task> tasks = mStack.getTasks();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- TaskKey taskKey = task.key;
-
- boolean isRunningTask = (task.key.id == opts.runningTaskId);
- boolean isVisibleTask = i >= (taskCount - opts.numVisibleTasks);
- boolean isVisibleThumbnail = i >= (taskCount - opts.numVisibleTaskThumbnails);
-
- // If requested, skip the running task
- if (opts.onlyLoadPausedActivities && isRunningTask) {
- continue;
- }
-
- if (opts.loadIcons && (isRunningTask || isVisibleTask)) {
- if (task.icon == null) {
- task.icon = loader.getAndUpdateActivityIcon(taskKey, task.taskDescription,
- true);
- }
- }
- if (opts.loadThumbnails && isVisibleThumbnail) {
- task.thumbnail = loader.getAndUpdateThumbnail(taskKey,
- true /* loadIfNotCached */, true /* storeInCache */);
- }
- }
- }
-
- /**
- * Returns the TaskStack from the preloaded list of recent tasks.
- */
- public TaskStack getTaskStack() {
- return mStack;
- }
-
- /** Returns whether there are any tasks in any stacks. */
- public boolean hasTasks() {
- if (mStack != null) {
- return mStack.getTaskCount() > 0;
- }
- return false;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoader.java
deleted file mode 100644
index 012913a..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.model;
-
-import android.app.ActivityManager;
-import android.app.ActivityTaskManager;
-import android.content.ComponentCallbacks2;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.graphics.drawable.Drawable;
-import android.os.Looper;
-import android.os.Trace;
-import android.util.Log;
-import android.util.LruCache;
-
-import com.android.internal.annotations.GuardedBy;
-import com.android.systemui.recents.model.RecentsTaskLoadPlan.Options;
-import com.android.systemui.recents.model.RecentsTaskLoadPlan.PreloadOptions;
-import com.android.systemui.shared.recents.model.IconLoader;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-import com.android.systemui.shared.recents.model.TaskKeyLruCache;
-import com.android.systemui.shared.recents.model.TaskKeyLruCache.EvictionCallback;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-import java.io.PrintWriter;
-import java.util.Map;
-
-
-/**
- * Recents task loader
- */
-public class RecentsTaskLoader {
- private static final String TAG = "RecentsTaskLoader";
- private static final boolean DEBUG = false;
-
- /** Levels of svelte in increasing severity/austerity. */
- // No svelting.
- public static final int SVELTE_NONE = 0;
- // Limit thumbnail cache to number of visible thumbnails when Recents was loaded, disable
- // caching thumbnails as you scroll.
- public static final int SVELTE_LIMIT_CACHE = 1;
- // Disable the thumbnail cache, load thumbnails asynchronously when the activity loads and
- // evict all thumbnails when hidden.
- public static final int SVELTE_DISABLE_CACHE = 2;
- // Disable all thumbnail loading.
- public static final int SVELTE_DISABLE_LOADING = 3;
-
- // This activity info LruCache is useful because it can be expensive to retrieve ActivityInfos
- // for many tasks, which we use to get the activity labels and icons. Unlike the other caches
- // below, this is per-package so we can't invalidate the items in the cache based on the last
- // active time. Instead, we rely on the PackageMonitor to keep us informed whenever a
- // package in the cache has been updated, so that we may remove it.
- private final LruCache<ComponentName, ActivityInfo> mActivityInfoCache;
- private final TaskKeyLruCache<Drawable> mIconCache;
- private final TaskKeyLruCache<String> mActivityLabelCache;
- private final TaskKeyLruCache<String> mContentDescriptionCache;
- private final TaskResourceLoadQueue mLoadQueue;
- private final IconLoader mIconLoader;
- private final BackgroundTaskLoader mLoader;
- private final HighResThumbnailLoader mHighResThumbnailLoader;
- @GuardedBy("this")
- private final TaskKeyStrongCache<ThumbnailData> mThumbnailCache = new TaskKeyStrongCache<>();
- @GuardedBy("this")
- private final TaskKeyStrongCache<ThumbnailData> mTempCache = new TaskKeyStrongCache<>();
- private final int mMaxThumbnailCacheSize;
- private final int mMaxIconCacheSize;
- private int mNumVisibleTasksLoaded;
- private int mSvelteLevel;
-
- private int mDefaultTaskBarBackgroundColor;
- private int mDefaultTaskViewBackgroundColor;
-
- private EvictionCallback mClearActivityInfoOnEviction = new EvictionCallback() {
- @Override
- public void onEntryEvicted(TaskKey key) {
- if (key != null) {
- mActivityInfoCache.remove(key.getComponent());
- }
- }
- };
-
- public RecentsTaskLoader(Context context, int maxThumbnailCacheSize, int maxIconCacheSize,
- int svelteLevel) {
- mMaxThumbnailCacheSize = maxThumbnailCacheSize;
- mMaxIconCacheSize = maxIconCacheSize;
- mSvelteLevel = svelteLevel;
-
- // Initialize the proxy, cache and loaders
- int numRecentTasks = ActivityTaskManager.getMaxRecentTasksStatic();
- mHighResThumbnailLoader = new HighResThumbnailLoader(ActivityManagerWrapper.getInstance(),
- Looper.getMainLooper(), ActivityManager.isLowRamDeviceStatic());
- mLoadQueue = new TaskResourceLoadQueue();
- mIconCache = new TaskKeyLruCache<>(mMaxIconCacheSize, mClearActivityInfoOnEviction);
- mActivityLabelCache = new TaskKeyLruCache<>(numRecentTasks, mClearActivityInfoOnEviction);
- mContentDescriptionCache = new TaskKeyLruCache<>(numRecentTasks,
- mClearActivityInfoOnEviction);
- mActivityInfoCache = new LruCache<>(numRecentTasks);
-
- mIconLoader = createNewIconLoader(context, mIconCache, mActivityInfoCache);
- mLoader = new BackgroundTaskLoader(mLoadQueue, mIconLoader, mHighResThumbnailLoader);
- }
-
- protected IconLoader createNewIconLoader(Context context,TaskKeyLruCache<Drawable> iconCache,
- LruCache<ComponentName, ActivityInfo> activityInfoCache) {
- return new IconLoader.DefaultIconLoader(context, iconCache, activityInfoCache);
- }
-
- /**
- * Sets the default task bar/view colors if none are provided by the app.
- */
- public void setDefaultColors(int defaultTaskBarBackgroundColor,
- int defaultTaskViewBackgroundColor) {
- mDefaultTaskBarBackgroundColor = defaultTaskBarBackgroundColor;
- mDefaultTaskViewBackgroundColor = defaultTaskViewBackgroundColor;
- }
-
- /** Returns the size of the app icon cache. */
- public int getIconCacheSize() {
- return mMaxIconCacheSize;
- }
-
- /** Returns the size of the thumbnail cache. */
- public int getThumbnailCacheSize() {
- return mMaxThumbnailCacheSize;
- }
-
- public HighResThumbnailLoader getHighResThumbnailLoader() {
- return mHighResThumbnailLoader;
- }
-
- /** Preloads recents tasks using the specified plan to store the output. */
- public synchronized void preloadTasks(RecentsTaskLoadPlan plan, int runningTaskId) {
- preloadTasks(plan, runningTaskId, ActivityManagerWrapper.getInstance().getCurrentUserId());
- }
-
- /** Preloads recents tasks using the specified plan to store the output. */
- public synchronized void preloadTasks(RecentsTaskLoadPlan plan, int runningTaskId,
- int currentUserId) {
- try {
- Trace.beginSection("preloadPlan");
- plan.preloadPlan(new PreloadOptions(), this, runningTaskId, currentUserId);
- } finally {
- Trace.endSection();
- }
- }
-
- /** Begins loading the heavy task data according to the specified options. */
- public synchronized void loadTasks(RecentsTaskLoadPlan plan, Options opts) {
- if (opts == null) {
- throw new RuntimeException("Requires load options");
- }
- if (opts.onlyLoadForCache && opts.loadThumbnails) {
- // If we are loading for the cache, we'd like to have the real cache only include the
- // visible thumbnails. However, we also don't want to reload already cached thumbnails.
- // Thus, we copy over the current entries into a second cache, and clear the real cache,
- // such that the real cache only contains visible thumbnails.
- mTempCache.copyEntries(mThumbnailCache);
- mThumbnailCache.evictAll();
- }
- plan.executePlan(opts, this);
- mTempCache.evictAll();
- if (!opts.onlyLoadForCache) {
- mNumVisibleTasksLoaded = opts.numVisibleTasks;
- }
- }
-
- /**
- * Acquires the task resource data directly from the cache, loading if necessary.
- */
- public void loadTaskData(Task t) {
- Drawable icon = mIconCache.getAndInvalidateIfModified(t.key);
- icon = icon != null ? icon : mIconLoader.getDefaultIcon(t.key.userId);
- mLoadQueue.addTask(t);
- t.notifyTaskDataLoaded(t.thumbnail, icon);
- }
-
- /** Releases the task resource data back into the pool. */
- public void unloadTaskData(Task t) {
- mLoadQueue.removeTask(t);
- t.notifyTaskDataUnloaded(mIconLoader.getDefaultIcon(t.key.userId));
- }
-
- /** Completely removes the resource data from the pool. */
- public void deleteTaskData(Task t, boolean notifyTaskDataUnloaded) {
- mLoadQueue.removeTask(t);
- mIconCache.remove(t.key);
- mActivityLabelCache.remove(t.key);
- mContentDescriptionCache.remove(t.key);
- if (notifyTaskDataUnloaded) {
- t.notifyTaskDataUnloaded(mIconLoader.getDefaultIcon(t.key.userId));
- }
- }
-
- /**
- * Handles signals from the system, trimming memory when requested to prevent us from running
- * out of memory.
- */
- public synchronized void onTrimMemory(int level) {
- switch (level) {
- case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
- // Stop the loader immediately when the UI is no longer visible
- stopLoader();
- mIconCache.trimToSize(Math.max(mNumVisibleTasksLoaded,
- mMaxIconCacheSize / 2));
- break;
- case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
- case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
- // We are leaving recents, so trim the data a bit
- mIconCache.trimToSize(Math.max(1, mMaxIconCacheSize / 2));
- mActivityInfoCache.trimToSize(Math.max(1,
- ActivityTaskManager.getMaxRecentTasksStatic() / 2));
- break;
- case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
- case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
- // We are going to be low on memory
- mIconCache.trimToSize(Math.max(1, mMaxIconCacheSize / 4));
- mActivityInfoCache.trimToSize(Math.max(1,
- ActivityTaskManager.getMaxRecentTasksStatic() / 4));
- break;
- case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
- case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
- // We are low on memory, so release everything
- mIconCache.evictAll();
- mActivityInfoCache.evictAll();
- // The cache is small, only clear the label cache when we are critical
- mActivityLabelCache.evictAll();
- mContentDescriptionCache.evictAll();
- mThumbnailCache.evictAll();
- break;
- default:
- break;
- }
- }
-
- public void onPackageChanged(String packageName) {
- // Remove all the cached activity infos for this package. The other caches do not need to
- // be pruned at this time, as the TaskKey expiration checks will flush them next time their
- // cached contents are requested
- Map<ComponentName, ActivityInfo> activityInfoCache = mActivityInfoCache.snapshot();
- for (ComponentName cn : activityInfoCache.keySet()) {
- if (cn.getPackageName().equals(packageName)) {
- if (DEBUG) {
- Log.d(TAG, "Removing activity info from cache: " + cn);
- }
- mActivityInfoCache.remove(cn);
- }
- }
- }
-
- /**
- * Returns the cached task label if the task key is not expired, updating the cache if it is.
- */
- String getAndUpdateActivityTitle(TaskKey taskKey, ActivityManager.TaskDescription td) {
- // Return the task description label if it exists
- if (td != null && td.getLabel() != null) {
- return td.getLabel();
- }
- // Return the cached activity label if it exists
- String label = mActivityLabelCache.getAndInvalidateIfModified(taskKey);
- if (label != null) {
- return label;
- }
- // All short paths failed, load the label from the activity info and cache it
- ActivityInfo activityInfo = getAndUpdateActivityInfo(taskKey);
- if (activityInfo != null) {
- label = ActivityManagerWrapper.getInstance().getBadgedActivityLabel(activityInfo,
- taskKey.userId);
- mActivityLabelCache.put(taskKey, label);
- return label;
- }
- // If the activity info does not exist or fails to load, return an empty label for now,
- // but do not cache it
- return "";
- }
-
- /**
- * Returns the cached task content description if the task key is not expired, updating the
- * cache if it is.
- */
- String getAndUpdateContentDescription(TaskKey taskKey, ActivityManager.TaskDescription td) {
- // Return the cached content description if it exists
- String label = mContentDescriptionCache.getAndInvalidateIfModified(taskKey);
- if (label != null) {
- return label;
- }
-
- // All short paths failed, load the label from the activity info and cache it
- ActivityInfo activityInfo = getAndUpdateActivityInfo(taskKey);
- if (activityInfo != null) {
- label = ActivityManagerWrapper.getInstance().getBadgedContentDescription(
- activityInfo, taskKey.userId, td);
- if (td == null) {
- // Only add to the cache if the task description is null, otherwise, it is possible
- // for the task description to change between calls without the last active time
- // changing (ie. between preloading and Overview starting) which would lead to stale
- // content descriptions
- // TODO: Investigate improving this
- mContentDescriptionCache.put(taskKey, label);
- }
- return label;
- }
- // If the content description does not exist, return an empty label for now, but do not
- // cache it
- return "";
- }
-
- /**
- * Returns the cached task icon if the task key is not expired, updating the cache if it is.
- */
- Drawable getAndUpdateActivityIcon(TaskKey taskKey, ActivityManager.TaskDescription td,
- boolean loadIfNotCached) {
- return mIconLoader.getAndInvalidateIfModified(taskKey, td, loadIfNotCached);
- }
-
- /**
- * Returns the cached thumbnail if the task key is not expired, updating the cache if it is.
- */
- synchronized ThumbnailData getAndUpdateThumbnail(TaskKey taskKey, boolean loadIfNotCached,
- boolean storeInCache) {
- ThumbnailData cached = mThumbnailCache.getAndInvalidateIfModified(taskKey);
- if (cached != null) {
- return cached;
- }
-
- cached = mTempCache.getAndInvalidateIfModified(taskKey);
- if (cached != null) {
- mThumbnailCache.put(taskKey, cached);
- return cached;
- }
-
- if (loadIfNotCached) {
- if (mSvelteLevel < SVELTE_DISABLE_LOADING) {
- // Load the thumbnail from the system
- ThumbnailData thumbnailData = ActivityManagerWrapper.getInstance().getTaskThumbnail(
- taskKey.id, true /* reducedResolution */);
- if (thumbnailData.thumbnail != null) {
- if (storeInCache) {
- mThumbnailCache.put(taskKey, thumbnailData);
- }
- return thumbnailData;
- }
- }
- }
-
- // We couldn't load any thumbnail
- return null;
- }
-
- /**
- * Returns the task's primary color if possible, defaulting to the default color if there is
- * no specified primary color.
- */
- int getActivityPrimaryColor(ActivityManager.TaskDescription td) {
- if (td != null && td.getPrimaryColor() != 0) {
- return td.getPrimaryColor();
- }
- return mDefaultTaskBarBackgroundColor;
- }
-
- /**
- * Returns the task's background color if possible.
- */
- int getActivityBackgroundColor(ActivityManager.TaskDescription td) {
- if (td != null && td.getBackgroundColor() != 0) {
- return td.getBackgroundColor();
- }
- return mDefaultTaskViewBackgroundColor;
- }
-
- /**
- * Returns the activity info for the given task key, retrieving one from the system if the
- * task key is expired.
- */
- ActivityInfo getAndUpdateActivityInfo(TaskKey taskKey) {
- return mIconLoader.getAndUpdateActivityInfo(taskKey);
- }
-
- /**
- * Starts loading tasks.
- */
- public void startLoader(Context ctx) {
- mLoader.start(ctx);
- }
-
- /**
- * Stops the task loader and clears all queued, pending task loads.
- */
- private void stopLoader() {
- mLoader.stop();
- mLoadQueue.clearTasks();
- }
-
- public synchronized void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
-
- writer.print(prefix); writer.println(TAG);
- writer.print(prefix); writer.println("Icon Cache");
- mIconCache.dump(innerPrefix, writer);
- writer.print(prefix); writer.println("Thumbnail Cache");
- mThumbnailCache.dump(innerPrefix, writer);
- writer.print(prefix); writer.println("Temp Thumbnail Cache");
- mTempCache.dump(innerPrefix, writer);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskFilter.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskFilter.java
deleted file mode 100644
index 9b734ec..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskFilter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import android.util.SparseArray;
-import com.android.systemui.shared.recents.model.Task;
-
-/**
- * An interface for a task filter to query whether a particular task should show in a stack.
- */
-public interface TaskFilter {
- /** Returns whether the filter accepts the specified task */
- boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index);
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskKeyStrongCache.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskKeyStrongCache.java
deleted file mode 100644
index 27f2098..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskKeyStrongCache.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import android.util.ArrayMap;
-
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-
-import com.android.systemui.shared.recents.model.TaskKeyCache;
-import com.android.systemui.shared.recents.model.TaskKeyLruCache;
-import java.io.PrintWriter;
-
-/**
- * Like {@link TaskKeyLruCache}, but without LRU functionality.
- */
-public class TaskKeyStrongCache<V> extends TaskKeyCache<V> {
-
- private static final String TAG = "TaskKeyCache";
-
- private final ArrayMap<Integer, V> mCache = new ArrayMap<>();
-
- public final void copyEntries(TaskKeyStrongCache<V> other) {
- for (int i = other.mKeys.size() - 1; i >= 0; i--) {
- TaskKey key = other.mKeys.valueAt(i);
- put(key, other.mCache.get(key.id));
- }
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
- writer.print(prefix); writer.print(TAG);
- writer.print(" numEntries="); writer.print(mKeys.size());
- writer.println();
- int keyCount = mKeys.size();
- for (int i = 0; i < keyCount; i++) {
- writer.print(innerPrefix); writer.println(mKeys.get(mKeys.keyAt(i)));
- }
- }
-
- @Override
- protected V getCacheEntry(int id) {
- return mCache.get(id);
- }
-
- @Override
- protected void putCacheEntry(int id, V value) {
- mCache.put(id, value);
- }
-
- @Override
- protected void removeCacheEntry(int id) {
- mCache.remove(id);
- }
-
- @Override
- protected void evictAllCache() {
- mCache.clear();
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskResourceLoadQueue.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskResourceLoadQueue.java
deleted file mode 100644
index fe89ad5..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskResourceLoadQueue.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.model;
-
-import com.android.systemui.shared.recents.model.Task;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-/**
- * A Task load queue
- */
-class TaskResourceLoadQueue {
-
- private final ConcurrentLinkedQueue<Task> mQueue = new ConcurrentLinkedQueue<>();
-
- /** Adds a new task to the load queue */
- void addTask(Task t) {
- if (!mQueue.contains(t)) {
- mQueue.add(t);
- }
- synchronized(this) {
- notifyAll();
- }
- }
-
- /**
- * Retrieves the next task from the load queue, as well as whether we want that task to be
- * force reloaded.
- */
- Task nextTask() {
- return mQueue.poll();
- }
-
- /** Removes a task from the load queue */
- void removeTask(Task t) {
- mQueue.remove(t);
- }
-
- /** Clears all the tasks from the load queue */
- void clearTasks() {
- mQueue.clear();
- }
-
- /** Returns whether the load queue is empty */
- boolean isEmpty() {
- return mQueue.isEmpty();
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskStack.java
deleted file mode 100644
index 01e6ba3..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/model/TaskStack.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.model;
-
-import android.content.ComponentName;
-import android.util.ArrayMap;
-import android.util.ArraySet;
-import android.util.SparseArray;
-
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.Task.TaskKey;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.shared.system.PackageManagerWrapper;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * The task stack contains a list of multiple tasks.
- */
-public class TaskStack {
-
- private static final String TAG = "TaskStack";
-
- /** Task stack callbacks */
- public interface TaskStackCallbacks {
- /**
- * Notifies when a new task has been added to the stack.
- */
- void onStackTaskAdded(TaskStack stack, Task newTask);
-
- /**
- * Notifies when a task has been removed from the stack.
- */
- void onStackTaskRemoved(TaskStack stack, Task removedTask, Task newFrontMostTask,
- AnimationProps animation, boolean fromDockGesture,
- boolean dismissRecentsIfAllRemoved);
-
- /**
- * Notifies when all tasks have been removed from the stack.
- */
- void onStackTasksRemoved(TaskStack stack);
-
- /**
- * Notifies when tasks in the stack have been updated.
- */
- void onStackTasksUpdated(TaskStack stack);
- }
-
- private final ArrayList<Task> mRawTaskList = new ArrayList<>();
- private final FilteredTaskList mStackTaskList = new FilteredTaskList();
- private TaskStackCallbacks mCb;
-
- public TaskStack() {
- // Ensure that we only show stack tasks
- mStackTaskList.setFilter(new TaskFilter() {
- @Override
- public boolean acceptTask(SparseArray<Task> taskIdMap, Task t, int index) {
- return t.isStackTask;
- }
- });
- }
-
- /** Sets the callbacks for this task stack. */
- public void setCallbacks(TaskStackCallbacks cb) {
- mCb = cb;
- }
-
- /**
- * Removes a task from the stack, with an additional {@param animation} hint to the callbacks on
- * how they should update themselves.
- */
- public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture) {
- removeTask(t, animation, fromDockGesture, true /* dismissRecentsIfAllRemoved */);
- }
-
- /**
- * Removes a task from the stack, with an additional {@param animation} hint to the callbacks on
- * how they should update themselves.
- */
- public void removeTask(Task t, AnimationProps animation, boolean fromDockGesture,
- boolean dismissRecentsIfAllRemoved) {
- if (mStackTaskList.contains(t)) {
- mStackTaskList.remove(t);
- Task newFrontMostTask = getFrontMostTask();
- if (mCb != null) {
- // Notify that a task has been removed
- mCb.onStackTaskRemoved(this, t, newFrontMostTask, animation,
- fromDockGesture, dismissRecentsIfAllRemoved);
- }
- }
- mRawTaskList.remove(t);
- }
-
- /**
- * Removes all tasks from the stack.
- */
- public void removeAllTasks(boolean notifyStackChanges) {
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task t = tasks.get(i);
- mStackTaskList.remove(t);
- mRawTaskList.remove(t);
- }
- if (mCb != null && notifyStackChanges) {
- // Notify that all tasks have been removed
- mCb.onStackTasksRemoved(this);
- }
- }
-
-
- /**
- * @see #setTasks(List, boolean)
- */
- public void setTasks(TaskStack stack, boolean notifyStackChanges) {
- setTasks(stack.mRawTaskList, notifyStackChanges);
- }
-
- /**
- * Sets a few tasks in one go, without calling any callbacks.
- *
- * @param tasks the new set of tasks to replace the current set.
- * @param notifyStackChanges whether or not to callback on specific changes to the list of tasks.
- */
- public void setTasks(List<Task> tasks, boolean notifyStackChanges) {
- // Compute a has set for each of the tasks
- ArrayMap<TaskKey, Task> currentTasksMap = createTaskKeyMapFromList(mRawTaskList);
- ArrayMap<TaskKey, Task> newTasksMap = createTaskKeyMapFromList(tasks);
- ArrayList<Task> addedTasks = new ArrayList<>();
- ArrayList<Task> removedTasks = new ArrayList<>();
- ArrayList<Task> allTasks = new ArrayList<>();
-
- // Disable notifications if there are no callbacks
- if (mCb == null) {
- notifyStackChanges = false;
- }
-
- // Remove any tasks that no longer exist
- int taskCount = mRawTaskList.size();
- for (int i = taskCount - 1; i >= 0; i--) {
- Task task = mRawTaskList.get(i);
- if (!newTasksMap.containsKey(task.key)) {
- if (notifyStackChanges) {
- removedTasks.add(task);
- }
- }
- }
-
- // Add any new tasks
- taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task newTask = tasks.get(i);
- Task currentTask = currentTasksMap.get(newTask.key);
- if (currentTask == null && notifyStackChanges) {
- addedTasks.add(newTask);
- } else if (currentTask != null) {
- // The current task has bound callbacks, so just copy the data from the new task
- // state and add it back into the list
- currentTask.copyFrom(newTask);
- newTask = currentTask;
- }
- allTasks.add(newTask);
- }
-
- // Sort all the tasks to ensure they are ordered correctly
- for (int i = allTasks.size() - 1; i >= 0; i--) {
- allTasks.get(i).temporarySortIndexInStack = i;
- }
-
- mStackTaskList.set(allTasks);
- mRawTaskList.clear();
- mRawTaskList.addAll(allTasks);
-
- // Only callback for the removed tasks after the stack has updated
- int removedTaskCount = removedTasks.size();
- Task newFrontMostTask = getFrontMostTask();
- for (int i = 0; i < removedTaskCount; i++) {
- mCb.onStackTaskRemoved(this, removedTasks.get(i), newFrontMostTask,
- AnimationProps.IMMEDIATE, false /* fromDockGesture */,
- true /* dismissRecentsIfAllRemoved */);
- }
-
- // Only callback for the newly added tasks after this stack has been updated
- int addedTaskCount = addedTasks.size();
- for (int i = 0; i < addedTaskCount; i++) {
- mCb.onStackTaskAdded(this, addedTasks.get(i));
- }
-
- // Notify that the task stack has been updated
- if (notifyStackChanges) {
- mCb.onStackTasksUpdated(this);
- }
- }
-
- /**
- * Gets the front-most task in the stack.
- */
- public Task getFrontMostTask() {
- ArrayList<Task> stackTasks = mStackTaskList.getTasks();
- if (stackTasks.isEmpty()) {
- return null;
- }
- return stackTasks.get(stackTasks.size() - 1);
- }
-
- /** Gets the task keys */
- public ArrayList<TaskKey> getTaskKeys() {
- ArrayList<TaskKey> taskKeys = new ArrayList<>();
- ArrayList<Task> tasks = computeAllTasksList();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- taskKeys.add(task.key);
- }
- return taskKeys;
- }
-
- /**
- * Returns the set of "active" (non-historical) tasks in the stack that have been used recently.
- */
- public ArrayList<Task> getTasks() {
- return mStackTaskList.getTasks();
- }
-
- /**
- * Computes a set of all the active and historical tasks.
- */
- public ArrayList<Task> computeAllTasksList() {
- ArrayList<Task> tasks = new ArrayList<>();
- tasks.addAll(mStackTaskList.getTasks());
- return tasks;
- }
-
- /**
- * Returns the number of stack tasks.
- */
- public int getTaskCount() {
- return mStackTaskList.size();
- }
-
- /**
- * Returns the task in stack tasks which is the launch target.
- */
- public Task getLaunchTarget() {
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- if (task.isLaunchTarget) {
- return task;
- }
- }
- return null;
- }
-
- /**
- * Returns whether the next launch target should actually be the PiP task.
- */
- public boolean isNextLaunchTargetPip(long lastPipTime) {
- Task launchTarget = getLaunchTarget();
- Task nextLaunchTarget = getNextLaunchTargetRaw();
- if (nextLaunchTarget != null && lastPipTime > 0) {
- // If the PiP time is more recent than the next launch target, then launch the PiP task
- return lastPipTime > nextLaunchTarget.key.lastActiveTime;
- } else if (launchTarget != null && lastPipTime > 0 && getTaskCount() == 1) {
- // Otherwise, if there is no next launch target, but there is a PiP, then launch
- // the PiP task
- return true;
- }
- return false;
- }
-
- /**
- * Returns the task in stack tasks which should be launched next if Recents are toggled
- * again, or null if there is no task to be launched. Callers should check
- * {@link #isNextLaunchTargetPip(long)} before fetching the next raw launch target from the
- * stack.
- */
- public Task getNextLaunchTarget() {
- Task nextLaunchTarget = getNextLaunchTargetRaw();
- if (nextLaunchTarget != null) {
- return nextLaunchTarget;
- }
- return getTasks().get(getTaskCount() - 1);
- }
-
- private Task getNextLaunchTargetRaw() {
- int taskCount = getTaskCount();
- if (taskCount == 0) {
- return null;
- }
- int launchTaskIndex = indexOfTask(getLaunchTarget());
- if (launchTaskIndex != -1 && launchTaskIndex > 0) {
- return getTasks().get(launchTaskIndex - 1);
- }
- return null;
- }
-
- /** Returns the index of this task in this current task stack */
- public int indexOfTask(Task t) {
- return mStackTaskList.indexOf(t);
- }
-
- /** Finds the task with the specified task id. */
- public Task findTaskWithId(int taskId) {
- ArrayList<Task> tasks = computeAllTasksList();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- if (task.key.id == taskId) {
- return task;
- }
- }
- return null;
- }
-
- /**
- * Computes the components of tasks in this stack that have been removed as a result of a change
- * in the specified package.
- */
- public ArraySet<ComponentName> computeComponentsRemoved(String packageName, int userId) {
- // Identify all the tasks that should be removed as a result of the package being removed.
- // Using a set to ensure that we callback once per unique component.
- ArraySet<ComponentName> existingComponents = new ArraySet<>();
- ArraySet<ComponentName> removedComponents = new ArraySet<>();
- ArrayList<TaskKey> taskKeys = getTaskKeys();
- int taskKeyCount = taskKeys.size();
- for (int i = 0; i < taskKeyCount; i++) {
- TaskKey t = taskKeys.get(i);
-
- // Skip if this doesn't apply to the current user
- if (t.userId != userId) continue;
-
- ComponentName cn = t.getComponent();
- if (cn.getPackageName().equals(packageName)) {
- if (existingComponents.contains(cn)) {
- // If we know that the component still exists in the package, then skip
- continue;
- }
- if (PackageManagerWrapper.getInstance().getActivityInfo(cn, userId) != null) {
- existingComponents.add(cn);
- } else {
- removedComponents.add(cn);
- }
- }
- }
- return removedComponents;
- }
-
- @Override
- public String toString() {
- String str = "Stack Tasks (" + mStackTaskList.size() + "):\n";
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- str += " " + tasks.get(i).toString() + "\n";
- }
- return str;
- }
-
- /**
- * Given a list of tasks, returns a map of each task's key to the task.
- */
- private ArrayMap<TaskKey, Task> createTaskKeyMapFromList(List<Task> tasks) {
- ArrayMap<TaskKey, Task> map = new ArrayMap<>(tasks.size());
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = tasks.get(i);
- map.put(task.key, task);
- }
- return map;
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
-
- writer.print(prefix); writer.print(TAG);
- writer.print(" numStackTasks="); writer.print(mStackTaskList.size());
- writer.println();
- ArrayList<Task> tasks = mStackTaskList.getTasks();
- int taskCount = tasks.size();
- for (int i = 0; i < taskCount; i++) {
- tasks.get(i).dump(innerPrefix, writer);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/AnimationProps.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/AnimationProps.java
deleted file mode 100644
index 5463998..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/AnimationProps.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.utilities;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ValueAnimator;
-import android.annotation.IntDef;
-import android.util.SparseArray;
-import android.util.SparseLongArray;
-import android.view.View;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.List;
-
-/**
- * The generic set of animation properties to animate a {@link View}. The animation can have
- * different interpolators, start delays and durations for each of the different properties.
- */
-public class AnimationProps {
-
- private static final Interpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
- public static final AnimationProps IMMEDIATE = new AnimationProps(0, LINEAR_INTERPOLATOR);
-
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({ALL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, ALPHA, SCALE, BOUNDS})
- public @interface PropType {}
-
- public static final int ALL = 0;
- public static final int TRANSLATION_X = 1;
- public static final int TRANSLATION_Y = 2;
- public static final int TRANSLATION_Z = 3;
- public static final int ALPHA = 4;
- public static final int SCALE = 5;
- public static final int BOUNDS = 6;
- public static final int DIM_ALPHA = 7;
-
- private SparseLongArray mPropStartDelay;
- private SparseLongArray mPropDuration;
- private SparseArray<Interpolator> mPropInterpolators;
- private Animator.AnimatorListener mListener;
-
- /**
- * The builder constructor.
- */
- public AnimationProps() {}
-
- /**
- * Creates an animation with a default {@param duration} and {@param interpolator} for all
- * properties in this animation.
- */
- public AnimationProps(int duration, Interpolator interpolator) {
- this(0, duration, interpolator, null);
- }
-
- /**
- * Creates an animation with a default {@param duration} and {@param interpolator} for all
- * properties in this animation.
- */
- public AnimationProps(int duration, Interpolator interpolator,
- Animator.AnimatorListener listener) {
- this(0, duration, interpolator, listener);
- }
-
- /**
- * Creates an animation with a default {@param startDelay}, {@param duration} and
- * {@param interpolator} for all properties in this animation.
- */
- public AnimationProps(int startDelay, int duration, Interpolator interpolator) {
- this(startDelay, duration, interpolator, null);
- }
-
- /**
- * Creates an animation with a default {@param startDelay}, {@param duration} and
- * {@param interpolator} for all properties in this animation.
- */
- public AnimationProps(int startDelay, int duration, Interpolator interpolator,
- Animator.AnimatorListener listener) {
- setStartDelay(ALL, startDelay);
- setDuration(ALL, duration);
- setInterpolator(ALL, interpolator);
- setListener(listener);
- }
-
- /**
- * Creates a new {@link AnimatorSet} that will animate the given animators. Callers need to
- * manually apply the individual animation properties for each of the animators respectively.
- */
- public AnimatorSet createAnimator(List<Animator> animators) {
- AnimatorSet anim = new AnimatorSet();
- if (mListener != null) {
- anim.addListener(mListener);
- }
- anim.playTogether(animators);
- return anim;
- }
-
- /**
- * Applies the specific start delay, duration and interpolator to the given {@param animator}
- * for the specified {@param propertyType}.
- */
- public <T extends ValueAnimator> T apply(@PropType int propertyType, T animator) {
- animator.setStartDelay(getStartDelay(propertyType));
- animator.setDuration(getDuration(propertyType));
- animator.setInterpolator(getInterpolator(propertyType));
- return animator;
- }
-
- /**
- * Sets a start delay for a specific property.
- */
- public AnimationProps setStartDelay(@PropType int propertyType, int startDelay) {
- if (mPropStartDelay == null) {
- mPropStartDelay = new SparseLongArray();
- }
- mPropStartDelay.append(propertyType, startDelay);
- return this;
- }
-
- /**
- * Returns the start delay for a specific property.
- */
- public long getStartDelay(@PropType int propertyType) {
- if (mPropStartDelay != null) {
- long startDelay = mPropStartDelay.get(propertyType, -1);
- if (startDelay != -1) {
- return startDelay;
- }
- return mPropStartDelay.get(ALL, 0);
- }
- return 0;
- }
-
- /**
- * Sets a duration for a specific property.
- */
- public AnimationProps setDuration(@PropType int propertyType, int duration) {
- if (mPropDuration == null) {
- mPropDuration = new SparseLongArray();
- }
- mPropDuration.append(propertyType, duration);
- return this;
- }
-
- /**
- * Returns the duration for a specific property.
- */
- public long getDuration(@PropType int propertyType) {
- if (mPropDuration != null) {
- long duration = mPropDuration.get(propertyType, -1);
- if (duration != -1) {
- return duration;
- }
- return mPropDuration.get(ALL, 0);
- }
- return 0;
- }
-
- /**
- * Sets an interpolator for a specific property.
- */
- public AnimationProps setInterpolator(@PropType int propertyType, Interpolator interpolator) {
- if (mPropInterpolators == null) {
- mPropInterpolators = new SparseArray<>();
- }
- mPropInterpolators.append(propertyType, interpolator);
- return this;
- }
-
- /**
- * Returns the interpolator for a specific property, falling back to the general interpolator
- * if there is no specific property interpolator.
- */
- public Interpolator getInterpolator(@PropType int propertyType) {
- if (mPropInterpolators != null) {
- Interpolator interp = mPropInterpolators.get(propertyType);
- if (interp != null) {
- return interp;
- }
- return mPropInterpolators.get(ALL, LINEAR_INTERPOLATOR);
- }
- return LINEAR_INTERPOLATOR;
- }
-
- /**
- * Sets an animator listener for this animation.
- */
- public AnimationProps setListener(Animator.AnimatorListener listener) {
- mListener = listener;
- return this;
- }
-
- /**
- * Returns the animator listener for this animation.
- */
- public Animator.AnimatorListener getListener() {
- return mListener;
- }
-
- /**
- * Returns whether this animation has any duration.
- */
- public boolean isImmediate() {
- int count = mPropDuration.size();
- for (int i = 0; i < count; i++) {
- if (mPropDuration.valueAt(i) > 0) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/Utilities.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/Utilities.java
deleted file mode 100644
index ff58eba..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/utilities/Utilities.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.utilities;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.RectEvaluator;
-import android.annotation.FloatRange;
-import android.annotation.Nullable;
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Trace;
-import android.util.ArraySet;
-import android.util.IntProperty;
-import android.util.Property;
-import android.util.TypedValue;
-import android.view.Surface;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-import android.view.ViewRootImpl;
-import android.view.ViewStub;
-
-import com.android.systemui.shared.recents.utilities.RectFEvaluator;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/* Common code */
-public class Utilities {
-
- public static final Property<Drawable, Integer> DRAWABLE_ALPHA =
- new IntProperty<Drawable>("drawableAlpha") {
- @Override
- public void setValue(Drawable object, int alpha) {
- object.setAlpha(alpha);
- }
-
- @Override
- public Integer get(Drawable object) {
- return object.getAlpha();
- }
- };
-
- public static final Property<Drawable, Rect> DRAWABLE_RECT =
- new Property<Drawable, Rect>(Rect.class, "drawableBounds") {
- @Override
- public void set(Drawable object, Rect bounds) {
- object.setBounds(bounds);
- }
-
- @Override
- public Rect get(Drawable object) {
- return object.getBounds();
- }
- };
-
- public static final RectFEvaluator RECTF_EVALUATOR = new RectFEvaluator();
- public static final RectEvaluator RECT_EVALUATOR = new RectEvaluator(new Rect());
-
- /**
- * @return the first parent walking up the view hierarchy that has the given class type.
- *
- * @param parentClass must be a class derived from {@link View}
- */
- public static <T extends View> T findParent(View v, Class<T> parentClass) {
- ViewParent parent = v.getParent();
- while (parent != null) {
- if (parentClass.isAssignableFrom(parent.getClass())) {
- return (T) parent;
- }
- parent = parent.getParent();
- }
- return null;
- }
-
- /**
- * Initializes the {@param setOut} with the given object.
- */
- public static <T> ArraySet<T> objectToSet(T obj, ArraySet<T> setOut) {
- setOut.clear();
- if (obj != null) {
- setOut.add(obj);
- }
- return setOut;
- }
-
- /**
- * Replaces the contents of {@param setOut} with the contents of the {@param array}.
- */
- public static <T> ArraySet<T> arrayToSet(T[] array, ArraySet<T> setOut) {
- setOut.clear();
- if (array != null) {
- Collections.addAll(setOut, array);
- }
- return setOut;
- }
-
- /**
- * @return the clamped {@param value} between the provided {@param min} and {@param max}.
- */
- public static int clamp(int value, int min, int max) {
- return Math.max(min, Math.min(max, value));
- }
-
- /**
- * @return the clamped {@param value} between 0 and 1.
- */
- public static float clamp01(float value) {
- return Math.max(0f, Math.min(1f, value));
- }
-
- /**
- * Scales the {@param value} to be proportionally between the {@param min} and
- * {@param max} values.
- *
- * @param value must be between 0 and 1
- */
- public static float mapRange(@FloatRange(from=0.0,to=1.0) float value, float min, float max) {
- return min + (value * (max - min));
- }
-
- /**
- * Scales the {@param value} proportionally from {@param min} and {@param max} to 0 and 1.
- *
- * @param value must be between {@param min} and {@param max}
- */
- public static float unmapRange(float value, float min, float max) {
- return (value - min) / (max - min);
- }
-
- /** Scales a rect about its centroid */
- public static void scaleRectAboutCenter(RectF r, float scale) {
- if (scale != 1.0f) {
- float cx = r.centerX();
- float cy = r.centerY();
- r.offset(-cx, -cy);
- r.left *= scale;
- r.top *= scale;
- r.right *= scale;
- r.bottom *= scale;
- r.offset(cx, cy);
- }
- }
-
- /** Returns the base color overlaid with another overlay color with a specified alpha. */
- public static int getColorWithOverlay(int baseColor, int overlayColor, float overlayAlpha) {
- return Color.rgb(
- (int) (overlayAlpha * Color.red(baseColor) +
- (1f - overlayAlpha) * Color.red(overlayColor)),
- (int) (overlayAlpha * Color.green(baseColor) +
- (1f - overlayAlpha) * Color.green(overlayColor)),
- (int) (overlayAlpha * Color.blue(baseColor) +
- (1f - overlayAlpha) * Color.blue(overlayColor)));
- }
-
- /**
- * Cancels an animation ensuring that if it has listeners, onCancel and onEnd
- * are not called.
- */
- public static void cancelAnimationWithoutCallbacks(Animator animator) {
- if (animator != null && animator.isStarted()) {
- removeAnimationListenersRecursive(animator);
- animator.cancel();
- }
- }
-
- /**
- * Recursively removes all the listeners of all children of this animator
- */
- public static void removeAnimationListenersRecursive(Animator animator) {
- if (animator instanceof AnimatorSet) {
- ArrayList<Animator> animators = ((AnimatorSet) animator).getChildAnimations();
- for (int i = animators.size() - 1; i >= 0; i--) {
- removeAnimationListenersRecursive(animators.get(i));
- }
- }
- animator.removeAllListeners();
- }
-
- /**
- * Sets the given {@link View}'s frame from its current translation.
- */
- public static void setViewFrameFromTranslation(View v) {
- RectF taskViewRect = new RectF(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
- taskViewRect.offset(v.getTranslationX(), v.getTranslationY());
- v.setTranslationX(0);
- v.setTranslationY(0);
- v.setLeftTopRightBottom((int) taskViewRect.left, (int) taskViewRect.top,
- (int) taskViewRect.right, (int) taskViewRect.bottom);
- }
-
- /**
- * Returns a view stub for the given view id.
- */
- public static ViewStub findViewStubById(View v, int stubId) {
- return (ViewStub) v.findViewById(stubId);
- }
-
- /**
- * Returns a view stub for the given view id.
- */
- public static ViewStub findViewStubById(Activity a, int stubId) {
- return (ViewStub) a.findViewById(stubId);
- }
-
- /**
- * Used for debugging, converts DP to PX.
- */
- public static float dpToPx(Resources res, float dp) {
- return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, res.getDisplayMetrics());
- }
-
- /**
- * Adds a trace event for debugging.
- */
- public static void addTraceEvent(String event) {
- Trace.traceBegin(Trace.TRACE_TAG_VIEW, event);
- Trace.traceEnd(Trace.TRACE_TAG_VIEW);
- }
-
- /**
- * Returns whether this view, or one of its descendants have accessibility focus.
- */
- public static boolean isDescendentAccessibilityFocused(View v) {
- if (v.isAccessibilityFocused()) {
- return true;
- }
-
- if (v instanceof ViewGroup) {
- ViewGroup vg = (ViewGroup) v;
- int childCount = vg.getChildCount();
- for (int i = 0; i < childCount; i++) {
- if (isDescendentAccessibilityFocused(vg.getChildAt(i))) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the application configuration, which is independent of the activity's current
- * configuration in multiwindow.
- */
- public static Configuration getAppConfiguration(Context context) {
- return context.getApplicationContext().getResources().getConfiguration();
- }
-
- /**
- * @return The next frame name for the specified surface or -1 if the surface is no longer
- * valid.
- */
- public static long getNextFrameNumber(Surface s) {
- return s != null && s.isValid()
- ? s.getNextFrameNumber()
- : -1;
-
- }
-
- /**
- * @return The surface for the specified view.
- */
- public static @Nullable Surface getSurface(View v) {
- ViewRootImpl viewRoot = v.getViewRootImpl();
- if (viewRoot == null) {
- return null;
- }
- return viewRoot.mSurface;
- }
-
- /**
- * Returns a lightweight dump of a rect.
- */
- public static String dumpRect(Rect r) {
- if (r == null) {
- return "N:0,0-0,0";
- }
- return r.left + "," + r.top + "-" + r.right + "," + r.bottom;
- }
-
- /**
- * Posts a runnable on a handler at the front of the queue ignoring any sync barriers.
- */
- public static void postAtFrontOfQueueAsynchronously(Handler h, Runnable r) {
- Message msg = h.obtainMessage().setCallback(r);
- h.sendMessageAtFrontOfQueue(msg);
- }
-
- /** Calculates the constrast between two colors, using the algorithm provided by the WCAG v2. */
- public static float computeContrastBetweenColors(int bg, int fg) {
- float bgR = Color.red(bg) / 255f;
- float bgG = Color.green(bg) / 255f;
- float bgB = Color.blue(bg) / 255f;
- bgR = (bgR < 0.03928f) ? bgR / 12.92f : (float) Math.pow((bgR + 0.055f) / 1.055f, 2.4f);
- bgG = (bgG < 0.03928f) ? bgG / 12.92f : (float) Math.pow((bgG + 0.055f) / 1.055f, 2.4f);
- bgB = (bgB < 0.03928f) ? bgB / 12.92f : (float) Math.pow((bgB + 0.055f) / 1.055f, 2.4f);
- float bgL = 0.2126f * bgR + 0.7152f * bgG + 0.0722f * bgB;
-
- float fgR = Color.red(fg) / 255f;
- float fgG = Color.green(fg) / 255f;
- float fgB = Color.blue(fg) / 255f;
- fgR = (fgR < 0.03928f) ? fgR / 12.92f : (float) Math.pow((fgR + 0.055f) / 1.055f, 2.4f);
- fgG = (fgG < 0.03928f) ? fgG / 12.92f : (float) Math.pow((fgG + 0.055f) / 1.055f, 2.4f);
- fgB = (fgB < 0.03928f) ? fgB / 12.92f : (float) Math.pow((fgB + 0.055f) / 1.055f, 2.4f);
- float fgL = 0.2126f * fgR + 0.7152f * fgG + 0.0722f * fgB;
-
- return Math.abs((fgL + 0.05f) / (bgL + 0.05f));
- }
-
- /**
- * @return the clamped {@param value} between the provided {@param min} and {@param max}.
- */
- public static float clamp(float value, float min, float max) {
- return Math.max(min, Math.min(max, value));
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/AnimateableViewBounds.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/AnimateableViewBounds.java
deleted file mode 100644
index e188506..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/AnimateableViewBounds.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.graphics.Outline;
-import android.graphics.Rect;
-import android.view.View;
-import android.view.ViewOutlineProvider;
-
-import com.android.systemui.recents.utilities.Utilities;
-
-/**
- * An outline provider that has a clip and outline that can be animated.
- */
-public class AnimateableViewBounds extends ViewOutlineProvider {
-
- private static final float MIN_ALPHA = 0.1f;
- private static final float MAX_ALPHA = 0.8f;
-
- protected View mSourceView;
- protected Rect mClipRect = new Rect();
- protected Rect mClipBounds = new Rect();
- protected Rect mLastClipBounds = new Rect();
- protected int mCornerRadius;
- protected float mAlpha = 1f;
-
- public AnimateableViewBounds(View source, int cornerRadius) {
- mSourceView = source;
- mCornerRadius = cornerRadius;
- }
-
- /**
- * Resets the right and bottom clip for this view.
- */
- public void reset() {
- mClipRect.set(0, 0, 0, 0);
- updateClipBounds();
- }
-
- @Override
- public void getOutline(View view, Outline outline) {
- outline.setAlpha(Utilities.mapRange(mAlpha, MIN_ALPHA, MAX_ALPHA));
- if (mCornerRadius > 0) {
- outline.setRoundRect(mClipRect.left, mClipRect.top,
- mSourceView.getWidth() - mClipRect.right,
- mSourceView.getHeight() - mClipRect.bottom,
- mCornerRadius);
- } else {
- outline.setRect(mClipRect.left, mClipRect.top,
- mSourceView.getWidth() - mClipRect.right,
- mSourceView.getHeight() - mClipRect.bottom);
- }
- }
-
- /**
- * Sets the view outline alpha.
- */
- public void setAlpha(float alpha) {
- if (Float.compare(alpha, mAlpha) != 0) {
- mAlpha = alpha;
- // TODO, If both clip and alpha change in the same frame, only invalidate once
- mSourceView.invalidateOutline();
- }
- }
-
- /**
- * @return the outline alpha.
- */
- public float getAlpha() {
- return mAlpha;
- }
-
- /**
- * Sets the top clip.
- */
- public void setClipTop(int top) {
- mClipRect.top = top;
- updateClipBounds();
- }
-
- /**
- * @return the top clip.
- */
- public int getClipTop() {
- return mClipRect.top;
- }
-
- /**
- * Sets the bottom clip.
- */
- public void setClipBottom(int bottom) {
- mClipRect.bottom = bottom;
- updateClipBounds();
- }
-
- /**
- * @return the bottom clip.
- */
- public int getClipBottom() {
- return mClipRect.bottom;
- }
-
- /**
- * @return the clip bounds.
- */
- public Rect getClipBounds() {
- return mClipBounds;
- }
-
- protected void updateClipBounds() {
- mClipBounds.set(Math.max(0, mClipRect.left), Math.max(0, mClipRect.top),
- mSourceView.getWidth() - Math.max(0, mClipRect.right),
- mSourceView.getHeight() - Math.max(0, mClipRect.bottom));
- if (!mLastClipBounds.equals(mClipBounds)) {
- mSourceView.setClipBounds(mClipBounds);
- // TODO, If both clip and alpha change in the same frame, only invalidate once
- mSourceView.invalidateOutline();
- mLastClipBounds.set(mClipBounds);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DockState.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DockState.java
deleted file mode 100644
index d9c921c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DockState.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views;
-
-import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT;
-import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
-import static android.view.WindowManager.DOCKED_BOTTOM;
-import static android.view.WindowManager.DOCKED_INVALID;
-import static android.view.WindowManager.DOCKED_LEFT;
-import static android.view.WindowManager.DOCKED_RIGHT;
-import static android.view.WindowManager.DOCKED_TOP;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.annotation.IntDef;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.drawable.ColorDrawable;
-import android.util.IntProperty;
-import android.view.animation.Interpolator;
-
-import com.android.internal.policy.DockedDividerUtils;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.utilities.Utilities;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-
-/**
- * The various possible dock states when dragging and dropping a task.
- */
-public class DockState implements DropTarget {
-
- public static final int DOCK_AREA_BG_COLOR = 0xFFffffff;
- public static final int DOCK_AREA_GRID_BG_COLOR = 0xFF000000;
-
- // The rotation to apply to the hint text
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({HORIZONTAL, VERTICAL})
- public @interface TextOrientation {}
- private static final int HORIZONTAL = 0;
- private static final int VERTICAL = 1;
-
- private static final int DOCK_AREA_ALPHA = 80;
- public static final DockState NONE = new DockState(DOCKED_INVALID, -1, 80, 255, HORIZONTAL,
- null, null, null);
- public static final DockState LEFT = new DockState(DOCKED_LEFT,
- SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, DOCK_AREA_ALPHA, 0, VERTICAL,
- new RectF(0, 0, 0.125f, 1), new RectF(0, 0, 0.125f, 1),
- new RectF(0, 0, 0.5f, 1));
- public static final DockState TOP = new DockState(DOCKED_TOP,
- SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, DOCK_AREA_ALPHA, 0, HORIZONTAL,
- new RectF(0, 0, 1, 0.125f), new RectF(0, 0, 1, 0.125f),
- new RectF(0, 0, 1, 0.5f));
- public static final DockState RIGHT = new DockState(DOCKED_RIGHT,
- SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, DOCK_AREA_ALPHA, 0, VERTICAL,
- new RectF(0.875f, 0, 1, 1), new RectF(0.875f, 0, 1, 1),
- new RectF(0.5f, 0, 1, 1));
- public static final DockState BOTTOM = new DockState(DOCKED_BOTTOM,
- SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, DOCK_AREA_ALPHA, 0, HORIZONTAL,
- new RectF(0, 0.875f, 1, 1), new RectF(0, 0.875f, 1, 1),
- new RectF(0, 0.5f, 1, 1));
-
- @Override
- public boolean acceptsDrop(int x, int y, int width, int height, Rect insets,
- boolean isCurrentTarget) {
- if (isCurrentTarget) {
- getMappedRect(expandedTouchDockArea, width, height, mTmpRect);
- return mTmpRect.contains(x, y);
- } else {
- getMappedRect(touchArea, width, height, mTmpRect);
- updateBoundsWithSystemInsets(mTmpRect, insets);
- return mTmpRect.contains(x, y);
- }
- }
-
- // Represents the view state of this dock state
- public static class ViewState {
- private static final IntProperty<ViewState> HINT_ALPHA =
- new IntProperty<ViewState>("drawableAlpha") {
- @Override
- public void setValue(ViewState object, int alpha) {
- object.mHintTextAlpha = alpha;
- object.dockAreaOverlay.invalidateSelf();
- }
-
- @Override
- public Integer get(ViewState object) {
- return object.mHintTextAlpha;
- }
- };
-
- public final int dockAreaAlpha;
- public final ColorDrawable dockAreaOverlay;
- public final int hintTextAlpha;
- public final int hintTextOrientation;
-
- private final int mHintTextResId;
- private String mHintText;
- private Paint mHintTextPaint;
- private Point mHintTextBounds = new Point();
- private int mHintTextAlpha = 255;
- private AnimatorSet mDockAreaOverlayAnimator;
- private Rect mTmpRect = new Rect();
-
- private ViewState(int areaAlpha, int hintAlpha, @TextOrientation int hintOrientation,
- int hintTextResId) {
- dockAreaAlpha = areaAlpha;
- dockAreaOverlay = new ColorDrawable(LegacyRecentsImpl.getConfiguration().isGridEnabled
- ? DOCK_AREA_GRID_BG_COLOR : DOCK_AREA_BG_COLOR);
- dockAreaOverlay.setAlpha(0);
- hintTextAlpha = hintAlpha;
- hintTextOrientation = hintOrientation;
- mHintTextResId = hintTextResId;
- mHintTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- mHintTextPaint.setColor(Color.WHITE);
- }
-
- /**
- * Updates the view state with the given context.
- */
- public void update(Context context) {
- Resources res = context.getResources();
- mHintText = context.getString(mHintTextResId);
- mHintTextPaint.setTextSize(res.getDimensionPixelSize(
- R.dimen.recents_drag_hint_text_size));
- mHintTextPaint.getTextBounds(mHintText, 0, mHintText.length(), mTmpRect);
- mHintTextBounds.set((int) mHintTextPaint.measureText(mHintText), mTmpRect.height());
- }
-
- /**
- * Draws the current view state.
- */
- public void draw(Canvas canvas) {
- // Draw the overlay background
- if (dockAreaOverlay.getAlpha() > 0) {
- dockAreaOverlay.draw(canvas);
- }
-
- // Draw the hint text
- if (mHintTextAlpha > 0) {
- Rect bounds = dockAreaOverlay.getBounds();
- int x = bounds.left + (bounds.width() - mHintTextBounds.x) / 2;
- int y = bounds.top + (bounds.height() + mHintTextBounds.y) / 2;
- mHintTextPaint.setAlpha(mHintTextAlpha);
- if (hintTextOrientation == VERTICAL) {
- canvas.save();
- canvas.rotate(-90f, bounds.centerX(), bounds.centerY());
- }
- canvas.drawText(mHintText, x, y, mHintTextPaint);
- if (hintTextOrientation == VERTICAL) {
- canvas.restore();
- }
- }
- }
-
- /**
- * Creates a new bounds and alpha animation.
- */
- public void startAnimation(Rect bounds, int areaAlpha, int hintAlpha, int duration,
- Interpolator interpolator, boolean animateAlpha, boolean animateBounds) {
- if (mDockAreaOverlayAnimator != null) {
- mDockAreaOverlayAnimator.cancel();
- }
-
- ObjectAnimator anim;
- ArrayList<Animator> animators = new ArrayList<>();
- if (dockAreaOverlay.getAlpha() != areaAlpha) {
- if (animateAlpha) {
- anim = ObjectAnimator.ofInt(dockAreaOverlay,
- Utilities.DRAWABLE_ALPHA, dockAreaOverlay.getAlpha(), areaAlpha);
- anim.setDuration(duration);
- anim.setInterpolator(interpolator);
- animators.add(anim);
- } else {
- dockAreaOverlay.setAlpha(areaAlpha);
- }
- }
- if (mHintTextAlpha != hintAlpha) {
- if (animateAlpha) {
- anim = ObjectAnimator.ofInt(this, HINT_ALPHA, mHintTextAlpha,
- hintAlpha);
- anim.setDuration(150);
- anim.setInterpolator(hintAlpha > mHintTextAlpha
- ? Interpolators.ALPHA_IN
- : Interpolators.ALPHA_OUT);
- animators.add(anim);
- } else {
- mHintTextAlpha = hintAlpha;
- dockAreaOverlay.invalidateSelf();
- }
- }
- if (bounds != null && !dockAreaOverlay.getBounds().equals(bounds)) {
- if (animateBounds) {
- PropertyValuesHolder prop = PropertyValuesHolder.ofObject(
- Utilities.DRAWABLE_RECT, Utilities.RECT_EVALUATOR,
- new Rect(dockAreaOverlay.getBounds()), bounds);
- anim = ObjectAnimator.ofPropertyValuesHolder(dockAreaOverlay, prop);
- anim.setDuration(duration);
- anim.setInterpolator(interpolator);
- animators.add(anim);
- } else {
- dockAreaOverlay.setBounds(bounds);
- }
- }
- if (!animators.isEmpty()) {
- mDockAreaOverlayAnimator = new AnimatorSet();
- mDockAreaOverlayAnimator.playTogether(animators);
- mDockAreaOverlayAnimator.start();
- }
- }
- }
-
- public final int dockSide;
- public final int createMode;
- public final ViewState viewState;
- private final RectF touchArea;
- private final RectF dockArea;
- private final RectF expandedTouchDockArea;
- private static final Rect mTmpRect = new Rect();
-
- /**
- * @param createMode used to pass to ActivityManager to dock the task
- * @param touchArea the area in which touch will initiate this dock state
- * @param dockArea the visible dock area
- * @param expandedTouchDockArea the area in which touch will continue to dock after entering
- * the initial touch area. This is also the new dock area to
- * draw.
- */
- DockState(int dockSide, int createMode, int dockAreaAlpha, int hintTextAlpha,
- @TextOrientation int hintTextOrientation, RectF touchArea, RectF dockArea,
- RectF expandedTouchDockArea) {
- this.dockSide = dockSide;
- this.createMode = createMode;
- this.viewState = new ViewState(dockAreaAlpha, hintTextAlpha, hintTextOrientation,
- R.string.recents_drag_hint_message);
- this.dockArea = dockArea;
- this.touchArea = touchArea;
- this.expandedTouchDockArea = expandedTouchDockArea;
- }
-
- /**
- * Updates the dock state with the given context.
- */
- public void update(Context context) {
- viewState.update(context);
- }
-
- /**
- * Returns the docked task bounds with the given {@param width} and {@param height}.
- */
- public Rect getPreDockedBounds(int width, int height, Rect insets) {
- getMappedRect(dockArea, width, height, mTmpRect);
- return updateBoundsWithSystemInsets(mTmpRect, insets);
- }
-
- /**
- * Returns the expanded docked task bounds with the given {@param width} and
- * {@param height}.
- */
- public Rect getDockedBounds(int width, int height, int dividerSize, Rect insets,
- Resources res) {
- // Calculate the docked task bounds
- boolean isHorizontalDivision =
- res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
- int position = DockedDividerUtils.calculateMiddlePosition(isHorizontalDivision,
- insets, width, height, dividerSize);
- Rect newWindowBounds = new Rect();
- DockedDividerUtils.calculateBoundsForPosition(position, dockSide, newWindowBounds,
- width, height, dividerSize);
- return newWindowBounds;
- }
-
- /**
- * Returns the task stack bounds with the given {@param width} and
- * {@param height}.
- */
- public Rect getDockedTaskStackBounds(Rect displayRect, int width, int height,
- int dividerSize, Rect insets, TaskStackLayoutAlgorithm layoutAlgorithm,
- Resources res, Rect windowRectOut) {
- // Calculate the inverse docked task bounds
- boolean isHorizontalDivision =
- res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
- int position = DockedDividerUtils.calculateMiddlePosition(isHorizontalDivision,
- insets, width, height, dividerSize);
- DockedDividerUtils.calculateBoundsForPosition(position,
- DockedDividerUtils.invertDockSide(dockSide), windowRectOut, width, height,
- dividerSize);
-
- // Calculate the task stack bounds from the new window bounds
- Rect taskStackBounds = new Rect();
- // If the task stack bounds is specifically under the dock area, then ignore the top
- // inset
- int top = dockArea.bottom < 1f
- ? 0
- : insets.top;
- // For now, ignore the left insets since we always dock on the left and show Recents
- // on the right
- layoutAlgorithm.getTaskStackBounds(displayRect, windowRectOut, top, 0, insets.right,
- taskStackBounds);
- return taskStackBounds;
- }
-
- /**
- * Returns the expanded bounds in certain dock sides such that the bounds account for the
- * system insets (namely the vertical nav bar). This call modifies and returns the given
- * {@param bounds}.
- */
- private Rect updateBoundsWithSystemInsets(Rect bounds, Rect insets) {
- if (dockSide == DOCKED_LEFT) {
- bounds.right += insets.left;
- } else if (dockSide == DOCKED_RIGHT) {
- bounds.left -= insets.right;
- }
- return bounds;
- }
-
- /**
- * Returns the mapped rect to the given dimensions.
- */
- private void getMappedRect(RectF bounds, int width, int height, Rect out) {
- out.set((int) (bounds.left * width), (int) (bounds.top * height),
- (int) (bounds.right * width), (int) (bounds.bottom * height));
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DropTarget.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DropTarget.java
deleted file mode 100644
index f2a6310..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/DropTarget.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.graphics.Rect;
-
-/**
- * Represents a drop target for a drag gesture.
- */
-public interface DropTarget {
-
- /**
- * Returns whether this target can accept this drop. The x,y are relative to the top level
- * RecentsView, and the width/height are of the RecentsView.
- */
- boolean acceptsDrop(int x, int y, int width, int height, Rect insets, boolean isCurrentTarget);
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FakeShadowDrawable.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FakeShadowDrawable.java
deleted file mode 100644
index 86b4297..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FakeShadowDrawable.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.LinearGradient;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.PixelFormat;
-import android.graphics.RadialGradient;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.Shader;
-import android.graphics.drawable.Drawable;
-import android.util.Log;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsConfiguration;
-
-/**
- * A rounded rectangle drawable which also includes a shadow around. This is mostly copied from
- * frameworks/support/v7/cardview/eclair-mr1/android/support/v7/widget/
- * RoundRectDrawableWithShadow.java revision c42ba8c000d1e6ce85e152dfc17089a0a69e739f with a few
- * modifications to suit our needs in SystemUI.
- */
-class FakeShadowDrawable extends Drawable {
- // used to calculate content padding
- final static double COS_45 = Math.cos(Math.toRadians(45));
-
- final static float SHADOW_MULTIPLIER = 1.5f;
-
- final float mInsetShadow; // extra shadow to avoid gaps between card and shadow
-
- Paint mCornerShadowPaint;
-
- Paint mEdgeShadowPaint;
-
- final RectF mCardBounds;
-
- float mCornerRadius;
-
- Path mCornerShadowPath;
-
- // updated value with inset
- float mMaxShadowSize;
-
- // actual value set by developer
- float mRawMaxShadowSize;
-
- // multiplied value to account for shadow offset
- float mShadowSize;
-
- // actual value set by developer
- float mRawShadowSize;
-
- private boolean mDirty = true;
-
- private final int mShadowStartColor;
-
- private final int mShadowEndColor;
-
- private boolean mAddPaddingForCorners = true;
-
- /**
- * If shadow size is set to a value above max shadow, we print a warning
- */
- private boolean mPrintedShadowClipWarning = false;
-
- public FakeShadowDrawable(Resources resources, RecentsConfiguration config) {
- mShadowStartColor = resources.getColor(R.color.fake_shadow_start_color);
- mShadowEndColor = resources.getColor(R.color.fake_shadow_end_color);
- mInsetShadow = resources.getDimension(R.dimen.fake_shadow_inset);
- setShadowSize(resources.getDimensionPixelSize(R.dimen.fake_shadow_size),
- resources.getDimensionPixelSize(R.dimen.fake_shadow_size));
- mCornerShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
- mCornerShadowPaint.setStyle(Paint.Style.FILL);
- mCornerShadowPaint.setDither(true);
- mCornerRadius = LegacyRecentsImpl.getConfiguration().isGridEnabled ?
- resources.getDimensionPixelSize(
- R.dimen.recents_grid_task_view_rounded_corners_radius) :
- resources.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
- mCardBounds = new RectF();
- mEdgeShadowPaint = new Paint(mCornerShadowPaint);
- }
-
- @Override
- public void setAlpha(int alpha) {
- mCornerShadowPaint.setAlpha(alpha);
- mEdgeShadowPaint.setAlpha(alpha);
- }
-
- @Override
- protected void onBoundsChange(Rect bounds) {
- super.onBoundsChange(bounds);
- mDirty = true;
- }
-
- void setShadowSize(float shadowSize, float maxShadowSize) {
- if (shadowSize < 0 || maxShadowSize < 0) {
- throw new IllegalArgumentException("invalid shadow size");
- }
- if (shadowSize > maxShadowSize) {
- shadowSize = maxShadowSize;
- if (!mPrintedShadowClipWarning) {
- Log.w("CardView", "Shadow size is being clipped by the max shadow size. See "
- + "{CardView#setMaxCardElevation}.");
- mPrintedShadowClipWarning = true;
- }
- }
- if (mRawShadowSize == shadowSize && mRawMaxShadowSize == maxShadowSize) {
- return;
- }
- mRawShadowSize = shadowSize;
- mRawMaxShadowSize = maxShadowSize;
- mShadowSize = shadowSize * SHADOW_MULTIPLIER + mInsetShadow;
- mMaxShadowSize = maxShadowSize + mInsetShadow;
- mDirty = true;
- invalidateSelf();
- }
-
- @Override
- public boolean getPadding(Rect padding) {
- int vOffset = (int) Math.ceil(calculateVerticalPadding(mRawMaxShadowSize, mCornerRadius,
- mAddPaddingForCorners));
- int hOffset = (int) Math.ceil(calculateHorizontalPadding(mRawMaxShadowSize, mCornerRadius,
- mAddPaddingForCorners));
- padding.set(hOffset, vOffset, hOffset, vOffset);
- return true;
- }
-
- static float calculateVerticalPadding(float maxShadowSize, float cornerRadius,
- boolean addPaddingForCorners) {
- if (addPaddingForCorners) {
- return (float) (maxShadowSize * SHADOW_MULTIPLIER + (1 - COS_45) * cornerRadius);
- } else {
- return maxShadowSize * SHADOW_MULTIPLIER;
- }
- }
-
- static float calculateHorizontalPadding(float maxShadowSize, float cornerRadius,
- boolean addPaddingForCorners) {
- if (addPaddingForCorners) {
- return (float) (maxShadowSize + (1 - COS_45) * cornerRadius);
- } else {
- return maxShadowSize;
- }
- }
-
- @Override
- public void setColorFilter(ColorFilter colorFilter) {
- mCornerShadowPaint.setColorFilter(colorFilter);
- mEdgeShadowPaint.setColorFilter(colorFilter);
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.OPAQUE;
- }
-
- @Override
- public void draw(Canvas canvas) {
- if (mDirty) {
- buildComponents(getBounds());
- mDirty = false;
- }
- canvas.translate(0, mRawShadowSize / 4);
- drawShadow(canvas);
- canvas.translate(0, -mRawShadowSize / 4);
- }
-
- private void drawShadow(Canvas canvas) {
- final float edgeShadowTop = -mCornerRadius - mShadowSize;
- final float inset = mCornerRadius + mInsetShadow + mRawShadowSize / 2;
- final boolean drawHorizontalEdges = mCardBounds.width() - 2 * inset > 0;
- final boolean drawVerticalEdges = mCardBounds.height() - 2 * inset > 0;
- // LT
- int saved = canvas.save();
- canvas.translate(mCardBounds.left + inset, mCardBounds.top + inset);
- canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
- if (drawHorizontalEdges) {
- canvas.drawRect(0, edgeShadowTop,
- mCardBounds.width() - 2 * inset, -mCornerRadius,
- mEdgeShadowPaint);
- }
- canvas.restoreToCount(saved);
- // RB
- saved = canvas.save();
- canvas.translate(mCardBounds.right - inset, mCardBounds.bottom - inset);
- canvas.rotate(180f);
- canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
- if (drawHorizontalEdges) {
- canvas.drawRect(0, edgeShadowTop,
- mCardBounds.width() - 2 * inset, -mCornerRadius + mShadowSize,
- mEdgeShadowPaint);
- }
- canvas.restoreToCount(saved);
- // LB
- saved = canvas.save();
- canvas.translate(mCardBounds.left + inset, mCardBounds.bottom - inset);
- canvas.rotate(270f);
- canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
- if (drawVerticalEdges) {
- canvas.drawRect(0, edgeShadowTop,
- mCardBounds.height() - 2 * inset, -mCornerRadius, mEdgeShadowPaint);
- }
- canvas.restoreToCount(saved);
- // RT
- saved = canvas.save();
- canvas.translate(mCardBounds.right - inset, mCardBounds.top + inset);
- canvas.rotate(90f);
- canvas.drawPath(mCornerShadowPath, mCornerShadowPaint);
- if (drawVerticalEdges) {
- canvas.drawRect(0, edgeShadowTop,
- mCardBounds.height() - 2 * inset, -mCornerRadius, mEdgeShadowPaint);
- }
- canvas.restoreToCount(saved);
- }
-
- private void buildShadowCorners() {
- RectF innerBounds = new RectF(-mCornerRadius, -mCornerRadius, mCornerRadius, mCornerRadius);
- RectF outerBounds = new RectF(innerBounds);
- outerBounds.inset(-mShadowSize, -mShadowSize);
-
- if (mCornerShadowPath == null) {
- mCornerShadowPath = new Path();
- } else {
- mCornerShadowPath.reset();
- }
- mCornerShadowPath.setFillType(Path.FillType.EVEN_ODD);
- mCornerShadowPath.moveTo(-mCornerRadius, 0);
- mCornerShadowPath.rLineTo(-mShadowSize, 0);
- // outer arc
- mCornerShadowPath.arcTo(outerBounds, 180f, 90f, false);
- // inner arc
- mCornerShadowPath.arcTo(innerBounds, 270f, -90f, false);
- mCornerShadowPath.close();
-
- float startRatio = mCornerRadius / (mCornerRadius + mShadowSize);
- mCornerShadowPaint.setShader(new RadialGradient(0, 0, mCornerRadius + mShadowSize,
- new int[]{mShadowStartColor, mShadowStartColor, mShadowEndColor},
- new float[]{0f, startRatio, 1f}
- , Shader.TileMode.CLAMP));
-
- // we offset the content shadowSize/2 pixels up to make it more realistic.
- // this is why edge shadow shader has some extra space
- // When drawing bottom edge shadow, we use that extra space.
- mEdgeShadowPaint.setShader(new LinearGradient(0, -mCornerRadius + mShadowSize, 0,
- -mCornerRadius - mShadowSize,
- new int[]{mShadowStartColor, mShadowStartColor, mShadowEndColor},
- new float[]{0f, .5f, 1f}, Shader.TileMode.CLAMP));
- }
-
- private void buildComponents(Rect bounds) {
- // Card is offset SHADOW_MULTIPLIER * maxShadowSize to account for the shadow shift.
- // We could have different top-bottom offsets to avoid extra gap above but in that case
- // center aligning Views inside the CardView would be problematic.
- final float verticalOffset = mMaxShadowSize * SHADOW_MULTIPLIER;
- mCardBounds.set(bounds.left + mMaxShadowSize, bounds.top + verticalOffset,
- bounds.right - mMaxShadowSize, bounds.bottom - verticalOffset);
- buildShadowCorners();
- }
-
- float getMinWidth() {
- final float content = 2 *
- Math.max(mRawMaxShadowSize, mCornerRadius + mInsetShadow + mRawMaxShadowSize / 2);
- return content + (mRawMaxShadowSize + mInsetShadow) * 2;
- }
-
- float getMinHeight() {
- final float content = 2 * Math.max(mRawMaxShadowSize, mCornerRadius + mInsetShadow
- + mRawMaxShadowSize * SHADOW_MULTIPLIER / 2);
- return content + (mRawMaxShadowSize * SHADOW_MULTIPLIER + mInsetShadow) * 2;
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeFrameLayout.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeFrameLayout.java
deleted file mode 100644
index 471df6a..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeFrameLayout.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.views;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.widget.FrameLayout;
-
-/**
- * This is an optimized FrameLayout whose layout is completely directed by its parent, and as a
- * result, does not propagate <code>requestLayout()</code> up the view hierarchy. Instead, it will
- * relayout its children with the last known layout bounds when a layout is requested from a child
- * view.
- */
-public class FixedSizeFrameLayout extends FrameLayout {
-
- private final Rect mLayoutBounds = new Rect();
-
- public FixedSizeFrameLayout(Context context) {
- super(context);
- }
-
- public FixedSizeFrameLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public FixedSizeFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- public FixedSizeFrameLayout(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- }
-
- @Override
- protected final void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- measureContents(MeasureSpec.getSize(widthMeasureSpec),
- MeasureSpec.getSize(heightMeasureSpec));
- }
-
- @Override
- protected final void onLayout(boolean changed, int left, int top, int right, int bottom) {
- mLayoutBounds.set(left, top, right, bottom);
- layoutContents(mLayoutBounds, changed);
- }
-
- @Override
- public final void requestLayout() {
- // The base ViewGroup constructor attempts to call requestLayout() before this class's
- // members are initialized so we should just propagate in that case
- if (mLayoutBounds == null || mLayoutBounds.isEmpty()) {
- super.requestLayout();
- } else {
- // If we are already laid out, then just reuse the same bounds to layout the children
- // (but not itself)
- // TODO: Investigate whether we should coalesce these to the next frame if needed
- measureContents(getMeasuredWidth(), getMeasuredHeight());
- layoutContents(mLayoutBounds, false);
- }
- }
-
- /**
- * Measures the contents of this fixed layout.
- */
- protected void measureContents(int width, int height) {
- super.onMeasure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
- }
-
- /**
- * Lays out the contents of this fixed layout.
- */
- protected void layoutContents(Rect bounds, boolean changed) {
- super.onLayout(changed, bounds.left, bounds.top, bounds.right, bounds.bottom);
-
- int width = getMeasuredWidth();
- int height = getMeasuredHeight();
- onSizeChanged(width, height, width, height);
- }
-
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeImageView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeImageView.java
deleted file mode 100644
index d3b5e47..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/FixedSizeImageView.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.content.Context;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-
-import com.android.systemui.statusbar.AlphaOptimizedImageView;
-
-/**
- * This is an optimized ImageView that does not trigger a <code>requestLayout()</code> or
- * <code>invalidate()</code> when setting the image to <code>null</code>.
- */
-public class FixedSizeImageView extends AlphaOptimizedImageView {
-
- private boolean mAllowRelayout = true;
- private boolean mAllowInvalidate = true;
-
- public FixedSizeImageView(Context context) {
- this(context, null);
- }
-
- public FixedSizeImageView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public FixedSizeImageView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public FixedSizeImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- }
-
- @Override
- public void requestLayout() {
- if (mAllowRelayout) {
- super.requestLayout();
- }
- }
-
- @Override
- public void invalidate() {
- if (mAllowInvalidate) {
- super.invalidate();
- }
- }
-
- @Override
- public void setImageDrawable(Drawable drawable) {
- boolean isNullBitmapDrawable = (drawable instanceof BitmapDrawable) &&
- (((BitmapDrawable) drawable).getBitmap() == null);
- if (drawable == null || isNullBitmapDrawable) {
- mAllowRelayout = false;
- mAllowInvalidate = false;
- }
- super.setImageDrawable(drawable);
- mAllowRelayout = true;
- mAllowInvalidate = true;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsEntrancePathInterpolator.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsEntrancePathInterpolator.java
deleted file mode 100644
index e32da2d..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsEntrancePathInterpolator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views;
-
-import android.view.animation.PathInterpolator;
-
-/**
- * A helper interpolator to stagger the entrance animation in recents by offsetting the start time
- */
-public class RecentsEntrancePathInterpolator extends PathInterpolator {
- final float mStartOffsetFraction;
-
- /**
- * Create an interpolator for a cubic Bezier curve with an offset play time. The end points
- * <code>(0, 0)</code> and <code>(1, 1)</code> are assumed.
- *
- * @param controlX1 The x coordinate of the first control point of the cubic Bezier.
- * @param controlY1 The y coordinate of the first control point of the cubic Bezier.
- * @param controlX2 The x coordinate of the second control point of the cubic Bezier.
- * @param controlY2 The y coordinate of the second control point of the cubic Bezier.
- * @param startOffsetFraction The fraction from 0 to 1 to start the animation from
- */
- public RecentsEntrancePathInterpolator(float controlX1, float controlY1, float controlX2,
- float controlY2, float startOffsetFraction) {
- super(controlX1, controlY1, controlX2, controlY2);
- mStartOffsetFraction = startOffsetFraction;
- }
-
- @Override
- public float getInterpolation(float t) {
- return super.getInterpolation(t + mStartOffsetFraction);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsTransitionComposer.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsTransitionComposer.java
deleted file mode 100644
index ce66318..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsTransitionComposer.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
-import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Rect;
-import android.util.Log;
-
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsDebugFlags;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat;
-import com.android.systemui.shared.recents.view.RecentsTransition;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A helper class to create the transition app animation specs to/from Recents
- */
-public class RecentsTransitionComposer {
-
- private static final String TAG = "RecentsTransitionComposer";
-
- private Context mContext;
- private TaskViewTransform mTmpTransform = new TaskViewTransform();
-
- public RecentsTransitionComposer(Context context) {
- mContext = context;
- }
-
- /**
- * Composes a single animation spec for the given {@link TaskView}
- */
- private static AppTransitionAnimationSpecCompat composeAnimationSpec(TaskStackView stackView,
- TaskView taskView, TaskViewTransform transform, boolean addHeaderBitmap) {
- Bitmap b = null;
- if (addHeaderBitmap) {
- b = composeHeaderBitmap(taskView, transform);
- if (b == null) {
- return null;
- }
- }
-
- Rect taskRect = new Rect();
- transform.rect.round(taskRect);
- // Disable in for low ram devices because each task does in Recents does not have fullscreen
- // height (stackView height) and when transitioning to fullscreen app, the code below would
- // force the task thumbnail to full stackView height immediately causing the transition
- // jarring.
- if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice && taskView.getTask() !=
- stackView.getStack().getFrontMostTask()) {
- taskRect.bottom = taskRect.top + stackView.getMeasuredHeight();
- }
- return new AppTransitionAnimationSpecCompat(taskView.getTask().key.id, b, taskRect);
- }
-
- /**
- * Composes the transition spec when docking a task, which includes a full task bitmap.
- */
- public List<AppTransitionAnimationSpecCompat> composeDockAnimationSpec(TaskView taskView,
- Rect bounds) {
- mTmpTransform.fillIn(taskView);
- Task task = taskView.getTask();
- Bitmap buffer = RecentsTransitionComposer.composeTaskBitmap(taskView, mTmpTransform);
- return Collections.singletonList(new AppTransitionAnimationSpecCompat(task.key.id, buffer,
- bounds));
- }
-
- /**
- * Composes the animation specs for all the tasks in the target stack.
- */
- public List<AppTransitionAnimationSpecCompat> composeAnimationSpecs(final Task task,
- final TaskStackView stackView, int windowingMode, int activityType, Rect windowRect) {
- // Calculate the offscreen task rect (for tasks that are not backed by views)
- TaskView taskView = stackView.getChildViewForTask(task);
- TaskStackLayoutAlgorithm stackLayout = stackView.getStackAlgorithm();
- Rect offscreenTaskRect = new Rect();
- stackLayout.getFrontOfStackTransform().rect.round(offscreenTaskRect);
-
- // If this is a full screen stack, the transition will be towards the single, full screen
- // task. We only need the transition spec for this task.
-
- // TODO: Sometimes targetStackId is not initialized after reboot, so we also have to
- // check for INVALID_STACK_ID (now WINDOWING_MODE_UNDEFINED)
- if (windowingMode == WINDOWING_MODE_FULLSCREEN
- || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
- || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
- || activityType == ACTIVITY_TYPE_ASSISTANT
- || windowingMode == WINDOWING_MODE_UNDEFINED) {
- List<AppTransitionAnimationSpecCompat> specs = new ArrayList<>();
- if (taskView == null) {
- specs.add(composeOffscreenAnimationSpec(task, offscreenTaskRect));
- } else {
- mTmpTransform.fillIn(taskView);
- stackLayout.transformToScreenCoordinates(mTmpTransform, windowRect);
- AppTransitionAnimationSpecCompat spec = composeAnimationSpec(stackView, taskView,
- mTmpTransform, true /* addHeaderBitmap */);
- if (spec != null) {
- specs.add(spec);
- }
- }
- return specs;
- }
- return Collections.emptyList();
- }
-
- /**
- * Composes a single animation spec for the given {@link Task}
- */
- private static AppTransitionAnimationSpecCompat composeOffscreenAnimationSpec(Task task,
- Rect taskRect) {
- return new AppTransitionAnimationSpecCompat(task.key.id, null, taskRect);
- }
-
- public static Bitmap composeTaskBitmap(TaskView taskView, TaskViewTransform transform) {
- float scale = transform.scale;
- int fromWidth = (int) (transform.rect.width() * scale);
- int fromHeight = (int) (transform.rect.height() * scale);
- if (fromWidth == 0 || fromHeight == 0) {
- Log.e(TAG, "Could not compose thumbnail for task: " + taskView.getTask() +
- " at transform: " + transform);
-
- return RecentsTransition.drawViewIntoHardwareBitmap(1, 1, null, 1f, 0x00ffffff);
- } else {
- if (RecentsDebugFlags.Static.EnableTransitionThumbnailDebugMode) {
- return RecentsTransition.drawViewIntoHardwareBitmap(fromWidth, fromHeight, null, 1f,
- 0xFFff0000);
- } else {
- return RecentsTransition.drawViewIntoHardwareBitmap(fromWidth, fromHeight, taskView,
- scale, 0);
- }
- }
- }
-
- private static Bitmap composeHeaderBitmap(TaskView taskView,
- TaskViewTransform transform) {
- float scale = transform.scale;
- int headerWidth = (int) (transform.rect.width());
- int headerHeight = (int) (taskView.mHeaderView.getMeasuredHeight() * scale);
- if (headerWidth == 0 || headerHeight == 0) {
- return null;
- }
-
- if (RecentsDebugFlags.Static.EnableTransitionThumbnailDebugMode) {
- return RecentsTransition.drawViewIntoHardwareBitmap(headerWidth, headerHeight, null, 1f,
- 0xFFff0000);
- } else {
- return RecentsTransition.drawViewIntoHardwareBitmap(headerWidth, headerHeight,
- taskView.mHeaderView, scale, 0);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsView.java
deleted file mode 100644
index e60ffba..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsView.java
+++ /dev/null
@@ -1,1077 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
-
-import static com.android.systemui.statusbar.phone.StatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS;
-
-import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.annotation.Nullable;
-import android.app.ActivityOptions;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Point;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.util.ArraySet;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.MathUtils;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewDebug;
-import android.view.ViewPropertyAnimator;
-import android.view.Window;
-import android.view.WindowInsets;
-import android.widget.FrameLayout;
-import android.widget.TextView;
-
-import com.android.internal.colorextraction.ColorExtractor;
-import com.android.internal.colorextraction.drawable.ScrimDrawable;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settingslib.Utils;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivity;
-import com.android.systemui.recents.RecentsActivityLaunchState;
-import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
-import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
-import com.android.systemui.recents.events.activity.DockedFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
-import com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent;
-import com.android.systemui.recents.events.activity.HideStackActionButtonEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskSucceededEvent;
-import com.android.systemui.recents.events.activity.MultiWindowStateChangedEvent;
-import com.android.systemui.recents.events.activity.ShowEmptyViewEvent;
-import com.android.systemui.recents.events.activity.ShowStackActionButtonEvent;
-import com.android.systemui.recents.events.component.ExpandPipEvent;
-import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
-import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
-import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
-import com.android.systemui.recents.events.ui.DismissAllTaskViewsEvent;
-import com.android.systemui.recents.events.ui.DraggingInRecentsEndedEvent;
-import com.android.systemui.recents.events.ui.DraggingInRecentsEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
-import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat;
-import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
-import com.android.systemui.shared.recents.view.RecentsTransition;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-import com.android.systemui.shared.system.ActivityOptionsCompat;
-import com.android.systemui.shared.system.WindowManagerWrapper;
-import com.android.systemui.stackdivider.WindowManagerProxy;
-import com.android.systemui.statusbar.FlingAnimationUtils;
-import com.android.systemui.statusbar.phone.ScrimController;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This view is the the top level layout that contains TaskStacks (which are laid out according
- * to their SpaceNode bounds.
- */
-public class RecentsView extends FrameLayout {
-
- private static final String TAG = "RecentsView";
-
- private static final int DEFAULT_UPDATE_SCRIM_DURATION = 200;
-
- private static final int SHOW_STACK_ACTION_BUTTON_DURATION = 134;
- private static final int HIDE_STACK_ACTION_BUTTON_DURATION = 100;
-
- private static final int BUSY_RECENTS_TASK_COUNT = 3;
-
- private Handler mHandler;
- private TaskStackView mTaskStackView;
- private TextView mStackActionButton;
- private TextView mEmptyView;
- private final float mStackButtonShadowRadius;
- private final PointF mStackButtonShadowDistance;
- private final int mStackButtonShadowColor;
-
- private boolean mAwaitingFirstLayout = true;
-
- @ViewDebug.ExportedProperty(category="recents")
- Rect mSystemInsets = new Rect();
- private int mDividerSize;
-
- private float mBusynessFactor;
- private ScrimDrawable mBackgroundScrim;
- private ColorDrawable mMultiWindowBackgroundScrim;
- private ValueAnimator mBackgroundScrimAnimator;
- private Point mTmpDisplaySize = new Point();
-
- private final AnimatorUpdateListener mUpdateBackgroundScrimAlpha = (animation) -> {
- int alpha = (Integer) animation.getAnimatedValue();
- mBackgroundScrim.setAlpha(alpha);
- mMultiWindowBackgroundScrim.setAlpha(alpha);
- };
-
- private RecentsTransitionComposer mTransitionHelper;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="touch_")
- private RecentsViewTouchHandler mTouchHandler;
- private final FlingAnimationUtils mFlingAnimationUtils;
-
- public RecentsView(Context context) {
- this(context, null);
- }
-
- public RecentsView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public RecentsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setWillNotDraw(false);
-
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- mHandler = new Handler();
- mTransitionHelper = new RecentsTransitionComposer(getContext());
- mDividerSize = ssp.getDockedDividerSize(context);
- mTouchHandler = new RecentsViewTouchHandler(this);
- mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
- mBackgroundScrim = new ScrimDrawable();
- mMultiWindowBackgroundScrim = new ColorDrawable();
-
- LayoutInflater inflater = LayoutInflater.from(context);
- mEmptyView = (TextView) inflater.inflate(R.layout.recents_empty, this, false);
- addView(mEmptyView);
-
- if (mStackActionButton != null) {
- removeView(mStackActionButton);
- }
- mStackActionButton = (TextView) inflater.inflate(LegacyRecentsImpl.getConfiguration()
- .isLowRamDevice
- ? R.layout.recents_low_ram_stack_action_button
- : R.layout.recents_stack_action_button,
- this, false);
-
- mStackButtonShadowRadius = mStackActionButton.getShadowRadius();
- mStackButtonShadowDistance = new PointF(mStackActionButton.getShadowDx(),
- mStackActionButton.getShadowDy());
- mStackButtonShadowColor = mStackActionButton.getShadowColor();
- addView(mStackActionButton);
-
- reevaluateStyles();
- }
-
- public void reevaluateStyles() {
- int textColor = Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor);
- boolean usingDarkText = Color.luminance(textColor) < 0.5f;
-
- mEmptyView.setTextColor(textColor);
- mEmptyView.setCompoundDrawableTintList(new ColorStateList(new int[][]{
- {android.R.attr.state_enabled}}, new int[]{textColor}));
-
- if (mStackActionButton != null) {
- mStackActionButton.setTextColor(textColor);
- // Enable/disable shadow if text color is already dark.
- if (usingDarkText) {
- mStackActionButton.setShadowLayer(0, 0, 0, 0);
- } else {
- mStackActionButton.setShadowLayer(mStackButtonShadowRadius,
- mStackButtonShadowDistance.x, mStackButtonShadowDistance.y,
- mStackButtonShadowColor);
- }
- }
-
- // Let's also require dark status and nav bars if the text is dark
- int systemBarsStyle = usingDarkText ? View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
- View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0;
-
- setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
- systemBarsStyle);
- }
-
- /**
- * Called from RecentsActivity when it is relaunched.
- */
- public void onReload(TaskStack stack, boolean isResumingFromVisible) {
- final RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- final RecentsActivityLaunchState launchState = config.getLaunchState();
- final boolean isTaskStackEmpty = stack.getTaskCount() == 0;
-
- if (mTaskStackView == null) {
- isResumingFromVisible = false;
- mTaskStackView = new TaskStackView(getContext());
- mTaskStackView.setSystemInsets(mSystemInsets);
- addView(mTaskStackView);
- }
-
- // Reset the state
- mAwaitingFirstLayout = !isResumingFromVisible;
-
- // Update the stack
- mTaskStackView.onReload(isResumingFromVisible);
- updateStack(stack, true /* setStackViewTasks */);
- updateBusyness();
-
- if (isResumingFromVisible) {
- // If we are already visible, then restore the background scrim
- animateBackgroundScrim(getOpaqueScrimAlpha(), DEFAULT_UPDATE_SCRIM_DURATION);
- } else {
- // If we are already occluded by the app, then set the final background scrim alpha now.
- // Otherwise, defer until the enter animation completes to animate the scrim alpha with
- // the tasks for the home animation.
- if (launchState.launchedViaDockGesture || launchState.launchedFromApp
- || isTaskStackEmpty) {
- mBackgroundScrim.setAlpha((int) (getOpaqueScrimAlpha() * 255));
- } else {
- mBackgroundScrim.setAlpha(0);
- }
- mMultiWindowBackgroundScrim.setAlpha(mBackgroundScrim.getAlpha());
- }
- }
-
- /**
- * Called from RecentsActivity when the task stack is updated.
- */
- public void updateStack(TaskStack stack, boolean setStackViewTasks) {
- if (setStackViewTasks) {
- mTaskStackView.setTasks(stack, true /* allowNotifyStackChanges */);
- }
-
- // Update the top level view's visibilities
- if (stack.getTaskCount() > 0) {
- hideEmptyView();
- } else {
- showEmptyView(R.string.recents_empty_message);
- }
- }
-
- /**
- * Animates the scrim opacity based on how many tasks are visible.
- * Called from {@link RecentsActivity} when tasks are dismissed.
- */
- public void updateScrimOpacity() {
- if (updateBusyness()) {
- animateBackgroundScrim(getOpaqueScrimAlpha(), DEFAULT_UPDATE_SCRIM_DURATION);
- }
- }
-
- /**
- * Updates the busyness factor.
- *
- * @return True if it changed.
- */
- private boolean updateBusyness() {
- final int taskCount = mTaskStackView.getStack().getTaskCount();
- final float busyness = Math.min(taskCount, BUSY_RECENTS_TASK_COUNT)
- / (float) BUSY_RECENTS_TASK_COUNT;
- if (mBusynessFactor == busyness) {
- return false;
- } else {
- mBusynessFactor = busyness;
- return true;
- }
- }
-
- /**
- * Returns the current TaskStack.
- */
- public TaskStack getStack() {
- return mTaskStackView.getStack();
- }
-
- /**
- * Returns the window background scrim.
- */
- public void updateBackgroundScrim(Window window, boolean isInMultiWindow) {
- if (isInMultiWindow) {
- mBackgroundScrim.setCallback(null);
- window.setBackgroundDrawable(mMultiWindowBackgroundScrim);
- } else {
- mMultiWindowBackgroundScrim.setCallback(null);
- window.setBackgroundDrawable(mBackgroundScrim);
- }
- }
-
- /** Launches the focused task from the first stack if possible */
- public boolean launchFocusedTask(int logEvent) {
- if (mTaskStackView != null) {
- Task task = mTaskStackView.getFocusedTask();
- if (task != null) {
- TaskView taskView = mTaskStackView.getChildViewForTask(task);
- EventBus.getDefault().send(new LaunchTaskEvent(taskView, task, null, false));
-
- if (logEvent != 0) {
- MetricsLogger.action(getContext(), logEvent,
- task.key.getComponent().toString());
- }
- return true;
- }
- }
- return false;
- }
-
- /** Launches the task that recents was launched from if possible */
- public boolean launchPreviousTask() {
- if (LegacyRecentsImpl.getConfiguration().getLaunchState().launchedFromPipApp) {
- // If the app auto-entered PiP on the way to Recents, then just re-expand it
- EventBus.getDefault().send(new ExpandPipEvent());
- return true;
- }
-
- if (mTaskStackView != null) {
- Task task = getStack().getLaunchTarget();
- if (task != null) {
- TaskView taskView = mTaskStackView.getChildViewForTask(task);
- EventBus.getDefault().send(new LaunchTaskEvent(taskView, task, null, false));
- return true;
- }
- }
- return false;
- }
-
- /**
- * Hides the task stack and shows the empty view.
- */
- public void showEmptyView(int msgResId) {
- mTaskStackView.setVisibility(View.INVISIBLE);
- mEmptyView.setText(msgResId);
- mEmptyView.setVisibility(View.VISIBLE);
- mEmptyView.bringToFront();
- mStackActionButton.bringToFront();
- }
-
- /**
- * Shows the task stack and hides the empty view.
- */
- public void hideEmptyView() {
- mEmptyView.setVisibility(View.INVISIBLE);
- mTaskStackView.setVisibility(View.VISIBLE);
- mTaskStackView.bringToFront();
- mStackActionButton.bringToFront();
- }
-
- /**
- * Set the color of the scrim.
- *
- * @param scrimColors Colors to use.
- * @param animated Interpolate colors if true.
- */
- public void setScrimColors(ColorExtractor.GradientColors scrimColors, boolean animated) {
- mBackgroundScrim.setColor(scrimColors.getMainColor(), animated);
- int alpha = mMultiWindowBackgroundScrim.getAlpha();
- mMultiWindowBackgroundScrim.setColor(scrimColors.getMainColor());
- mMultiWindowBackgroundScrim.setAlpha(alpha);
- }
-
- @Override
- protected void onAttachedToWindow() {
- EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
- EventBus.getDefault().register(mTouchHandler, RecentsActivity.EVENT_BUS_PRIORITY + 2);
- super.onAttachedToWindow();
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- EventBus.getDefault().unregister(this);
- EventBus.getDefault().unregister(mTouchHandler);
- }
-
- /**
- * This is called with the full size of the window since we are handling our own insets.
- */
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int width = MeasureSpec.getSize(widthMeasureSpec);
- int height = MeasureSpec.getSize(heightMeasureSpec);
-
- if (mTaskStackView.getVisibility() != GONE) {
- mTaskStackView.measure(widthMeasureSpec, heightMeasureSpec);
- }
-
- // Measure the empty view to the full size of the screen
- if (mEmptyView.getVisibility() != GONE) {
- measureChild(mEmptyView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
- }
-
- // Measure the stack action button within the constraints of the space above the stack
- Rect buttonBounds = mTaskStackView.mLayoutAlgorithm.getStackActionButtonRect();
- measureChild(mStackActionButton,
- MeasureSpec.makeMeasureSpec(buttonBounds.width(), MeasureSpec.AT_MOST),
- MeasureSpec.makeMeasureSpec(buttonBounds.height(), MeasureSpec.AT_MOST));
-
- setMeasuredDimension(width, height);
- }
-
- /**
- * This is called with the full size of the window since we are handling our own insets.
- */
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- if (mTaskStackView.getVisibility() != GONE) {
- mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight());
- }
-
- // Layout the empty view
- if (mEmptyView.getVisibility() != GONE) {
- int leftRightInsets = mSystemInsets.left + mSystemInsets.right;
- int topBottomInsets = mSystemInsets.top + mSystemInsets.bottom;
- int childWidth = mEmptyView.getMeasuredWidth();
- int childHeight = mEmptyView.getMeasuredHeight();
- int childLeft = left + mSystemInsets.left +
- Math.max(0, (right - left - leftRightInsets - childWidth)) / 2;
- int childTop = top + mSystemInsets.top +
- Math.max(0, (bottom - top - topBottomInsets - childHeight)) / 2;
- mEmptyView.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
- }
-
- // Needs to know the screen size since the gradient never scales up or down
- // even when bounds change.
- mContext.getDisplay().getRealSize(mTmpDisplaySize);
- mBackgroundScrim.setBounds(left, top, right, bottom);
- mMultiWindowBackgroundScrim.setBounds(0, 0, mTmpDisplaySize.x, mTmpDisplaySize.y);
-
- // Layout the stack action button such that its drawable is start-aligned with the
- // stack, vertically centered in the available space above the stack
- Rect buttonBounds = getStackActionButtonBoundsFromStackLayout();
- mStackActionButton.layout(buttonBounds.left, buttonBounds.top, buttonBounds.right,
- buttonBounds.bottom);
-
- if (mAwaitingFirstLayout) {
- mAwaitingFirstLayout = false;
- // If launched via dragging from the nav bar, then we should translate the whole view
- // down offscreen
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- if (launchState.launchedViaDragGesture) {
- setTranslationY(getMeasuredHeight());
- } else {
- setTranslationY(0f);
- }
-
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice
- && mEmptyView.getVisibility() == View.VISIBLE) {
- animateEmptyView(true /* show */, null /* postAnimationTrigger */);
- }
- }
- }
-
- @Override
- public WindowInsets onApplyWindowInsets(WindowInsets insets) {
- mSystemInsets.set(insets.getSystemWindowInsetsAsRect());
- mTaskStackView.setSystemInsets(mSystemInsets);
- requestLayout();
- return insets;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- return mTouchHandler.onInterceptTouchEvent(ev);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return mTouchHandler.onTouchEvent(ev);
- }
-
- @Override
- public void onDrawForeground(Canvas canvas) {
- super.onDrawForeground(canvas);
-
- ArrayList<DockState> visDockStates = mTouchHandler.getVisibleDockStates();
- for (int i = visDockStates.size() - 1; i >= 0; i--) {
- visDockStates.get(i).viewState.draw(canvas);
- }
- }
-
- @Override
- protected boolean verifyDrawable(Drawable who) {
- ArrayList<DockState> visDockStates = mTouchHandler.getVisibleDockStates();
- for (int i = visDockStates.size() - 1; i >= 0; i--) {
- Drawable d = visDockStates.get(i).viewState.dockAreaOverlay;
- if (d == who) {
- return true;
- }
- }
- return super.verifyDrawable(who);
- }
-
- /**** EventBus Events ****/
-
- public final void onBusEvent(LaunchTaskEvent event) {
- launchTaskFromRecents(getStack(), event.task, mTaskStackView, event.taskView,
- event.screenPinningRequested, event.targetWindowingMode, event.targetActivityType);
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- EventBus.getDefault().send(new HideStackActionButtonEvent(false /* translate */));
- }
- }
-
- public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
- int taskViewExitToHomeDuration = TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION;
- // Hide the stack action button
- EventBus.getDefault().send(new HideStackActionButtonEvent());
- animateBackgroundScrim(0f, taskViewExitToHomeDuration);
-
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- animateEmptyView(false /* show */, event.getAnimationTrigger());
- }
- }
-
- public final void onBusEvent(DragStartEvent event) {
- updateVisibleDockRegions(LegacyRecentsImpl.getConfiguration().getDockStatesForCurrentOrientation(),
- true /* isDefaultDockState */, DockState.NONE.viewState.dockAreaAlpha,
- DockState.NONE.viewState.hintTextAlpha,
- true /* animateAlpha */, false /* animateBounds */);
-
- // Temporarily hide the stack action button without changing visibility
- if (mStackActionButton != null) {
- mStackActionButton.animate()
- .alpha(0f)
- .setDuration(HIDE_STACK_ACTION_BUTTON_DURATION)
- .setInterpolator(Interpolators.ALPHA_OUT)
- .start();
- }
- }
-
- public final void onBusEvent(DragDropTargetChangedEvent event) {
- if (event.dropTarget == null || !(event.dropTarget instanceof DockState)) {
- updateVisibleDockRegions(
- LegacyRecentsImpl.getConfiguration().getDockStatesForCurrentOrientation(),
- true /* isDefaultDockState */, DockState.NONE.viewState.dockAreaAlpha,
- DockState.NONE.viewState.hintTextAlpha,
- true /* animateAlpha */, true /* animateBounds */);
- } else {
- final DockState dockState = (DockState) event.dropTarget;
- updateVisibleDockRegions(new DockState[] {dockState},
- false /* isDefaultDockState */, -1, -1, true /* animateAlpha */,
- true /* animateBounds */);
- }
- if (mStackActionButton != null) {
- event.addPostAnimationCallback(new Runnable() {
- @Override
- public void run() {
- // Move the clear all button to its new position
- Rect buttonBounds = getStackActionButtonBoundsFromStackLayout();
- mStackActionButton.setLeftTopRightBottom(buttonBounds.left, buttonBounds.top,
- buttonBounds.right, buttonBounds.bottom);
- }
- });
- }
- }
-
- public final void onBusEvent(final DragEndEvent event) {
- // Handle the case where we drop onto a dock region
- if (event.dropTarget instanceof DockState) {
- final DockState dockState = (DockState) event.dropTarget;
-
- // Hide the dock region
- updateVisibleDockRegions(null, false /* isDefaultDockState */, -1, -1,
- false /* animateAlpha */, false /* animateBounds */);
-
- // We translated the view but we need to animate it back from the current layout-space
- // rect to its final layout-space rect
- Utilities.setViewFrameFromTranslation(event.taskView);
-
- final ActivityOptions options = ActivityOptionsCompat.makeSplitScreenOptions(
- dockState.createMode == SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT);
- if (ActivityManagerWrapper.getInstance().startActivityFromRecents(event.task.key.id,
- options)) {
- final Runnable animStartedListener = () -> {
- EventBus.getDefault().send(new DockedFirstAnimationFrameEvent());
- // Remove the task and don't bother relaying out, as all the tasks
- // will be relaid out when the stack changes on the multiwindow
- // change event
- getStack().removeTask(event.task, null, true /* fromDockGesture */);
- };
- final Rect taskRect = getTaskRect(event.taskView);
- AppTransitionAnimationSpecsFuture future = new AppTransitionAnimationSpecsFuture(
- getHandler()) {
- @Override
- public List<AppTransitionAnimationSpecCompat> composeSpecs() {
- return mTransitionHelper.composeDockAnimationSpec(event.taskView, taskRect);
- }
- };
- WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture(
- future, animStartedListener, getHandler(), true /* scaleUp */,
- getContext().getDisplayId());
- MetricsLogger.action(mContext, MetricsEvent.ACTION_WINDOW_DOCK_DRAG_DROP,
- event.task.getTopComponent().flattenToShortString());
- } else {
- EventBus.getDefault().send(new DragEndCancelledEvent(getStack(), event.task,
- event.taskView));
- }
- } else {
- // Animate the overlay alpha back to 0
- updateVisibleDockRegions(null, true /* isDefaultDockState */, -1, -1,
- true /* animateAlpha */, false /* animateBounds */);
- }
-
- // Show the stack action button again without changing visibility
- if (mStackActionButton != null) {
- mStackActionButton.animate()
- .alpha(1f)
- .setDuration(SHOW_STACK_ACTION_BUTTON_DURATION)
- .setInterpolator(Interpolators.ALPHA_IN)
- .start();
- }
- }
-
- public final void onBusEvent(final DragEndCancelledEvent event) {
- // Animate the overlay alpha back to 0
- updateVisibleDockRegions(null, true /* isDefaultDockState */, -1, -1,
- true /* animateAlpha */, false /* animateBounds */);
- }
-
- private Rect getTaskRect(TaskView taskView) {
- int[] location = taskView.getLocationOnScreen();
- int viewX = location[0];
- int viewY = location[1];
- return new Rect(viewX, viewY,
- (int) (viewX + taskView.getWidth() * taskView.getScaleX()),
- (int) (viewY + taskView.getHeight() * taskView.getScaleY()));
- }
-
- public final void onBusEvent(DraggingInRecentsEvent event) {
- if (mTaskStackView.getTaskViews().size() > 0) {
- setTranslationY(event.distanceFromTop - mTaskStackView.getTaskViews().get(0).getY());
- }
- }
-
- public final void onBusEvent(DraggingInRecentsEndedEvent event) {
- ViewPropertyAnimator animator = animate();
- if (event.velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
- animator.translationY(getHeight());
- animator.withEndAction(new Runnable() {
- @Override
- public void run() {
- WindowManagerProxy.getInstance().maximizeDockedStack();
- }
- });
- mFlingAnimationUtils.apply(animator, getTranslationY(), getHeight(), event.velocity);
- } else {
- animator.translationY(0f);
- animator.setListener(null);
- mFlingAnimationUtils.apply(animator, getTranslationY(), 0, event.velocity);
- }
- animator.start();
- }
-
- public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- if (!launchState.launchedViaDockGesture && !launchState.launchedFromApp
- && getStack().getTaskCount() > 0) {
- animateBackgroundScrim(getOpaqueScrimAlpha(),
- TaskStackAnimationHelper.ENTER_FROM_HOME_TRANSLATION_DURATION);
- }
- }
-
- public final void onBusEvent(AllTaskViewsDismissedEvent event) {
- EventBus.getDefault().send(new HideStackActionButtonEvent());
- }
-
- public final void onBusEvent(DismissAllTaskViewsEvent event) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- if (!ssp.hasDockedTask()) {
- // Animate the background away only if we are dismissing Recents to home
- animateBackgroundScrim(0f, DEFAULT_UPDATE_SCRIM_DURATION);
- }
- }
-
- public final void onBusEvent(ShowStackActionButtonEvent event) {
- showStackActionButton(SHOW_STACK_ACTION_BUTTON_DURATION, event.translate);
- }
-
- public final void onBusEvent(HideStackActionButtonEvent event) {
- hideStackActionButton(HIDE_STACK_ACTION_BUTTON_DURATION, true /* translate */);
- }
-
- public final void onBusEvent(MultiWindowStateChangedEvent event) {
- updateStack(event.stack, false /* setStackViewTasks */);
- }
-
- public final void onBusEvent(ShowEmptyViewEvent event) {
- showEmptyView(R.string.recents_empty_message);
- }
-
- /**
- * Shows the stack action button.
- */
- private void showStackActionButton(final int duration, final boolean translate) {
- final ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger();
- if (mStackActionButton.getVisibility() == View.INVISIBLE) {
- mStackActionButton.setVisibility(View.VISIBLE);
- mStackActionButton.setAlpha(0f);
- if (translate) {
- mStackActionButton.setTranslationY(mStackActionButton.getMeasuredHeight() *
- (LegacyRecentsImpl.getConfiguration().isLowRamDevice ? 1 : -0.25f));
- } else {
- mStackActionButton.setTranslationY(0f);
- }
- postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
- @Override
- public void run() {
- if (translate) {
- mStackActionButton.animate()
- .translationY(0f);
- }
- mStackActionButton.animate()
- .alpha(1f)
- .setDuration(duration)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .start();
- }
- });
- }
- postAnimationTrigger.flushLastDecrementRunnables();
- }
-
- /**
- * Hides the stack action button.
- */
- private void hideStackActionButton(int duration, boolean translate) {
- final ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger();
- hideStackActionButton(duration, translate, postAnimationTrigger);
- postAnimationTrigger.flushLastDecrementRunnables();
- }
-
- /**
- * Hides the stack action button.
- */
- private void hideStackActionButton(int duration, boolean translate,
- final ReferenceCountedTrigger postAnimationTrigger) {
- if (mStackActionButton.getVisibility() == View.VISIBLE) {
- if (translate) {
- mStackActionButton.animate().translationY(mStackActionButton.getMeasuredHeight()
- * (LegacyRecentsImpl.getConfiguration().isLowRamDevice ? 1 : -0.25f));
- }
- mStackActionButton.animate()
- .alpha(0f)
- .setDuration(duration)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- mStackActionButton.setVisibility(View.INVISIBLE);
- postAnimationTrigger.decrement();
- }
- })
- .start();
- postAnimationTrigger.increment();
- }
- }
-
- /**
- * Animates a translation in the Y direction and fades in/out for empty view to show or hide it.
- * @param show whether to translate up and fade in the empty view to the center of the screen
- * @param postAnimationTrigger to keep track of the animation
- */
- private void animateEmptyView(boolean show, ReferenceCountedTrigger postAnimationTrigger) {
- float start = mTaskStackView.getStackAlgorithm().getTaskRect().height() / 4;
- mEmptyView.setTranslationY(show ? start : 0);
- mEmptyView.setAlpha(show ? 0f : 1f);
- ViewPropertyAnimator animator = mEmptyView.animate()
- .setDuration(150)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .translationY(show ? 0 : start)
- .alpha(show ? 1f : 0f);
-
- if (postAnimationTrigger != null) {
- animator.setListener(postAnimationTrigger.decrementOnAnimationEnd());
- postAnimationTrigger.increment();
- }
- animator.start();
- }
-
- /**
- * Updates the dock region to match the specified dock state.
- */
- private void updateVisibleDockRegions(DockState[] newDockStates,
- boolean isDefaultDockState, int overrideAreaAlpha, int overrideHintAlpha,
- boolean animateAlpha, boolean animateBounds) {
- ArraySet<DockState> newDockStatesSet = Utilities.arrayToSet(newDockStates,
- new ArraySet<DockState>());
- ArrayList<DockState> visDockStates = mTouchHandler.getVisibleDockStates();
- for (int i = visDockStates.size() - 1; i >= 0; i--) {
- DockState dockState = visDockStates.get(i);
- DockState.ViewState viewState = dockState.viewState;
- if (newDockStates == null || !newDockStatesSet.contains(dockState)) {
- // This is no longer visible, so hide it
- viewState.startAnimation(null, 0, 0, TaskStackView.SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN, animateAlpha, animateBounds);
- } else {
- // This state is now visible, update the bounds and show it
- int areaAlpha = overrideAreaAlpha != -1
- ? overrideAreaAlpha
- : viewState.dockAreaAlpha;
- int hintAlpha = overrideHintAlpha != -1
- ? overrideHintAlpha
- : viewState.hintTextAlpha;
- Rect bounds = isDefaultDockState
- ? dockState.getPreDockedBounds(getMeasuredWidth(), getMeasuredHeight(),
- mSystemInsets)
- : dockState.getDockedBounds(getMeasuredWidth(), getMeasuredHeight(),
- mDividerSize, mSystemInsets, getResources());
- if (viewState.dockAreaOverlay.getCallback() != this) {
- viewState.dockAreaOverlay.setCallback(this);
- viewState.dockAreaOverlay.setBounds(bounds);
- }
- viewState.startAnimation(bounds, areaAlpha, hintAlpha,
- TaskStackView.SLOW_SYNC_STACK_DURATION, Interpolators.FAST_OUT_SLOW_IN,
- animateAlpha, animateBounds);
- }
- }
- }
-
- /**
- * Scrim alpha based on how busy recents is:
- * Scrim will be {@link ScrimController#GRADIENT_SCRIM_ALPHA} when the stack is empty,
- * and {@link ScrimController#GRADIENT_SCRIM_ALPHA_BUSY} when it's full.
- *
- * @return Alpha from 0 to 1.
- */
- private float getOpaqueScrimAlpha() {
- return MathUtils.map(0, 1, ScrimController.GRADIENT_SCRIM_ALPHA,
- ScrimController.GRADIENT_SCRIM_ALPHA_BUSY, mBusynessFactor);
- }
-
- /**
- * Animates the background scrim to the given {@param alpha}.
- */
- private void animateBackgroundScrim(float alpha, int duration) {
- Utilities.cancelAnimationWithoutCallbacks(mBackgroundScrimAnimator);
- // Calculate the absolute alpha to animate from
- final int fromAlpha = mBackgroundScrim.getAlpha();
- final int toAlpha = (int) (alpha * 255);
- mBackgroundScrimAnimator = ValueAnimator.ofInt(fromAlpha, toAlpha);
- mBackgroundScrimAnimator.setDuration(duration);
- mBackgroundScrimAnimator.setInterpolator(toAlpha > fromAlpha
- ? Interpolators.ALPHA_IN
- : Interpolators.ALPHA_OUT);
- mBackgroundScrimAnimator.addUpdateListener(mUpdateBackgroundScrimAlpha);
- mBackgroundScrimAnimator.start();
- }
-
- /**
- * @return the bounds of the stack action button.
- */
- Rect getStackActionButtonBoundsFromStackLayout() {
- Rect actionButtonRect = new Rect(
- mTaskStackView.mLayoutAlgorithm.getStackActionButtonRect());
- int left, top;
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- Rect windowRect = LegacyRecentsImpl.getSystemServices().getWindowRect();
- int spaceLeft = windowRect.width() - mSystemInsets.left - mSystemInsets.right;
- left = (spaceLeft - mStackActionButton.getMeasuredWidth()) / 2 + mSystemInsets.left;
- top = windowRect.height() - (mStackActionButton.getMeasuredHeight()
- + mSystemInsets.bottom + mStackActionButton.getPaddingBottom() / 2);
- } else {
- left = isLayoutRtl()
- ? actionButtonRect.left - mStackActionButton.getPaddingLeft()
- : actionButtonRect.right + mStackActionButton.getPaddingRight()
- - mStackActionButton.getMeasuredWidth();
- top = actionButtonRect.top +
- (actionButtonRect.height() - mStackActionButton.getMeasuredHeight()) / 2;
- }
- actionButtonRect.set(left, top, left + mStackActionButton.getMeasuredWidth(),
- top + mStackActionButton.getMeasuredHeight());
- return actionButtonRect;
- }
-
- View getStackActionButton() {
- return mStackActionButton;
- }
-
- /**
- * Launches the specified {@link Task}.
- */
- public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task,
- final TaskStackView stackView, final TaskView taskView,
- final boolean screenPinningRequested, final int windowingMode, final int activityType) {
-
- final Runnable animStartedListener;
- final AppTransitionAnimationSpecsFuture transitionFuture;
- if (taskView != null) {
-
- // Fetch window rect here already in order not to be blocked on lock contention in WM
- // when the future calls it.
- final Rect windowRect = LegacyRecentsImpl.getSystemServices().getWindowRect();
- transitionFuture = new AppTransitionAnimationSpecsFuture(stackView.getHandler()) {
- @Override
- public List<AppTransitionAnimationSpecCompat> composeSpecs() {
- return mTransitionHelper.composeAnimationSpecs(task, stackView, windowingMode,
- activityType, windowRect);
- }
- };
- animStartedListener = new Runnable() {
- private boolean mHandled;
-
- @Override
- public void run() {
- if (mHandled) {
- return;
- }
- mHandled = true;
-
- // If we are launching into another task, cancel the previous task's
- // window transition
- EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
- EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
- stackView.cancelAllTaskViewAnimations();
-
- if (screenPinningRequested) {
- // Request screen pinning after the animation runs
- mHandler.postDelayed(() -> {
- EventBus.getDefault().send(new ScreenPinningRequestEvent(mContext,
- task.key.id));
- }, 350);
- }
-
- if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- // Reset the state where we are waiting for the transition to start
- EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(false));
- }
- }
- };
- } else {
- // This is only the case if the task is not on screen (scrolled offscreen for example)
- transitionFuture = null;
- animStartedListener = new Runnable() {
- private boolean mHandled;
-
- @Override
- public void run() {
- if (mHandled) {
- return;
- }
- mHandled = true;
-
- // If we are launching into another task, cancel the previous task's
- // window transition
- EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
- EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
- stackView.cancelAllTaskViewAnimations();
-
- if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- // Reset the state where we are waiting for the transition to start
- EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(false));
- }
- }
- };
- }
-
- EventBus.getDefault().send(new SetWaitingForTransitionStartEvent(true));
- final ActivityOptions opts = RecentsTransition.createAspectScaleAnimation(mContext,
- mHandler, true /* scaleUp */, transitionFuture != null ? transitionFuture : null,
- animStartedListener);
- if (taskView == null) {
- // If there is no task view, then we do not need to worry about animating out occluding
- // task views, and we can launch immediately
- startTaskActivity(stack, task, taskView, opts, transitionFuture,
- windowingMode, activityType);
- } else {
- LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView,
- screenPinningRequested);
- EventBus.getDefault().send(launchStartedEvent);
- startTaskActivity(stack, task, taskView, opts, transitionFuture, windowingMode,
- activityType);
- }
- ActivityManagerWrapper.getInstance().closeSystemWindows(SYSTEM_DIALOG_REASON_RECENT_APPS);
- }
-
- /**
- * Starts the activity for the launch task.
- *
- * @param taskView this is the {@link TaskView} that we are launching from. This can be null if
- * we are toggling recents and the launch-to task is now offscreen.
- */
- private void startTaskActivity(TaskStack stack, Task task, @Nullable TaskView taskView,
- ActivityOptions opts, AppTransitionAnimationSpecsFuture transitionFuture,
- int windowingMode, int activityType) {
- ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(task.key, opts,
- windowingMode, activityType, succeeded -> {
- if (succeeded) {
- // Keep track of the index of the task launch
- int taskIndexFromFront = 0;
- int taskIndex = stack.indexOfTask(task);
- if (taskIndex > -1) {
- taskIndexFromFront = stack.getTaskCount() - taskIndex - 1;
- }
- EventBus.getDefault().send(new LaunchTaskSucceededEvent(taskIndexFromFront));
- } else {
- Log.e(TAG, mContext.getString(R.string.recents_launch_error_message, task.title));
-
- // Dismiss the task if we fail to launch it
- if (taskView != null) {
- taskView.dismissTask();
- }
-
- // Keep track of failed launches
- EventBus.getDefault().send(new LaunchTaskFailedEvent());
- }
- }, getHandler());
- if (transitionFuture != null) {
- mHandler.post(transitionFuture::composeSpecsSynchronous);
- }
- }
-
- @Override
- public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
- super.requestDisallowInterceptTouchEvent(disallowIntercept);
- mTouchHandler.cancelStackActionButtonClick();
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
- String id = Integer.toHexString(System.identityHashCode(this));
-
- writer.print(prefix); writer.print(TAG);
- writer.print(" awaitingFirstLayout="); writer.print(mAwaitingFirstLayout ? "Y" : "N");
- writer.print(" insets="); writer.print(Utilities.dumpRect(mSystemInsets));
- writer.print(" [0x"); writer.print(id); writer.print("]");
- writer.println();
-
- if (getStack() != null) {
- getStack().dump(innerPrefix, writer);
- }
- if (mTaskStackView != null) {
- mTaskStackView.dump(innerPrefix, writer);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
deleted file mode 100644
index 1a827d5..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.app.ActivityTaskManager;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.view.InputDevice;
-import android.view.MotionEvent;
-import android.view.PointerIcon;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewDebug;
-
-import com.android.internal.policy.DividerSnapAlgorithm;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
-import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.ui.DismissAllTaskViewsEvent;
-import com.android.systemui.recents.events.ui.HideIncompatibleAppOverlayEvent;
-import com.android.systemui.recents.events.ui.ShowIncompatibleAppOverlayEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartInitializeDropTargetsEvent;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.shared.recents.model.Task;
-
-import java.util.ArrayList;
-
-/**
- * Handles touch events for a RecentsView.
- */
-public class RecentsViewTouchHandler {
-
- private RecentsView mRv;
-
- @ViewDebug.ExportedProperty(deepExport=true, prefix="drag_task")
- private Task mDragTask;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="drag_task_view_")
- private TaskView mTaskView;
-
- @ViewDebug.ExportedProperty(category="recents")
- private Point mTaskViewOffset = new Point();
- @ViewDebug.ExportedProperty(category="recents")
- private Point mDownPos = new Point();
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mDragRequested;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mIsDragging;
- private float mDragSlop;
- private int mDeviceId = -1;
-
- private DropTarget mLastDropTarget;
- private DividerSnapAlgorithm mDividerSnapAlgorithm;
- private ArrayList<DropTarget> mDropTargets = new ArrayList<>();
- private ArrayList<DockState> mVisibleDockStates = new ArrayList<>();
-
- public RecentsViewTouchHandler(RecentsView rv) {
- mRv = rv;
- mDragSlop = ViewConfiguration.get(rv.getContext()).getScaledTouchSlop();
- updateSnapAlgorithm();
- }
-
- private void updateSnapAlgorithm() {
- Rect insets = new Rect();
- SystemServicesProxy.getInstance(mRv.getContext()).getStableInsets(insets);
- mDividerSnapAlgorithm = DividerSnapAlgorithm.create(mRv.getContext(), insets);
- }
-
- /**
- * Registers a new drop target for the current drag only.
- */
- public void registerDropTargetForCurrentDrag(DropTarget target) {
- mDropTargets.add(target);
- }
-
- /**
- * Returns the set of visible dock states for this current drag.
- */
- public ArrayList<DockState> getVisibleDockStates() {
- return mVisibleDockStates;
- }
-
- /** Touch preprocessing for handling below */
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- return handleTouchEvent(ev) || mDragRequested;
- }
-
- /** Handles touch events once we have intercepted them */
- public boolean onTouchEvent(MotionEvent ev) {
- handleTouchEvent(ev);
- if (ev.getAction() == MotionEvent.ACTION_UP && mRv.getStack().getTaskCount() == 0) {
- EventBus.getDefault().send(new HideRecentsEvent(false, true));
- }
- return true;
- }
-
- /**** Events ****/
-
- public final void onBusEvent(DragStartEvent event) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- mRv.getParent().requestDisallowInterceptTouchEvent(true);
- mDragRequested = true;
- // We defer starting the actual drag handling until the user moves past the drag slop
- mIsDragging = false;
- mDragTask = event.task;
- mTaskView = event.taskView;
- mDropTargets.clear();
-
- int[] recentsViewLocation = new int[2];
- mRv.getLocationInWindow(recentsViewLocation);
- mTaskViewOffset.set(mTaskView.getLeft() - recentsViewLocation[0] + event.tlOffset.x,
- mTaskView.getTop() - recentsViewLocation[1] + event.tlOffset.y);
-
- // Change space coordinates relative to the view to RecentsView when user initiates a touch
- if (event.isUserTouchInitiated) {
- float x = mDownPos.x - mTaskViewOffset.x;
- float y = mDownPos.y - mTaskViewOffset.y;
- mTaskView.setTranslationX(x);
- mTaskView.setTranslationY(y);
- }
-
- mVisibleDockStates.clear();
- if (ActivityTaskManager.supportsMultiWindow(mRv.getContext()) && !ssp.hasDockedTask()
- && mDividerSnapAlgorithm.isSplitScreenFeasible()) {
- LegacyRecentsImpl.logDockAttempt(mRv.getContext(), event.task.getTopComponent(),
- event.task.resizeMode);
- if (!event.task.isDockable) {
- EventBus.getDefault().send(new ShowIncompatibleAppOverlayEvent());
- } else {
- // Add the dock state drop targets (these take priority)
- DockState[] dockStates = LegacyRecentsImpl.getConfiguration()
- .getDockStatesForCurrentOrientation();
- for (DockState dockState : dockStates) {
- registerDropTargetForCurrentDrag(dockState);
- dockState.update(mRv.getContext());
- mVisibleDockStates.add(dockState);
- }
- }
- }
-
- // Request other drop targets to register themselves
- EventBus.getDefault().send(new DragStartInitializeDropTargetsEvent(event.task,
- event.taskView, this));
- if (mDeviceId != -1) {
- InputDevice device = InputDevice.getDevice(mDeviceId);
- if (device != null) {
- device.setPointerType(PointerIcon.TYPE_GRABBING);
- }
- }
- }
-
- public final void onBusEvent(DragEndEvent event) {
- if (!mDragTask.isDockable) {
- EventBus.getDefault().send(new HideIncompatibleAppOverlayEvent());
- }
- mDragRequested = false;
- mDragTask = null;
- mTaskView = null;
- mLastDropTarget = null;
- }
-
- public final void onBusEvent(ConfigurationChangedEvent event) {
- if (event.fromDisplayDensityChange || event.fromDeviceOrientationChange) {
- updateSnapAlgorithm();
- }
- }
-
- void cancelStackActionButtonClick() {
- mRv.getStackActionButton().setPressed(false);
- }
-
- private boolean isWithinStackActionButton(float x, float y) {
- Rect rect = mRv.getStackActionButtonBoundsFromStackLayout();
- return mRv.getStackActionButton().getVisibility() == View.VISIBLE &&
- mRv.getStackActionButton().pointInView(x - rect.left, y - rect.top, 0 /* slop */);
- }
-
- private void changeStackActionButtonDrawableHotspot(float x, float y) {
- Rect rect = mRv.getStackActionButtonBoundsFromStackLayout();
- mRv.getStackActionButton().drawableHotspotChanged(x - rect.left, y - rect.top);
- }
-
- /**
- * Handles dragging touch events
- */
- private boolean handleTouchEvent(MotionEvent ev) {
- int action = ev.getActionMasked();
- boolean consumed = false;
- float evX = ev.getX();
- float evY = ev.getY();
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- mDownPos.set((int) evX, (int) evY);
- mDeviceId = ev.getDeviceId();
-
- if (isWithinStackActionButton(evX, evY)) {
- changeStackActionButtonDrawableHotspot(evX, evY);
- mRv.getStackActionButton().setPressed(true);
- }
- break;
- case MotionEvent.ACTION_MOVE: {
- float x = evX - mTaskViewOffset.x;
- float y = evY - mTaskViewOffset.y;
-
- if (mRv.getStackActionButton().isPressed() && isWithinStackActionButton(evX, evY)) {
- changeStackActionButtonDrawableHotspot(evX, evY);
- }
-
- if (mDragRequested) {
- if (!mIsDragging) {
- mIsDragging = Math.hypot(evX - mDownPos.x, evY - mDownPos.y) > mDragSlop;
- }
- if (mIsDragging) {
- int width = mRv.getMeasuredWidth();
- int height = mRv.getMeasuredHeight();
-
- DropTarget currentDropTarget = null;
-
- // Give priority to the current drop target to retain the touch handling
- if (mLastDropTarget != null) {
- if (mLastDropTarget.acceptsDrop((int) evX, (int) evY, width, height,
- mRv.mSystemInsets, true /* isCurrentTarget */)) {
- currentDropTarget = mLastDropTarget;
- }
- }
-
- // Otherwise, find the next target to handle this event
- if (currentDropTarget == null) {
- for (DropTarget target : mDropTargets) {
- if (target.acceptsDrop((int) evX, (int) evY, width, height,
- mRv.mSystemInsets, false /* isCurrentTarget */)) {
- currentDropTarget = target;
- break;
- }
- }
- }
- if (mLastDropTarget != currentDropTarget) {
- mLastDropTarget = currentDropTarget;
- EventBus.getDefault().send(new DragDropTargetChangedEvent(mDragTask,
- currentDropTarget));
- }
- }
- mTaskView.setTranslationX(x);
- mTaskView.setTranslationY(y);
- }
- break;
- }
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL: {
- if (mRv.getStackActionButton().isPressed() && isWithinStackActionButton(evX, evY)) {
- EventBus.getDefault().send(new DismissAllTaskViewsEvent());
- consumed = true;
- }
- cancelStackActionButtonClick();
- if (mDragRequested) {
- boolean cancelled = action == MotionEvent.ACTION_CANCEL;
- if (cancelled) {
- EventBus.getDefault().send(new DragDropTargetChangedEvent(mDragTask, null));
- }
- EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView,
- !cancelled ? mLastDropTarget : null));
- break;
- }
- mDeviceId = -1;
- }
- }
- return consumed;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/SystemBarScrimViews.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/SystemBarScrimViews.java
deleted file mode 100644
index 22c12b4..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/SystemBarScrimViews.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.content.Context;
-import android.view.View;
-
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivity;
-import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
-import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
-import com.android.systemui.recents.events.ui.DismissAllTaskViewsEvent;
-import com.android.systemui.recents.events.activity.MultiWindowStateChangedEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.utilities.AnimationProps;
-
-/** Manages the scrims for the various system bars. */
-public class SystemBarScrimViews {
-
- private static final int DEFAULT_ANIMATION_DURATION = 150;
-
- private Context mContext;
-
- private View mNavBarScrimView;
-
- private boolean mHasNavBarScrim;
- private boolean mShouldAnimateNavBarScrim;
- private boolean mHasTransposedNavBar;
- private boolean mHasDockedTasks;
- private int mNavBarScrimEnterDuration;
-
- public SystemBarScrimViews(RecentsActivity activity) {
- mContext = activity;
- mNavBarScrimView = activity.findViewById(R.id.nav_bar_scrim);
- mNavBarScrimView.forceHasOverlappingRendering(false);
- mNavBarScrimEnterDuration = activity.getResources().getInteger(
- R.integer.recents_nav_bar_scrim_enter_duration);
- mHasNavBarScrim = LegacyRecentsImpl.getSystemServices().hasTransposedNavigationBar();
- mHasDockedTasks = LegacyRecentsImpl.getSystemServices().hasDockedTask();
- }
-
- /**
- * Updates the nav bar scrim.
- */
- public void updateNavBarScrim(boolean animateNavBarScrim, boolean hasStackTasks,
- AnimationProps animation) {
- prepareEnterRecentsAnimation(isNavBarScrimRequired(hasStackTasks), animateNavBarScrim);
- if (animateNavBarScrim && animation != null) {
- animateNavBarScrimVisibility(true, animation);
- }
- }
-
- /**
- * Prepares the scrim views for animating when entering Recents. This will be called before
- * the first draw, unless we are updating the scrim on configuration change.
- */
- private void prepareEnterRecentsAnimation(boolean hasNavBarScrim, boolean animateNavBarScrim) {
- mHasNavBarScrim = hasNavBarScrim;
- mShouldAnimateNavBarScrim = animateNavBarScrim;
-
- mNavBarScrimView.setVisibility(mHasNavBarScrim && !mShouldAnimateNavBarScrim ?
- View.VISIBLE : View.INVISIBLE);
- }
-
- /**
- * Animates the nav bar scrim visibility.
- */
- private void animateNavBarScrimVisibility(boolean visible, AnimationProps animation) {
- int toY = 0;
- if (visible) {
- mNavBarScrimView.setVisibility(View.VISIBLE);
- mNavBarScrimView.setTranslationY(mNavBarScrimView.getMeasuredHeight());
- } else {
- toY = mNavBarScrimView.getMeasuredHeight();
- }
- if (animation != AnimationProps.IMMEDIATE) {
- mNavBarScrimView.animate()
- .translationY(toY)
- .setDuration(animation.getDuration(AnimationProps.BOUNDS))
- .setInterpolator(animation.getInterpolator(AnimationProps.BOUNDS))
- .start();
- } else {
- mNavBarScrimView.setTranslationY(toY);
- }
- }
-
- /**
- * @return Whether to show the nav bar scrim.
- */
- private boolean isNavBarScrimRequired(boolean hasStackTasks) {
- return hasStackTasks && !mHasTransposedNavBar && !mHasDockedTasks;
- }
-
- /**** EventBus events ****/
-
- /**
- * Starts animating the scrim views when entering Recents.
- */
- public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
- if (mHasNavBarScrim) {
- AnimationProps animation = mShouldAnimateNavBarScrim
- ? new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, mNavBarScrimEnterDuration)
- .setInterpolator(AnimationProps.BOUNDS, Interpolators.DECELERATE_QUINT)
- : AnimationProps.IMMEDIATE;
- animateNavBarScrimVisibility(true, animation);
- }
- }
-
- /**
- * Starts animating the scrim views when leaving Recents (either via launching a task, or
- * going home).
- */
- public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
- if (mHasNavBarScrim) {
- AnimationProps animation = createBoundsAnimation(
- TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION);
- animateNavBarScrimVisibility(false, animation);
- }
- }
-
- public final void onBusEvent(DismissAllTaskViewsEvent event) {
- if (mHasNavBarScrim) {
- AnimationProps animation = createBoundsAnimation(
- TaskStackAnimationHelper.EXIT_TO_HOME_TRANSLATION_DURATION);
- animateNavBarScrimVisibility(false, animation);
- }
- }
-
- public final void onBusEvent(ConfigurationChangedEvent event) {
- if (event.fromDeviceOrientationChange) {
- mHasNavBarScrim = LegacyRecentsImpl.getSystemServices().hasTransposedNavigationBar();
- }
- animateScrimToCurrentNavBarState(event.hasStackTasks);
- }
-
- public final void onBusEvent(MultiWindowStateChangedEvent event) {
- mHasDockedTasks = event.inMultiWindow;
- animateScrimToCurrentNavBarState(event.stack.getTaskCount() > 0);
- }
-
- public final void onBusEvent(final DragEndEvent event) {
- // Hide the nav bar scrims once we drop to a dock region
- if (event.dropTarget instanceof DockState) {
- animateScrimToCurrentNavBarState(false /* hasStackTasks */);
- }
- }
-
- public final void onBusEvent(final DragEndCancelledEvent event) {
- // Restore the scrims to the normal state
- animateScrimToCurrentNavBarState(event.stack.getTaskCount() > 0);
- }
-
- /**
- * Animates the scrim to match the state of the current nav bar.
- */
- private void animateScrimToCurrentNavBarState(boolean hasStackTasks) {
- boolean hasNavBarScrim = isNavBarScrimRequired(hasStackTasks);
- if (mHasNavBarScrim != hasNavBarScrim) {
- AnimationProps animation = hasNavBarScrim
- ? createBoundsAnimation(DEFAULT_ANIMATION_DURATION)
- : AnimationProps.IMMEDIATE;
- animateNavBarScrimVisibility(hasNavBarScrim, animation);
- }
- mHasNavBarScrim = hasNavBarScrim;
- }
-
- /**
- * @return a default animation to aniamte the bounds of the scrim.
- */
- private AnimationProps createBoundsAnimation(int duration) {
- return new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, duration)
- .setInterpolator(AnimationProps.BOUNDS, Interpolators.FAST_OUT_SLOW_IN);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
deleted file mode 100644
index 5574934..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.util.Log;
-import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
-
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivityLaunchState;
-import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.RecentsDebugFlags;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
-import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.views.lowram.TaskStackLowRamLayoutAlgorithm;
-import com.android.systemui.recents.utilities.AnimationProps;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A helper class to create task view animations for {@link TaskView}s in a {@link TaskStackView},
- * but not the contents of the {@link TaskView}s.
- */
-public class TaskStackAnimationHelper {
-
- /**
- * Callbacks from the helper to coordinate view-content animations with view animations.
- */
- public interface Callbacks {
- /**
- * Callback to prepare for the start animation for the launch target {@link TaskView}.
- */
- void onPrepareLaunchTargetForEnterAnimation();
-
- /**
- * Callback to start the animation for the launch target {@link TaskView}.
- */
- void onStartLaunchTargetEnterAnimation(TaskViewTransform transform, int duration,
- boolean screenPinningEnabled, ReferenceCountedTrigger postAnimationTrigger);
-
- /**
- * Callback to start the animation for the launch target {@link TaskView} when it is
- * launched from Recents.
- */
- void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
- ReferenceCountedTrigger postAnimationTrigger);
-
- /**
- * Callback to start the animation for the front {@link TaskView} if there is no launch
- * target.
- */
- void onStartFrontTaskEnterAnimation(boolean screenPinningEnabled);
- }
-
- private static final int DOUBLE_FRAME_OFFSET_MS = 33;
- private static final int FRAME_OFFSET_MS = 16;
-
- private static final int ENTER_EXIT_NUM_ANIMATING_TASKS = 5;
-
- private static final int ENTER_FROM_HOME_ALPHA_DURATION = 100;
- public static final int ENTER_FROM_HOME_TRANSLATION_DURATION = 300;
- private static final Interpolator ENTER_FROM_HOME_ALPHA_INTERPOLATOR = Interpolators.LINEAR;
-
- public static final int EXIT_TO_HOME_TRANSLATION_DURATION = 200;
- private static final Interpolator EXIT_TO_HOME_TRANSLATION_INTERPOLATOR =
- new PathInterpolator(0.4f, 0, 0.6f, 1f);
-
- private static final int DISMISS_TASK_DURATION = 175;
- private static final int DISMISS_ALL_TASKS_DURATION = 200;
- private static final Interpolator DISMISS_ALL_TRANSLATION_INTERPOLATOR =
- new PathInterpolator(0.4f, 0, 1f, 1f);
-
- private static final Interpolator FOCUS_NEXT_TASK_INTERPOLATOR =
- new PathInterpolator(0.4f, 0, 0, 1f);
- private static final Interpolator FOCUS_IN_FRONT_NEXT_TASK_INTERPOLATOR =
- new PathInterpolator(0, 0, 0, 1f);
- private static final Interpolator FOCUS_BEHIND_NEXT_TASK_INTERPOLATOR =
- Interpolators.LINEAR_OUT_SLOW_IN;
-
- private static final Interpolator ENTER_WHILE_DOCKING_INTERPOLATOR =
- Interpolators.LINEAR_OUT_SLOW_IN;
-
- private final int mEnterAndExitFromHomeTranslationOffset;
- private TaskStackView mStackView;
-
- private TaskViewTransform mTmpTransform = new TaskViewTransform();
- private ArrayList<TaskViewTransform> mTmpCurrentTaskTransforms = new ArrayList<>();
- private ArrayList<TaskViewTransform> mTmpFinalTaskTransforms = new ArrayList<>();
-
- public TaskStackAnimationHelper(Context context, TaskStackView stackView) {
- mStackView = stackView;
- mEnterAndExitFromHomeTranslationOffset = LegacyRecentsImpl.getConfiguration().isGridEnabled
- ? 0 : DOUBLE_FRAME_OFFSET_MS;
- }
-
- /**
- * Prepares the stack views and puts them in their initial animation state while visible, before
- * the in-app enter animations start (after the window-transition completes).
- */
- public void prepareForEnterAnimation() {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- Resources res = mStackView.getResources();
- Resources appResources = mStackView.getContext().getApplicationContext().getResources();
-
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
- TaskStackViewScroller stackScroller = mStackView.getScroller();
- TaskStack stack = mStackView.getStack();
- Task launchTargetTask = stack.getLaunchTarget();
-
- // Break early if there are no tasks
- if (stack.getTaskCount() == 0) {
- return;
- }
-
- int offscreenYOffset = stackLayout.mStackRect.height();
- int taskViewAffiliateGroupEnterOffset = res.getDimensionPixelSize(
- R.dimen.recents_task_stack_animation_affiliate_enter_offset);
- int launchedWhileDockingOffset = res.getDimensionPixelSize(
- R.dimen.recents_task_stack_animation_launched_while_docking_offset);
- boolean isLandscape = appResources.getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE;
-
- float top = 0;
- final boolean isLowRamDevice = LegacyRecentsImpl.getConfiguration().isLowRamDevice;
- if (isLowRamDevice && launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
- stackLayout.getStackTransform(launchTargetTask, stackScroller.getStackScroll(),
- mTmpTransform, null /* frontTransform */);
- top = mTmpTransform.rect.top;
- }
-
- // Prepare each of the task views for their enter animation from front to back
- List<TaskView> taskViews = mStackView.getTaskViews();
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- // Get the current transform for the task, which will be used to position it offscreen
- stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform,
- null);
-
- if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
- if (task.isLaunchTarget) {
- tv.onPrepareLaunchTargetForEnterAnimation();
- } else if (isLowRamDevice && i >= taskViews.size() -
- (TaskStackLowRamLayoutAlgorithm.MAX_LAYOUT_TASK_COUNT + 1)
- && !RecentsDebugFlags.Static.DisableRecentsLowRamEnterExitAnimation) {
- // Move the last 2nd and 3rd last tasks in-app animation to match the motion of
- // the last task's app transition
- stackLayout.getStackTransform(task, stackScroller.getStackScroll(),
- mTmpTransform, null);
- mTmpTransform.rect.offset(0, -top);
- mTmpTransform.alpha = 0f;
- mStackView.updateTaskViewToTransform(tv, mTmpTransform,
- AnimationProps.IMMEDIATE);
- stackLayout.getStackTransform(task, stackScroller.getStackScroll(),
- mTmpTransform, null);
- mTmpTransform.alpha = 1f;
- // Duration see {@link
- // com.android.server.wm.AppTransition#DEFAULT_APP_TRANSITION_DURATION}
- mStackView.updateTaskViewToTransform(tv, mTmpTransform,
- new AnimationProps(336, Interpolators.FAST_OUT_SLOW_IN));
- }
- } else if (launchState.launchedFromHome) {
- if (isLowRamDevice) {
- mTmpTransform.rect.offset(0, stackLayout.getTaskRect().height() / 4);
- } else {
- // Move the task view off screen (below) so we can animate it in
- mTmpTransform.rect.offset(0, offscreenYOffset);
- }
- mTmpTransform.alpha = 0f;
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
- } else if (launchState.launchedViaDockGesture) {
- int offset = isLandscape
- ? launchedWhileDockingOffset
- : (int) (offscreenYOffset * 0.9f);
- mTmpTransform.rect.offset(0, offset);
- mTmpTransform.alpha = 0f;
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
- }
- }
- }
-
- /**
- * Starts the in-app enter animation, which animates the {@link TaskView}s to their final places
- * depending on how Recents was triggered.
- */
- public void startEnterAnimation(final ReferenceCountedTrigger postAnimationTrigger) {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- Resources res = mStackView.getResources();
- Resources appRes = mStackView.getContext().getApplicationContext().getResources();
-
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
- TaskStackViewScroller stackScroller = mStackView.getScroller();
- TaskStack stack = mStackView.getStack();
- Task launchTargetTask = stack.getLaunchTarget();
-
- // Break early if there are no tasks
- if (stack.getTaskCount() == 0) {
- return;
- }
-
- final boolean isLowRamDevice = LegacyRecentsImpl.getConfiguration().isLowRamDevice;
- int taskViewEnterFromAppDuration = res.getInteger(
- R.integer.recents_task_enter_from_app_duration);
- int taskViewEnterFromAffiliatedAppDuration = res.getInteger(
- R.integer.recents_task_enter_from_affiliated_app_duration);
- int dockGestureAnimDuration = appRes.getInteger(
- R.integer.long_press_dock_anim_duration);
-
- // Since low ram devices have an animation when entering app -> recents, do not allow
- // toggle until the animation is complete
- if (launchState.launchedFromApp && !launchState.launchedViaDockGesture && isLowRamDevice) {
- postAnimationTrigger.addLastDecrementRunnable(() -> EventBus.getDefault()
- .send(new SetWaitingForTransitionStartEvent(false)));
- }
-
- // Create enter animations for each of the views from front to back
- List<TaskView> taskViews = mStackView.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = taskViewCount - 1; i >= 0; i--) {
- int taskIndexFromFront = taskViewCount - i - 1;
- int taskIndexFromBack = i;
- final TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- // Get the current transform for the task, which will be updated to the final transform
- // to animate to depending on how recents was invoked
- stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform,
- null);
-
- if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
- if (task.isLaunchTarget) {
- tv.onStartLaunchTargetEnterAnimation(mTmpTransform,
- taskViewEnterFromAppDuration, mStackView.mScreenPinningEnabled,
- postAnimationTrigger);
- }
-
- } else if (launchState.launchedFromHome) {
- // Animate the tasks up, but offset the animations to be relative to the front-most
- // task animation
- final float startOffsetFraction = (float) (Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS,
- taskIndexFromFront) * mEnterAndExitFromHomeTranslationOffset) /
- ENTER_FROM_HOME_TRANSLATION_DURATION;
- AnimationProps taskAnimation = new AnimationProps()
- .setInterpolator(AnimationProps.ALPHA, ENTER_FROM_HOME_ALPHA_INTERPOLATOR)
- .setListener(postAnimationTrigger.decrementOnAnimationEnd());
- if (isLowRamDevice) {
- taskAnimation.setInterpolator(AnimationProps.BOUNDS,
- Interpolators.FAST_OUT_SLOW_IN)
- .setDuration(AnimationProps.BOUNDS, 150)
- .setDuration(AnimationProps.ALPHA, 150);
- } else {
- taskAnimation.setStartDelay(AnimationProps.ALPHA,
- Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS, taskIndexFromFront) *
- FRAME_OFFSET_MS)
- .setInterpolator(AnimationProps.BOUNDS,
- new RecentsEntrancePathInterpolator(0f, 0f, 0.2f, 1f,
- startOffsetFraction))
- .setDuration(AnimationProps.BOUNDS, ENTER_FROM_HOME_TRANSLATION_DURATION)
- .setDuration(AnimationProps.ALPHA, ENTER_FROM_HOME_ALPHA_DURATION);
- }
- postAnimationTrigger.increment();
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
- if (i == taskViewCount - 1) {
- tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled);
- }
- } else if (launchState.launchedViaDockGesture) {
- // Animate the tasks up - add some delay to match the divider animation
- AnimationProps taskAnimation = new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, dockGestureAnimDuration +
- (taskIndexFromBack * DOUBLE_FRAME_OFFSET_MS))
- .setInterpolator(AnimationProps.BOUNDS,
- ENTER_WHILE_DOCKING_INTERPOLATOR)
- .setStartDelay(AnimationProps.BOUNDS, 48)
- .setListener(postAnimationTrigger.decrementOnAnimationEnd());
- postAnimationTrigger.increment();
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
- }
- }
- }
-
- /**
- * Starts an in-app animation to hide all the task views so that we can transition back home.
- */
- public void startExitToHomeAnimation(boolean animated,
- ReferenceCountedTrigger postAnimationTrigger) {
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
- TaskStack stack = mStackView.getStack();
-
- // Break early if there are no tasks
- if (stack.getTaskCount() == 0) {
- return;
- }
-
- int offscreenYOffset = stackLayout.mStackRect.height();
-
- // Create the animations for each of the tasks
- List<TaskView> taskViews = mStackView.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- int taskIndexFromFront = taskViewCount - i - 1;
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (mStackView.isIgnoredTask(task)) {
- continue;
- }
-
- // Animate the tasks down
- AnimationProps taskAnimation;
- if (animated) {
- int delay = Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS , taskIndexFromFront) *
- mEnterAndExitFromHomeTranslationOffset;
- taskAnimation = new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, EXIT_TO_HOME_TRANSLATION_DURATION)
- .setListener(postAnimationTrigger.decrementOnAnimationEnd());
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- taskAnimation.setInterpolator(AnimationProps.BOUNDS,
- Interpolators.FAST_OUT_SLOW_IN);
- } else {
- taskAnimation.setStartDelay(AnimationProps.BOUNDS, delay)
- .setInterpolator(AnimationProps.BOUNDS,
- EXIT_TO_HOME_TRANSLATION_INTERPOLATOR);
- }
- postAnimationTrigger.increment();
- } else {
- taskAnimation = AnimationProps.IMMEDIATE;
- }
-
- mTmpTransform.fillIn(tv);
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- taskAnimation.setInterpolator(AnimationProps.ALPHA,
- EXIT_TO_HOME_TRANSLATION_INTERPOLATOR)
- .setDuration(AnimationProps.ALPHA, EXIT_TO_HOME_TRANSLATION_DURATION);
- mTmpTransform.rect.offset(0, stackLayout.mTaskStackLowRamLayoutAlgorithm
- .getTaskRect().height() / 4);
- mTmpTransform.alpha = 0f;
- } else {
- mTmpTransform.rect.offset(0, offscreenYOffset);
- }
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
- }
- }
-
- /**
- * Starts the animation for the launching task view, hiding any tasks that might occlude the
- * window transition for the launching task.
- */
- public void startLaunchTaskAnimation(TaskView launchingTaskView, boolean screenPinningRequested,
- final ReferenceCountedTrigger postAnimationTrigger) {
- Resources res = mStackView.getResources();
-
- int taskViewExitToAppDuration = res.getInteger(
- R.integer.recents_task_exit_to_app_duration);
- int taskViewAffiliateGroupEnterOffset = res.getDimensionPixelSize(
- R.dimen.recents_task_stack_animation_affiliate_enter_offset);
-
- Task launchingTask = launchingTaskView.getTask();
- List<TaskView> taskViews = mStackView.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (tv == launchingTaskView) {
- tv.setClipViewInStack(false);
- postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
- @Override
- public void run() {
- tv.setClipViewInStack(true);
- }
- });
- tv.onStartLaunchTargetLaunchAnimation(taskViewExitToAppDuration,
- screenPinningRequested, postAnimationTrigger);
- }
- }
- }
-
- /**
- * Starts the delete animation for the specified {@link TaskView}.
- */
- public void startDeleteTaskAnimation(final TaskView deleteTaskView, boolean gridLayout,
- final ReferenceCountedTrigger postAnimationTrigger) {
- if (gridLayout) {
- startTaskGridDeleteTaskAnimation(deleteTaskView, postAnimationTrigger);
- } else {
- startTaskStackDeleteTaskAnimation(deleteTaskView, postAnimationTrigger);
- }
- }
-
- /**
- * Starts the delete animation for all the {@link TaskView}s.
- */
- public void startDeleteAllTasksAnimation(final List<TaskView> taskViews, boolean gridLayout,
- final ReferenceCountedTrigger postAnimationTrigger) {
- if (gridLayout) {
- for (int i = 0; i < taskViews.size(); i++) {
- startTaskGridDeleteTaskAnimation(taskViews.get(i), postAnimationTrigger);
- }
- } else {
- startTaskStackDeleteAllTasksAnimation(taskViews, postAnimationTrigger);
- }
- }
-
- /**
- * Starts the animation to focus the next {@link TaskView} when paging through recents.
- *
- * @return whether or not this will trigger a scroll in the stack
- */
- public boolean startScrollToFocusedTaskAnimation(Task newFocusedTask,
- boolean requestViewFocus) {
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
- TaskStackViewScroller stackScroller = mStackView.getScroller();
- TaskStack stack = mStackView.getStack();
-
- final float curScroll = stackScroller.getStackScroll();
- final float newScroll = stackScroller.getBoundedStackScroll(
- stackLayout.getStackScrollForTask(newFocusedTask));
- boolean willScrollToFront = newScroll > curScroll;
- boolean willScroll = Float.compare(newScroll, curScroll) != 0;
-
- // Get the current set of task transforms
- int taskViewCount = mStackView.getTaskViews().size();
- ArrayList<Task> stackTasks = stack.getTasks();
- mStackView.getCurrentTaskTransforms(stackTasks, mTmpCurrentTaskTransforms);
-
- // Pick up the newly visible views after the scroll
- mStackView.bindVisibleTaskViews(newScroll);
-
- // Update the internal state
- stackLayout.setFocusState(TaskStackLayoutAlgorithm.STATE_FOCUSED);
- stackScroller.setStackScroll(newScroll, null /* animation */);
- mStackView.cancelDeferredTaskViewLayoutAnimation();
-
- // Get the final set of task transforms
- mStackView.getLayoutTaskTransforms(newScroll, stackLayout.getFocusState(), stackTasks,
- true /* ignoreTaskOverrides */, mTmpFinalTaskTransforms);
-
- // Focus the task view
- TaskView newFocusedTaskView = mStackView.getChildViewForTask(newFocusedTask);
- if (newFocusedTaskView == null) {
- // Log the error if we have no task view, and skip the animation
- Log.e("TaskStackAnimationHelper", "b/27389156 null-task-view prebind:" + taskViewCount +
- " postbind:" + mStackView.getTaskViews().size() + " prescroll:" + curScroll +
- " postscroll: " + newScroll);
- return false;
- }
- newFocusedTaskView.setFocusedState(true, requestViewFocus);
-
- // Setup the end listener to return all the hidden views to the view pool after the
- // focus animation
- ReferenceCountedTrigger postAnimTrigger = new ReferenceCountedTrigger();
- postAnimTrigger.addLastDecrementRunnable(new Runnable() {
- @Override
- public void run() {
- mStackView.bindVisibleTaskViews(newScroll);
- }
- });
-
- List<TaskView> taskViews = mStackView.getTaskViews();
- taskViewCount = taskViews.size();
- int newFocusTaskViewIndex = taskViews.indexOf(newFocusedTaskView);
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (mStackView.isIgnoredTask(task)) {
- continue;
- }
-
- int taskIndex = stackTasks.indexOf(task);
- TaskViewTransform fromTransform = mTmpCurrentTaskTransforms.get(taskIndex);
- TaskViewTransform toTransform = mTmpFinalTaskTransforms.get(taskIndex);
-
- // Update the task to the initial state (for the newly picked up tasks)
- mStackView.updateTaskViewToTransform(tv, fromTransform, AnimationProps.IMMEDIATE);
-
- int duration;
- Interpolator interpolator;
- if (willScrollToFront) {
- duration = calculateStaggeredAnimDuration(i);
- interpolator = FOCUS_BEHIND_NEXT_TASK_INTERPOLATOR;
- } else {
- if (i < newFocusTaskViewIndex) {
- duration = 150 + ((newFocusTaskViewIndex - i - 1) * 50);
- interpolator = FOCUS_BEHIND_NEXT_TASK_INTERPOLATOR;
- } else if (i > newFocusTaskViewIndex) {
- duration = Math.max(100, 150 - ((i - newFocusTaskViewIndex - 1) * 50));
- interpolator = FOCUS_IN_FRONT_NEXT_TASK_INTERPOLATOR;
- } else {
- duration = 200;
- interpolator = FOCUS_NEXT_TASK_INTERPOLATOR;
- }
- }
-
- AnimationProps anim = new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, duration)
- .setInterpolator(AnimationProps.BOUNDS, interpolator)
- .setListener(postAnimTrigger.decrementOnAnimationEnd());
- postAnimTrigger.increment();
- mStackView.updateTaskViewToTransform(tv, toTransform, anim);
- }
- return willScroll;
- }
-
- /**
- * Starts the animation to go to the initial stack layout with a task focused. In addition, the
- * previous task will be animated in after the scroll completes.
- */
- public void startNewStackScrollAnimation(TaskStack newStack,
- ReferenceCountedTrigger animationTrigger) {
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
- TaskStackViewScroller stackScroller = mStackView.getScroller();
-
- // Get the current set of task transforms
- ArrayList<Task> stackTasks = newStack.getTasks();
- mStackView.getCurrentTaskTransforms(stackTasks, mTmpCurrentTaskTransforms);
-
- // Update the stack
- mStackView.setTasks(newStack, false /* allowNotifyStackChanges */);
- mStackView.updateLayoutAlgorithm(false /* boundScroll */);
-
- // Pick up the newly visible views after the scroll
- final float newScroll = stackLayout.mInitialScrollP;
- mStackView.bindVisibleTaskViews(newScroll);
-
- // Update the internal state
- stackLayout.setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
- stackLayout.setTaskOverridesForInitialState(newStack, true /* ignoreScrollToFront */);
- stackScroller.setStackScroll(newScroll);
- mStackView.cancelDeferredTaskViewLayoutAnimation();
-
- // Get the final set of task transforms
- mStackView.getLayoutTaskTransforms(newScroll, stackLayout.getFocusState(), stackTasks,
- false /* ignoreTaskOverrides */, mTmpFinalTaskTransforms);
-
- // Hide the front most task view until the scroll is complete
- Task frontMostTask = newStack.getFrontMostTask();
- final TaskView frontMostTaskView = mStackView.getChildViewForTask(frontMostTask);
- final TaskViewTransform frontMostTransform = mTmpFinalTaskTransforms.get(
- stackTasks.indexOf(frontMostTask));
- if (frontMostTaskView != null) {
- mStackView.updateTaskViewToTransform(frontMostTaskView,
- stackLayout.getFrontOfStackTransform(), AnimationProps.IMMEDIATE);
- }
-
- // Setup the end listener to return all the hidden views to the view pool after the
- // focus animation
- animationTrigger.addLastDecrementRunnable(new Runnable() {
- @Override
- public void run() {
- mStackView.bindVisibleTaskViews(newScroll);
-
- // Now, animate in the front-most task
- if (frontMostTaskView != null) {
- mStackView.updateTaskViewToTransform(frontMostTaskView, frontMostTransform,
- new AnimationProps(75, 250, FOCUS_BEHIND_NEXT_TASK_INTERPOLATOR));
- }
- }
- });
-
- List<TaskView> taskViews = mStackView.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (mStackView.isIgnoredTask(task)) {
- continue;
- }
- if (task == frontMostTask && frontMostTaskView != null) {
- continue;
- }
-
- int taskIndex = stackTasks.indexOf(task);
- TaskViewTransform fromTransform = mTmpCurrentTaskTransforms.get(taskIndex);
- TaskViewTransform toTransform = mTmpFinalTaskTransforms.get(taskIndex);
-
- // Update the task to the initial state (for the newly picked up tasks)
- mStackView.updateTaskViewToTransform(tv, fromTransform, AnimationProps.IMMEDIATE);
-
- int duration = calculateStaggeredAnimDuration(i);
- Interpolator interpolator = FOCUS_BEHIND_NEXT_TASK_INTERPOLATOR;
-
- AnimationProps anim = new AnimationProps()
- .setDuration(AnimationProps.BOUNDS, duration)
- .setInterpolator(AnimationProps.BOUNDS, interpolator)
- .setListener(animationTrigger.decrementOnAnimationEnd());
- animationTrigger.increment();
- mStackView.updateTaskViewToTransform(tv, toTransform, anim);
- }
- }
-
- /**
- * Caclulates a staggered duration for {@link #startScrollToFocusedTaskAnimation} and
- * {@link #startNewStackScrollAnimation}.
- */
- private int calculateStaggeredAnimDuration(int i) {
- return Math.max(100, 100 + ((i - 1) * 50));
- }
-
- private void startTaskGridDeleteTaskAnimation(final TaskView deleteTaskView,
- final ReferenceCountedTrigger postAnimationTrigger) {
- postAnimationTrigger.increment();
- postAnimationTrigger.addLastDecrementRunnable(() -> {
- mStackView.getTouchHandler().onChildDismissed(deleteTaskView);
- });
- deleteTaskView.animate().setDuration(300).scaleX(0.9f).scaleY(0.9f).alpha(0).setListener(
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- postAnimationTrigger.decrement();
- }}).start();
- }
-
- private void startTaskStackDeleteTaskAnimation(final TaskView deleteTaskView,
- final ReferenceCountedTrigger postAnimationTrigger) {
- TaskStackViewTouchHandler touchHandler = mStackView.getTouchHandler();
- touchHandler.onBeginManualDrag(deleteTaskView);
-
- postAnimationTrigger.increment();
- postAnimationTrigger.addLastDecrementRunnable(() -> {
- touchHandler.onChildDismissed(deleteTaskView);
- });
-
- final float dismissSize = touchHandler.getScaledDismissSize();
- ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
- animator.setDuration(400);
- animator.addUpdateListener((animation) -> {
- float progress = (Float) animation.getAnimatedValue();
- deleteTaskView.setTranslationX(progress * dismissSize);
- touchHandler.updateSwipeProgress(deleteTaskView, true, progress);
- });
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- postAnimationTrigger.decrement();
- }
- });
- animator.start();
- }
-
- private void startTaskStackDeleteAllTasksAnimation(final List<TaskView> taskViews,
- final ReferenceCountedTrigger postAnimationTrigger) {
- TaskStackLayoutAlgorithm stackLayout = mStackView.getStackAlgorithm();
-
- int offscreenXOffset = mStackView.getMeasuredWidth() - stackLayout.getTaskRect().left;
-
- int taskViewCount = taskViews.size();
- for (int i = taskViewCount - 1; i >= 0; i--) {
- TaskView tv = taskViews.get(i);
- int taskIndexFromFront = taskViewCount - i - 1;
- int startDelay = taskIndexFromFront * DOUBLE_FRAME_OFFSET_MS;
-
- // Disabling clipping with the stack while the view is animating away
- tv.setClipViewInStack(false);
-
- // Compose the new animation and transform and star the animation
- AnimationProps taskAnimation = new AnimationProps(startDelay,
- DISMISS_ALL_TASKS_DURATION, DISMISS_ALL_TRANSLATION_INTERPOLATOR,
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- postAnimationTrigger.decrement();
-
- // Re-enable clipping with the stack (we will reuse this view)
- tv.setClipViewInStack(true);
- }
- });
- postAnimationTrigger.increment();
-
- mTmpTransform.fillIn(tv);
- mTmpTransform.rect.offset(offscreenXOffset, 0);
- mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
deleted file mode 100644
index 58a3f12..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ /dev/null
@@ -1,1283 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.annotation.IntDef;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Path;
-import android.graphics.Rect;
-import android.util.ArraySet;
-import android.util.Log;
-import android.util.SparseArray;
-import android.util.SparseIntArray;
-import android.view.ViewDebug;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivityLaunchState;
-import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.RecentsDebugFlags;
-import com.android.systemui.recents.misc.FreePathInterpolator;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.views.lowram.TaskStackLowRamLayoutAlgorithm;
-import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm;
-
-import java.io.PrintWriter;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Used to describe a visible range that can be normalized to [0, 1].
- */
-class Range {
- final float relativeMin;
- final float relativeMax;
- float origin;
- float min;
- float max;
-
- public Range(float relMin, float relMax) {
- min = relativeMin = relMin;
- max = relativeMax = relMax;
- }
-
- /**
- * Offsets this range to a given absolute position.
- */
- public void offset(float x) {
- this.origin = x;
- min = x + relativeMin;
- max = x + relativeMax;
- }
-
- /**
- * Returns x normalized to the range 0 to 1 such that 0 = min, 0.5 = origin and 1 = max
- *
- * @param x is an absolute value in the same domain as origin
- */
- public float getNormalizedX(float x) {
- if (x < origin) {
- return 0.5f + 0.5f * (x - origin) / -relativeMin;
- } else {
- return 0.5f + 0.5f * (x - origin) / relativeMax;
- }
- }
-
- /**
- * Given a normalized {@param x} value in this range, projected onto the full range to get an
- * absolute value about the given {@param origin}.
- */
- public float getAbsoluteX(float normX) {
- if (normX < 0.5f) {
- return (normX - 0.5f) / 0.5f * -relativeMin;
- } else {
- return (normX - 0.5f) / 0.5f * relativeMax;
- }
- }
-
- /**
- * Returns whether a value at an absolute x would be within range.
- */
- public boolean isInRange(float absX) {
- return (absX >= Math.floor(min)) && (absX <= Math.ceil(max));
- }
-}
-
-/**
- * The layout logic for a TaskStackView. This layout needs to be able to calculate the stack layout
- * without an activity-specific context only with the information passed in. This layout can have
- * two states focused and unfocused, and in the focused state, there is a task that is displayed
- * more prominently in the stack.
- */
-public class TaskStackLayoutAlgorithm {
-
- private static final String TAG = "TaskStackLayoutAlgorithm";
-
- // The distribution of view bounds alpha
- // XXX: This is a hack because you can currently set the max alpha to be > 1f
- public static final float OUTLINE_ALPHA_MIN_VALUE = 0f;
- public static final float OUTLINE_ALPHA_MAX_VALUE = 2f;
-
- // The medium/maximum dim on the tasks
- private static final float MED_DIM = 0.15f;
- private static final float MAX_DIM = 0.25f;
-
- // The various focus states
- public static final int STATE_FOCUSED = 1;
- public static final int STATE_UNFOCUSED = 0;
-
- // The side that an offset is anchored
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({FROM_TOP, FROM_BOTTOM})
- public @interface AnchorSide {}
- private static final int FROM_TOP = 0;
- private static final int FROM_BOTTOM = 1;
-
- // The extent that we care about when calculating fractions
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({WIDTH, HEIGHT})
- public @interface Extent {}
- private static final int WIDTH = 0;
- private static final int HEIGHT = 1;
-
- public interface TaskStackLayoutAlgorithmCallbacks {
- void onFocusStateChanged(int prevFocusState, int curFocusState);
- }
-
- /**
- * @return True if we should use the grid layout.
- */
- boolean useGridLayout() {
- return LegacyRecentsImpl.getConfiguration().isGridEnabled;
- }
-
- // A report of the visibility state of the stack
- public static class VisibilityReport {
- public int numVisibleTasks;
- public int numVisibleThumbnails;
-
- public VisibilityReport(int tasks, int thumbnails) {
- numVisibleTasks = tasks;
- numVisibleThumbnails = thumbnails;
- }
- }
-
- Context mContext;
- private TaskStackLayoutAlgorithmCallbacks mCb;
-
- // The task bounds (untransformed) for layout. This rect is anchored at mTaskRoot.
- @ViewDebug.ExportedProperty(category="recents")
- public Rect mTaskRect = new Rect();
- // The stack bounds, inset from the top system insets, and runs to the bottom of the screen
- @ViewDebug.ExportedProperty(category="recents")
- public Rect mStackRect = new Rect();
- // This is the current system insets
- @ViewDebug.ExportedProperty(category="recents")
- public Rect mSystemInsets = new Rect();
-
- // The visible ranges when the stack is focused and unfocused
- private Range mUnfocusedRange;
- private Range mFocusedRange;
-
- // This is the bounds of the stack action above the stack rect
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mStackActionButtonRect = new Rect();
- // The base top margin for the stack from the system insets
- @ViewDebug.ExportedProperty(category="recents")
- private int mBaseTopMargin;
- // The base side margin for the stack from the system insets
- @ViewDebug.ExportedProperty(category="recents")
- private int mBaseSideMargin;
- // The base bottom margin for the stack from the system insets
- @ViewDebug.ExportedProperty(category="recents")
- private int mBaseBottomMargin;
- private int mMinMargin;
-
- // The initial offset that the focused task is from the top
- @ViewDebug.ExportedProperty(category="recents")
- private int mInitialTopOffset;
- private int mBaseInitialTopOffset;
- // The initial offset that the launch-from task is from the bottom
- @ViewDebug.ExportedProperty(category="recents")
- private int mInitialBottomOffset;
- private int mBaseInitialBottomOffset;
-
- // The height between the top margin and the top of the focused task
- @ViewDebug.ExportedProperty(category="recents")
- private int mFocusedTopPeekHeight;
- // The height between the bottom margin and the top of task in front of the focused task
- @ViewDebug.ExportedProperty(category="recents")
- private int mFocusedBottomPeekHeight;
-
- // The offset from the bottom of the stack to the bottom of the bounds when the stack is
- // scrolled to the front
- @ViewDebug.ExportedProperty(category="recents")
- private int mStackBottomOffset;
-
- /** The height, in pixels, of each task view's title bar. */
- private int mTitleBarHeight;
-
- // The paths defining the motion of the tasks when the stack is focused and unfocused
- private Path mUnfocusedCurve;
- private Path mFocusedCurve;
- private FreePathInterpolator mUnfocusedCurveInterpolator;
- private FreePathInterpolator mFocusedCurveInterpolator;
-
- // The paths defining the distribution of the dim to apply to tasks in the stack when focused
- // and unfocused
- private Path mUnfocusedDimCurve;
- private Path mFocusedDimCurve;
- private FreePathInterpolator mUnfocusedDimCurveInterpolator;
- private FreePathInterpolator mFocusedDimCurveInterpolator;
-
- // The state of the stack focus (0..1), which controls the transition of the stack from the
- // focused to non-focused state
- @ViewDebug.ExportedProperty(category="recents")
- private int mFocusState;
-
- // The smallest scroll progress, at this value, the back most task will be visible
- @ViewDebug.ExportedProperty(category="recents")
- float mMinScrollP;
- // The largest scroll progress, at this value, the front most task will be visible above the
- // navigation bar
- @ViewDebug.ExportedProperty(category="recents")
- float mMaxScrollP;
- // The initial progress that the scroller is set when you first enter recents
- @ViewDebug.ExportedProperty(category="recents")
- float mInitialScrollP;
- // The task progress for the front-most task in the stack
- @ViewDebug.ExportedProperty(category="recents")
- float mFrontMostTaskP;
-
- // The last computed task counts
- @ViewDebug.ExportedProperty(category="recents")
- int mNumStackTasks;
-
- // The min/max z translations
- @ViewDebug.ExportedProperty(category="recents")
- int mMinTranslationZ;
- @ViewDebug.ExportedProperty(category="recents")
- public int mMaxTranslationZ;
-
- // Optimization, allows for quick lookup of task -> index
- private SparseIntArray mTaskIndexMap = new SparseIntArray();
- private SparseArray<Float> mTaskIndexOverrideMap = new SparseArray<>();
-
- TaskGridLayoutAlgorithm mTaskGridLayoutAlgorithm;
- TaskStackLowRamLayoutAlgorithm mTaskStackLowRamLayoutAlgorithm;
-
- // The transform to place TaskViews at the front and back of the stack respectively
- TaskViewTransform mBackOfStackTransform = new TaskViewTransform();
- TaskViewTransform mFrontOfStackTransform = new TaskViewTransform();
-
- public TaskStackLayoutAlgorithm(Context context, TaskStackLayoutAlgorithmCallbacks cb) {
- mContext = context;
- mCb = cb;
- mTaskGridLayoutAlgorithm = new TaskGridLayoutAlgorithm(context);
- mTaskStackLowRamLayoutAlgorithm = new TaskStackLowRamLayoutAlgorithm(context);
- reloadOnConfigurationChange(context);
- }
-
- /**
- * Reloads the layout for the current configuration.
- */
- public void reloadOnConfigurationChange(Context context) {
- Resources res = context.getResources();
- mFocusedRange = new Range(res.getFloat(R.integer.recents_layout_focused_range_min),
- res.getFloat(R.integer.recents_layout_focused_range_max));
- mUnfocusedRange = new Range(res.getFloat(R.integer.recents_layout_unfocused_range_min),
- res.getFloat(R.integer.recents_layout_unfocused_range_max));
- mFocusState = getInitialFocusState();
- mFocusedTopPeekHeight = res.getDimensionPixelSize(R.dimen.recents_layout_top_peek_size);
- mFocusedBottomPeekHeight =
- res.getDimensionPixelSize(R.dimen.recents_layout_bottom_peek_size);
- mMinTranslationZ = res.getDimensionPixelSize(R.dimen.recents_layout_z_min);
- mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_layout_z_max);
- mBaseInitialTopOffset = getDimensionForDevice(context,
- R.dimen.recents_layout_initial_top_offset_phone_port,
- R.dimen.recents_layout_initial_top_offset_phone_land,
- R.dimen.recents_layout_initial_top_offset_tablet,
- R.dimen.recents_layout_initial_top_offset_tablet,
- R.dimen.recents_layout_initial_top_offset_tablet,
- R.dimen.recents_layout_initial_top_offset_tablet,
- R.dimen.recents_layout_initial_top_offset_tablet);
- mBaseInitialBottomOffset = getDimensionForDevice(context,
- R.dimen.recents_layout_initial_bottom_offset_phone_port,
- R.dimen.recents_layout_initial_bottom_offset_phone_land,
- R.dimen.recents_layout_initial_bottom_offset_tablet,
- R.dimen.recents_layout_initial_bottom_offset_tablet,
- R.dimen.recents_layout_initial_bottom_offset_tablet,
- R.dimen.recents_layout_initial_bottom_offset_tablet,
- R.dimen.recents_layout_initial_bottom_offset_tablet);
- mTaskGridLayoutAlgorithm.reloadOnConfigurationChange(context);
- mTaskStackLowRamLayoutAlgorithm.reloadOnConfigurationChange(context);
- mMinMargin = res.getDimensionPixelSize(R.dimen.recents_layout_min_margin);
- mBaseTopMargin = getDimensionForDevice(context,
- R.dimen.recents_layout_top_margin_phone,
- R.dimen.recents_layout_top_margin_tablet,
- R.dimen.recents_layout_top_margin_tablet_xlarge,
- R.dimen.recents_layout_top_margin_tablet);
- mBaseSideMargin = getDimensionForDevice(context,
- R.dimen.recents_layout_side_margin_phone,
- R.dimen.recents_layout_side_margin_tablet,
- R.dimen.recents_layout_side_margin_tablet_xlarge,
- R.dimen.recents_layout_side_margin_tablet);
- mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin);
- mTitleBarHeight = getDimensionForDevice(mContext,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_grid_task_view_header_height);
- }
-
- /**
- * Resets this layout when the stack view is reset.
- */
- public void reset() {
- mTaskIndexOverrideMap.clear();
- setFocusState(getInitialFocusState());
- }
-
- /**
- * Sets the system insets.
- */
- public boolean setSystemInsets(Rect systemInsets) {
- boolean changed = !mSystemInsets.equals(systemInsets);
- mSystemInsets.set(systemInsets);
- mTaskGridLayoutAlgorithm.setSystemInsets(systemInsets);
- mTaskStackLowRamLayoutAlgorithm.setSystemInsets(systemInsets);
- return changed;
- }
-
- /**
- * Sets the focused state.
- */
- public void setFocusState(int focusState) {
- int prevFocusState = mFocusState;
- mFocusState = focusState;
- updateFrontBackTransforms();
- if (mCb != null) {
- mCb.onFocusStateChanged(prevFocusState, focusState);
- }
- }
-
- /**
- * Gets the focused state.
- */
- public int getFocusState() {
- return mFocusState;
- }
-
- /**
- * Computes the stack and task rects. The given task stack bounds already has the top/right
- * insets and left/right padding already applied.
- */
- public void initialize(Rect displayRect, Rect windowRect, Rect taskStackBounds) {
- Rect lastStackRect = new Rect(mStackRect);
-
- int topMargin = getScaleForExtent(windowRect, displayRect, mBaseTopMargin, mMinMargin, HEIGHT);
- int bottomMargin = getScaleForExtent(windowRect, displayRect, mBaseBottomMargin, mMinMargin,
- HEIGHT);
- mInitialTopOffset = getScaleForExtent(windowRect, displayRect, mBaseInitialTopOffset,
- mMinMargin, HEIGHT);
- mInitialBottomOffset = mBaseInitialBottomOffset;
-
- // Compute the stack bounds
- mStackBottomOffset = mSystemInsets.bottom + bottomMargin;
- mStackRect.set(taskStackBounds);
- mStackRect.top += topMargin;
-
- // The stack action button will take the full un-padded header space above the stack
- mStackActionButtonRect.set(mStackRect.left, mStackRect.top - topMargin,
- mStackRect.right, mStackRect.top + mFocusedTopPeekHeight);
-
- // Anchor the task rect top aligned to the stack rect
- int height = mStackRect.height() - mInitialTopOffset - mStackBottomOffset;
- mTaskRect.set(mStackRect.left, mStackRect.top, mStackRect.right, mStackRect.top + height);
-
- if (mTaskRect.width() <= 0 || mTaskRect.height() <= 0) {
- // Logging for b/36654830
- Log.e(TAG, "Invalid task rect: taskRect=" + mTaskRect + " stackRect=" + mStackRect
- + " displayRect=" + displayRect + " windowRect=" + windowRect
- + " taskStackBounds=" + taskStackBounds);
- }
-
- // Short circuit here if the stack rects haven't changed so we don't do all the work below
- if (!lastStackRect.equals(mStackRect)) {
- // Reinitialize the focused and unfocused curves
- mUnfocusedCurve = constructUnfocusedCurve();
- mUnfocusedCurveInterpolator = new FreePathInterpolator(mUnfocusedCurve);
- mFocusedCurve = constructFocusedCurve();
- mFocusedCurveInterpolator = new FreePathInterpolator(mFocusedCurve);
- mUnfocusedDimCurve = constructUnfocusedDimCurve();
- mUnfocusedDimCurveInterpolator = new FreePathInterpolator(mUnfocusedDimCurve);
- mFocusedDimCurve = constructFocusedDimCurve();
- mFocusedDimCurveInterpolator = new FreePathInterpolator(mFocusedDimCurve);
-
- updateFrontBackTransforms();
- }
-
- // Initialize the grid layout
- mTaskGridLayoutAlgorithm.initialize(windowRect);
- mTaskStackLowRamLayoutAlgorithm.initialize(windowRect);
- }
-
- /**
- * Computes the minimum and maximum scroll progress values and the progress values for each task
- * in the stack.
- */
- public void update(TaskStack stack, ArraySet<Task.TaskKey> ignoreTasksSet,
- RecentsActivityLaunchState launchState, float lastScrollPPercent) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
-
- // Clear the progress map
- mTaskIndexMap.clear();
-
- // Return early if we have no tasks
- ArrayList<Task> tasks = stack.getTasks();
- if (tasks.isEmpty()) {
- mFrontMostTaskP = 0;
- mMinScrollP = mMaxScrollP = mInitialScrollP = 0;
- mNumStackTasks = 0;
- return;
- }
-
- // Filter the set of stack tasks
- ArrayList<Task> stackTasks = new ArrayList<>();
- for (int i = 0; i < tasks.size(); i++) {
- Task task = tasks.get(i);
- if (ignoreTasksSet.contains(task.key)) {
- continue;
- }
- stackTasks.add(task);
- }
- mNumStackTasks = stackTasks.size();
-
- // Put each of the tasks in the progress map at a fixed index (does not need to actually
- // map to a scroll position, just by index)
- int taskCount = stackTasks.size();
- for (int i = 0; i < taskCount; i++) {
- Task task = stackTasks.get(i);
- mTaskIndexMap.put(task.key.id, i);
- }
-
- // Calculate the min/max/initial scroll
- Task launchTask = stack.getLaunchTarget();
- int launchTaskIndex = launchTask != null
- ? stack.indexOfTask(launchTask)
- : mNumStackTasks - 1;
- if (getInitialFocusState() == STATE_FOCUSED) {
- int maxBottomOffset = mStackBottomOffset + mTaskRect.height();
- float maxBottomNormX = getNormalizedXFromFocusedY(maxBottomOffset, FROM_BOTTOM);
- mFocusedRange.offset(0f);
- mMinScrollP = 0;
- mMaxScrollP = Math.max(mMinScrollP, (mNumStackTasks - 1) -
- Math.max(0, mFocusedRange.getAbsoluteX(maxBottomNormX)));
- if (launchState.launchedFromHome || launchState.launchedFromPipApp
- || launchState.launchedWithNextPipApp) {
- mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
- } else {
- mInitialScrollP = Utilities.clamp(launchTaskIndex - 1, mMinScrollP, mMaxScrollP);
- }
- } else if (mNumStackTasks == 1) {
- // If there is one stack task, ignore the min/max/initial scroll positions
- mMinScrollP = 0;
- mMaxScrollP = 0;
- mInitialScrollP = 0;
- } else {
- // Set the max scroll to be the point where the front most task is visible with the
- // stack bottom offset
- int maxBottomOffset = mStackBottomOffset + mTaskRect.height();
- float maxBottomNormX = getNormalizedXFromUnfocusedY(maxBottomOffset, FROM_BOTTOM);
- mUnfocusedRange.offset(0f);
- mMinScrollP = LegacyRecentsImpl.getConfiguration().isLowRamDevice
- ? mTaskStackLowRamLayoutAlgorithm.getMinScrollP()
- : 0;
- mMaxScrollP = LegacyRecentsImpl.getConfiguration().isLowRamDevice
- ? mTaskStackLowRamLayoutAlgorithm.getMaxScrollP(taskCount)
- : Math.max(mMinScrollP, (mNumStackTasks - 1) -
- Math.max(0, mUnfocusedRange.getAbsoluteX(maxBottomNormX)));
- boolean scrollToFront = launchState.launchedFromHome || launchState.launchedFromPipApp
- || launchState.launchedWithNextPipApp || launchState.launchedViaDockGesture;
-
- if (launchState.launchedWithAltTab) {
- mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
- } else if (0 <= lastScrollPPercent && lastScrollPPercent <= 1) {
- mInitialScrollP = Utilities.mapRange(lastScrollPPercent, mMinScrollP, mMaxScrollP);
- } else if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- mInitialScrollP = mTaskStackLowRamLayoutAlgorithm.getInitialScrollP(mNumStackTasks,
- scrollToFront);
- } else if (scrollToFront) {
- mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
- } else {
- // We are overriding the initial two task positions, so set the initial scroll
- // position to match the second task (aka focused task) position
- float initialTopNormX = getNormalizedXFromUnfocusedY(mInitialTopOffset, FROM_TOP);
- mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP, (mNumStackTasks - 2))
- - Math.max(0, mUnfocusedRange.getAbsoluteX(initialTopNormX)));
- }
- }
- }
-
- /**
- * Creates task overrides to ensure the initial stack layout if necessary.
- */
- public void setTaskOverridesForInitialState(TaskStack stack, boolean ignoreScrollToFront) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
-
- mTaskIndexOverrideMap.clear();
-
- boolean scrollToFront = launchState.launchedFromHome ||
- launchState.launchedFromPipApp ||
- launchState.launchedWithNextPipApp ||
- launchState.launchedViaDockGesture;
- if (getInitialFocusState() == STATE_UNFOCUSED && mNumStackTasks > 1) {
- if (ignoreScrollToFront || (!launchState.launchedWithAltTab && !scrollToFront)) {
- // Set the initial scroll to the predefined state (which differs from the stack)
- float [] initialNormX = null;
- float minBottomTaskNormX = getNormalizedXFromUnfocusedY(mSystemInsets.bottom +
- mInitialBottomOffset, FROM_BOTTOM);
- float maxBottomTaskNormX = getNormalizedXFromUnfocusedY(mFocusedTopPeekHeight +
- mTaskRect.height() - mMinMargin, FROM_TOP);
- if (mNumStackTasks <= 2) {
- // For small stacks, position the tasks so that they are top aligned to under
- // the action button, but ensure that it is at least a certain offset from the
- // bottom of the stack
- initialNormX = new float[] {
- Math.min(maxBottomTaskNormX, minBottomTaskNormX),
- getNormalizedXFromUnfocusedY(mFocusedTopPeekHeight, FROM_TOP)
- };
- } else {
- initialNormX = new float[] {
- minBottomTaskNormX,
- getNormalizedXFromUnfocusedY(mInitialTopOffset, FROM_TOP)
- };
- }
-
- mUnfocusedRange.offset(0f);
- List<Task> tasks = stack.getTasks();
- int taskCount = tasks.size();
- for (int i = taskCount - 1; i >= 0; i--) {
- int indexFromFront = taskCount - i - 1;
- if (indexFromFront >= initialNormX.length) {
- break;
- }
- float newTaskProgress = mInitialScrollP +
- mUnfocusedRange.getAbsoluteX(initialNormX[indexFromFront]);
- mTaskIndexOverrideMap.put(tasks.get(i).key.id, newTaskProgress);
- }
- }
- }
- }
-
- /**
- * Adds and override task progress for the given task when transitioning from focused to
- * unfocused state.
- */
- public void addUnfocusedTaskOverride(Task task, float stackScroll) {
- if (mFocusState != STATE_UNFOCUSED) {
- mFocusedRange.offset(stackScroll);
- mUnfocusedRange.offset(stackScroll);
- float focusedRangeX = mFocusedRange.getNormalizedX(mTaskIndexMap.get(task.key.id));
- float focusedY = mFocusedCurveInterpolator.getInterpolation(focusedRangeX);
- float unfocusedRangeX = mUnfocusedCurveInterpolator.getX(focusedY);
- float unfocusedTaskProgress = stackScroll + mUnfocusedRange.getAbsoluteX(unfocusedRangeX);
- if (Float.compare(focusedRangeX, unfocusedRangeX) != 0) {
- mTaskIndexOverrideMap.put(task.key.id, unfocusedTaskProgress);
- }
- }
- }
-
- /**
- * Adds and override task progress for the given task when transitioning from focused to
- * unfocused state.
- */
- public void addUnfocusedTaskOverride(TaskView taskView, float stackScroll) {
- mFocusedRange.offset(stackScroll);
- mUnfocusedRange.offset(stackScroll);
-
- Task task = taskView.getTask();
- int top = taskView.getTop() - mTaskRect.top;
- float focusedRangeX = getNormalizedXFromFocusedY(top, FROM_TOP);
- float unfocusedRangeX = getNormalizedXFromUnfocusedY(top, FROM_TOP);
- float unfocusedTaskProgress = stackScroll + mUnfocusedRange.getAbsoluteX(unfocusedRangeX);
- if (Float.compare(focusedRangeX, unfocusedRangeX) != 0) {
- mTaskIndexOverrideMap.put(task.key.id, unfocusedTaskProgress);
- }
- }
-
- public void clearUnfocusedTaskOverrides() {
- mTaskIndexOverrideMap.clear();
- }
-
- /**
- * Updates this stack when a scroll happens.
- *
- */
- public float updateFocusStateOnScroll(float lastTargetStackScroll, float targetStackScroll,
- float lastStackScroll) {
- if (targetStackScroll == lastStackScroll || LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return targetStackScroll;
- }
-
- float deltaScroll = targetStackScroll - lastStackScroll;
- float deltaTargetScroll = targetStackScroll - lastTargetStackScroll;
- float newScroll = targetStackScroll;
- mUnfocusedRange.offset(targetStackScroll);
- for (int i = mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
- int taskId = mTaskIndexOverrideMap.keyAt(i);
- float x = mTaskIndexMap.get(taskId);
- float overrideX = mTaskIndexOverrideMap.get(taskId, 0f);
- float newOverrideX = overrideX + deltaScroll;
- if (isInvalidOverrideX(x, overrideX, newOverrideX)) {
- // Remove the override once we reach the original task index
- mTaskIndexOverrideMap.removeAt(i);
- } else if ((overrideX >= x && deltaScroll <= 0f) ||
- (overrideX <= x && deltaScroll >= 0f)) {
- // Scrolling from override x towards x, then lock the task in place
- mTaskIndexOverrideMap.put(taskId, newOverrideX);
- } else {
- // Scrolling override x away from x, we should still move the scroll towards x
- newScroll = lastStackScroll;
- newOverrideX = overrideX - deltaTargetScroll;
- if (isInvalidOverrideX(x, overrideX, newOverrideX)) {
- mTaskIndexOverrideMap.removeAt(i);
- } else{
- mTaskIndexOverrideMap.put(taskId, newOverrideX);
- }
- }
- }
- return newScroll;
- }
-
- private boolean isInvalidOverrideX(float x, float overrideX, float newOverrideX) {
- boolean outOfBounds = mUnfocusedRange.getNormalizedX(newOverrideX) < 0f ||
- mUnfocusedRange.getNormalizedX(newOverrideX) > 1f;
- return outOfBounds || (overrideX >= x && x >= newOverrideX) ||
- (overrideX <= x && x <= newOverrideX);
- }
-
- /**
- * Returns the default focus state.
- */
- public int getInitialFocusState() {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- RecentsDebugFlags debugFlags = LegacyRecentsImpl.getDebugFlags();
- if (launchState.launchedWithAltTab) {
- return STATE_FOCUSED;
- } else {
- return STATE_UNFOCUSED;
- }
- }
-
- public Rect getStackActionButtonRect() {
- return useGridLayout()
- ? mTaskGridLayoutAlgorithm.getStackActionButtonRect() : mStackActionButtonRect;
- }
-
- /**
- * Returns the TaskViewTransform that would put the task just off the back of the stack.
- */
- public TaskViewTransform getBackOfStackTransform() {
- return mBackOfStackTransform;
- }
-
- /**
- * Returns the TaskViewTransform that would put the task just off the front of the stack.
- */
- public TaskViewTransform getFrontOfStackTransform() {
- return mFrontOfStackTransform;
- }
-
- /**
- * Returns whether this stack layout has been initialized.
- */
- public boolean isInitialized() {
- return !mStackRect.isEmpty();
- }
-
- /**
- * Computes the maximum number of visible tasks and thumbnails when the scroll is at the initial
- * stack scroll. Requires that update() is called first.
- */
- public VisibilityReport computeStackVisibilityReport(ArrayList<Task> tasks) {
- if (useGridLayout()) {
- return mTaskGridLayoutAlgorithm.computeStackVisibilityReport(tasks);
- }
-
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return mTaskStackLowRamLayoutAlgorithm.computeStackVisibilityReport(tasks);
- }
-
- // Ensure minimum visibility count
- if (tasks.size() <= 1) {
- return new VisibilityReport(1, 1);
- }
-
- // Otherwise, walk backwards in the stack and count the number of tasks and visible
- // thumbnails and add that to the total task count
- TaskViewTransform tmpTransform = new TaskViewTransform();
- Range currentRange = getInitialFocusState() > 0f ? mFocusedRange : mUnfocusedRange;
- currentRange.offset(mInitialScrollP);
- int taskBarHeight = mContext.getResources().getDimensionPixelSize(
- R.dimen.recents_task_view_header_height);
- int numVisibleTasks = 0;
- int numVisibleThumbnails = 0;
- float prevScreenY = Integer.MAX_VALUE;
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task task = tasks.get(i);
-
- // Skip invisible
- float taskProgress = getStackScrollForTask(task);
- if (!currentRange.isInRange(taskProgress)) {
- continue;
- }
-
- getStackTransform(taskProgress, taskProgress, mInitialScrollP, mFocusState,
- tmpTransform, null, false /* ignoreSingleTaskCase */, false /* forceUpdate */);
- float screenY = tmpTransform.rect.top;
- boolean hasVisibleThumbnail = (prevScreenY - screenY) > taskBarHeight;
- if (hasVisibleThumbnail) {
- numVisibleThumbnails++;
- numVisibleTasks++;
- prevScreenY = screenY;
- } else {
- // Once we hit the next front most task that does not have a visible thumbnail,
- // walk through remaining visible set
- for (int j = i; j >= 0; j--) {
- taskProgress = getStackScrollForTask(tasks.get(j));
- if (!currentRange.isInRange(taskProgress)) {
- break;
- }
- numVisibleTasks++;
- }
- break;
- }
- }
- return new VisibilityReport(numVisibleTasks, numVisibleThumbnails);
- }
-
- /**
- * Returns the transform for the given task. This transform is relative to the mTaskRect, which
- * is what the view is measured and laid out with.
- */
- public TaskViewTransform getStackTransform(Task task, float stackScroll,
- TaskViewTransform transformOut, TaskViewTransform frontTransform) {
- return getStackTransform(task, stackScroll, mFocusState, transformOut, frontTransform,
- false /* forceUpdate */, false /* ignoreTaskOverrides */);
- }
-
- public TaskViewTransform getStackTransform(Task task, float stackScroll,
- TaskViewTransform transformOut, TaskViewTransform frontTransform,
- boolean ignoreTaskOverrides) {
- return getStackTransform(task, stackScroll, mFocusState, transformOut, frontTransform,
- false /* forceUpdate */, ignoreTaskOverrides);
- }
-
- public TaskViewTransform getStackTransform(Task task, float stackScroll, int focusState,
- TaskViewTransform transformOut, TaskViewTransform frontTransform, boolean forceUpdate,
- boolean ignoreTaskOverrides) {
- if (useGridLayout()) {
- int taskIndex = mTaskIndexMap.get(task.key.id);
- int taskCount = mTaskIndexMap.size();
- mTaskGridLayoutAlgorithm.getTransform(taskIndex, taskCount, transformOut, this);
- return transformOut;
- } else if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- if (task == null) {
- transformOut.reset();
- return transformOut;
- }
- int taskIndex = mTaskIndexMap.get(task.key.id);
- mTaskStackLowRamLayoutAlgorithm.getTransform(taskIndex, stackScroll, transformOut,
- mNumStackTasks, this);
- return transformOut;
- } else {
- // Return early if we have an invalid index
- int nonOverrideTaskProgress = mTaskIndexMap.get(task.key.id, -1);
- if (task == null || nonOverrideTaskProgress == -1) {
- transformOut.reset();
- return transformOut;
- }
- float taskProgress = ignoreTaskOverrides
- ? nonOverrideTaskProgress
- : getStackScrollForTask(task);
-
- getStackTransform(taskProgress, nonOverrideTaskProgress, stackScroll, focusState,
- transformOut, frontTransform, false /* ignoreSingleTaskCase */, forceUpdate);
- return transformOut;
- }
- }
-
- /**
- * Like {@link #getStackTransform}, but in screen coordinates
- */
- public TaskViewTransform getStackTransformScreenCoordinates(Task task, float stackScroll,
- TaskViewTransform transformOut, TaskViewTransform frontTransform,
- Rect windowOverrideRect) {
- TaskViewTransform transform = getStackTransform(task, stackScroll, mFocusState,
- transformOut, frontTransform, true /* forceUpdate */,
- false /* ignoreTaskOverrides */);
- return transformToScreenCoordinates(transform, windowOverrideRect);
- }
-
- /**
- * Transforms the given {@param transformOut} to the screen coordinates, overriding the current
- * window rectangle with {@param windowOverrideRect} if non-null.
- */
- TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut,
- Rect windowOverrideRect) {
- Rect windowRect = windowOverrideRect != null
- ? windowOverrideRect
- : LegacyRecentsImpl.getSystemServices().getWindowRect();
- transformOut.rect.offset(windowRect.left, windowRect.top);
- if (useGridLayout()) {
- // Draw the thumbnail a little lower to perfectly coincide with the view we are
- // transitioning to, where the header bar has already been drawn.
- transformOut.rect.offset(0, mTitleBarHeight);
- }
- return transformOut;
- }
-
- /**
- * Update/get the transform.
- *
- * @param ignoreSingleTaskCase When set, will ensure that the transform computed does not take
- * into account the special single-task case. This is only used
- * internally to ensure that we can calculate the transform for any
- * position in the stack.
- */
- public void getStackTransform(float taskProgress, float nonOverrideTaskProgress,
- float stackScroll, int focusState, TaskViewTransform transformOut,
- TaskViewTransform frontTransform, boolean ignoreSingleTaskCase, boolean forceUpdate) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
-
- // Ensure that the task is in range
- mUnfocusedRange.offset(stackScroll);
- mFocusedRange.offset(stackScroll);
- boolean unfocusedVisible = mUnfocusedRange.isInRange(taskProgress);
- boolean focusedVisible = mFocusedRange.isInRange(taskProgress);
-
- // Skip if the task is not visible
- if (!forceUpdate && !unfocusedVisible && !focusedVisible) {
- transformOut.reset();
- return;
- }
-
- // Map the absolute task progress to the normalized x at the stack scroll. We use this to
- // calculate positions along the curve.
- mUnfocusedRange.offset(stackScroll);
- mFocusedRange.offset(stackScroll);
- float unfocusedRangeX = mUnfocusedRange.getNormalizedX(taskProgress);
- float focusedRangeX = mFocusedRange.getNormalizedX(taskProgress);
-
- // Map the absolute task progress to the normalized x at the bounded stack scroll. We use
- // this to calculate bounded properties, like translationZ and outline alpha.
- float boundedStackScroll = Utilities.clamp(stackScroll, mMinScrollP, mMaxScrollP);
- mUnfocusedRange.offset(boundedStackScroll);
- mFocusedRange.offset(boundedStackScroll);
- float boundedScrollUnfocusedRangeX = mUnfocusedRange.getNormalizedX(taskProgress);
- float boundedScrollUnfocusedNonOverrideRangeX =
- mUnfocusedRange.getNormalizedX(nonOverrideTaskProgress);
-
- // Map the absolute task progress to the normalized x at the upper bounded stack scroll.
- // We use this to calculate the dim, which is bounded only on one end.
- float lowerBoundedStackScroll = Utilities.clamp(stackScroll, -Float.MAX_VALUE, mMaxScrollP);
- mUnfocusedRange.offset(lowerBoundedStackScroll);
- mFocusedRange.offset(lowerBoundedStackScroll);
- float lowerBoundedUnfocusedRangeX = mUnfocusedRange.getNormalizedX(taskProgress);
- float lowerBoundedFocusedRangeX = mFocusedRange.getNormalizedX(taskProgress);
-
- int x = (mStackRect.width() - mTaskRect.width()) / 2;
- int y;
- float z;
- float dimAlpha;
- float viewOutlineAlpha;
- if (mNumStackTasks == 1 && !ignoreSingleTaskCase) {
- // When there is exactly one task, then decouple the task from the stack and just move
- // in screen space
- float tmpP = (mMinScrollP - stackScroll) / mNumStackTasks;
- int centerYOffset = (mStackRect.top - mTaskRect.top) +
- (mStackRect.height() - mSystemInsets.bottom - mTaskRect.height()) / 2;
- y = centerYOffset + getYForDeltaP(tmpP, 0);
- z = mMaxTranslationZ;
- dimAlpha = 0f;
- viewOutlineAlpha = OUTLINE_ALPHA_MIN_VALUE +
- (OUTLINE_ALPHA_MAX_VALUE - OUTLINE_ALPHA_MIN_VALUE) / 2f;
-
- } else {
- // Otherwise, update the task to the stack layout
- int unfocusedY = (int) ((1f - mUnfocusedCurveInterpolator.getInterpolation(
- unfocusedRangeX)) * mStackRect.height());
- int focusedY = (int) ((1f - mFocusedCurveInterpolator.getInterpolation(
- focusedRangeX)) * mStackRect.height());
- float unfocusedDim = mUnfocusedDimCurveInterpolator.getInterpolation(
- lowerBoundedUnfocusedRangeX);
- float focusedDim = mFocusedDimCurveInterpolator.getInterpolation(
- lowerBoundedFocusedRangeX);
-
- // Special case, because we override the initial task positions differently for small
- // stacks, we clamp the dim to 0 in the initial position, and then only modulate the
- // dim when the task is scrolled back towards the top of the screen
- if (mNumStackTasks <= 2 && nonOverrideTaskProgress == 0f) {
- if (boundedScrollUnfocusedRangeX >= 0.5f) {
- unfocusedDim = 0f;
- } else {
- float offset = mUnfocusedDimCurveInterpolator.getInterpolation(0.5f);
- unfocusedDim -= offset;
- unfocusedDim *= MAX_DIM / (MAX_DIM - offset);
- }
- }
- y = (mStackRect.top - mTaskRect.top) +
- (int) com.android.systemui.recents.utilities.Utilities
- .mapRange(focusState, unfocusedY, focusedY);
- z = Utilities.mapRange(Utilities.clamp01(boundedScrollUnfocusedNonOverrideRangeX),
- mMinTranslationZ, mMaxTranslationZ);
- dimAlpha = com.android.systemui.recents.utilities.Utilities
- .mapRange(focusState, unfocusedDim, focusedDim);
- viewOutlineAlpha = Utilities.mapRange(Utilities.clamp01(boundedScrollUnfocusedRangeX),
- OUTLINE_ALPHA_MIN_VALUE, OUTLINE_ALPHA_MAX_VALUE);
- }
-
- // Fill out the transform
- transformOut.scale = 1f;
- transformOut.alpha = 1f;
- transformOut.translationZ = z;
- transformOut.dimAlpha = dimAlpha;
- transformOut.viewOutlineAlpha = viewOutlineAlpha;
- transformOut.rect.set(mTaskRect);
- transformOut.rect.offset(x, y);
- Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
- transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
- (frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
- }
-
- /**
- * Returns the untransformed task view bounds.
- */
- public Rect getUntransformedTaskViewBounds() {
- return new Rect(mTaskRect);
- }
-
- /**
- * Returns the scroll progress to scroll to such that the top of the task is at the top of the
- * stack.
- */
- float getStackScrollForTask(Task t) {
- Float overrideP = mTaskIndexOverrideMap.get(t.key.id, null);
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice || overrideP == null) {
- return (float) mTaskIndexMap.get(t.key.id, 0);
- }
- return overrideP;
- }
-
- /**
- * Returns the original scroll progress to scroll to such that the top of the task is at the top
- * of the stack.
- */
- float getStackScrollForTaskIgnoreOverrides(Task t) {
- return (float) mTaskIndexMap.get(t.key.id, 0);
- }
-
- /**
- * Returns the scroll progress to scroll to such that the top of the task at the initial top
- * offset (which is at the task's brightest point).
- */
- float getStackScrollForTaskAtInitialOffset(Task t) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- return mTaskStackLowRamLayoutAlgorithm.getInitialScrollP(mNumStackTasks,
- launchState.launchedFromHome || launchState.launchedFromPipApp
- || launchState.launchedWithNextPipApp);
- }
- float normX = getNormalizedXFromUnfocusedY(mInitialTopOffset, FROM_TOP);
- mUnfocusedRange.offset(0f);
- return Utilities.clamp((float) mTaskIndexMap.get(t.key.id, 0) - Math.max(0,
- mUnfocusedRange.getAbsoluteX(normX)), mMinScrollP, mMaxScrollP);
- }
-
- /**
- * Maps a movement in screen y, relative to {@param downY}, to a movement in along the arc
- * length of the curve. We know the curve is mostly flat, so we just map the length of the
- * screen along the arc-length proportionally (1/arclength).
- */
- public float getDeltaPForY(int downY, int y) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return mTaskStackLowRamLayoutAlgorithm.scrollToPercentage(downY - y);
- }
- float deltaP = (float) (y - downY) / mStackRect.height() *
- mUnfocusedCurveInterpolator.getArcLength();
- return -deltaP;
- }
-
- /**
- * This is the inverse of {@link #getDeltaPForY}. Given a movement along the arc length
- * of the curve, map back to the screen y.
- */
- public int getYForDeltaP(float downScrollP, float p) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return mTaskStackLowRamLayoutAlgorithm.percentageToScroll(downScrollP - p);
- }
- int y = (int) ((p - downScrollP) * mStackRect.height() *
- (1f / mUnfocusedCurveInterpolator.getArcLength()));
- return -y;
- }
-
- /**
- * Returns the task stack bounds in the current orientation. This rect takes into account the
- * top and right system insets (but not the bottom inset) and left/right paddings, but _not_
- * the top/bottom padding or insets.
- */
- public void getTaskStackBounds(Rect displayRect, Rect windowRect, int topInset, int leftInset,
- int rightInset, Rect taskStackBounds) {
- taskStackBounds.set(windowRect.left + leftInset, windowRect.top + topInset,
- windowRect.right - rightInset, windowRect.bottom);
-
- // Ensure that the new width is at most the smaller display edge size
- int sideMargin = getScaleForExtent(windowRect, displayRect, mBaseSideMargin, mMinMargin,
- WIDTH);
- int targetStackWidth = taskStackBounds.width() - 2 * sideMargin;
- if (Utilities.getAppConfiguration(mContext).orientation
- == Configuration.ORIENTATION_LANDSCAPE) {
- // If we are in landscape, calculate the width of the stack in portrait and ensure that
- // we are not larger than that size
- Rect portraitDisplayRect = new Rect(0, 0,
- Math.min(displayRect.width(), displayRect.height()),
- Math.max(displayRect.width(), displayRect.height()));
- int portraitSideMargin = getScaleForExtent(portraitDisplayRect, portraitDisplayRect,
- mBaseSideMargin, mMinMargin, WIDTH);
- targetStackWidth = Math.min(targetStackWidth,
- portraitDisplayRect.width() - 2 * portraitSideMargin);
- }
- taskStackBounds.inset((taskStackBounds.width() - targetStackWidth) / 2, 0);
- }
-
- /**
- * Retrieves resources that are constant regardless of the current configuration of the device.
- */
- public static int getDimensionForDevice(Context ctx, int phoneResId,
- int tabletResId, int xlargeTabletResId, int gridLayoutResId) {
- return getDimensionForDevice(ctx, phoneResId, phoneResId, tabletResId, tabletResId,
- xlargeTabletResId, xlargeTabletResId, gridLayoutResId);
- }
-
- /**
- * Retrieves resources that are constant regardless of the current configuration of the device.
- */
- public static int getDimensionForDevice(Context ctx, int phonePortResId, int phoneLandResId,
- int tabletPortResId, int tabletLandResId, int xlargeTabletPortResId,
- int xlargeTabletLandResId, int gridLayoutResId) {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- Resources res = ctx.getResources();
- boolean isLandscape = Utilities.getAppConfiguration(ctx).orientation ==
- Configuration.ORIENTATION_LANDSCAPE;
- if (config.isGridEnabled) {
- return res.getDimensionPixelSize(gridLayoutResId);
- } else if (config.isXLargeScreen) {
- return res.getDimensionPixelSize(isLandscape
- ? xlargeTabletLandResId
- : xlargeTabletPortResId);
- } else if (config.isLargeScreen) {
- return res.getDimensionPixelSize(isLandscape
- ? tabletLandResId
- : tabletPortResId);
- } else {
- return res.getDimensionPixelSize(isLandscape
- ? phoneLandResId
- : phonePortResId);
- }
- }
-
- /**
- * Returns the normalized x on the unfocused curve given an absolute Y position (relative to the
- * stack height).
- */
- private float getNormalizedXFromUnfocusedY(float y, @AnchorSide int fromSide) {
- float offset = (fromSide == FROM_TOP)
- ? mStackRect.height() - y
- : y;
- float offsetPct = offset / mStackRect.height();
- return mUnfocusedCurveInterpolator.getX(offsetPct);
- }
-
- /**
- * Returns the normalized x on the focused curve given an absolute Y position (relative to the
- * stack height).
- */
- private float getNormalizedXFromFocusedY(float y, @AnchorSide int fromSide) {
- float offset = (fromSide == FROM_TOP)
- ? mStackRect.height() - y
- : y;
- float offsetPct = offset / mStackRect.height();
- return mFocusedCurveInterpolator.getX(offsetPct);
- }
-
- /**
- * Creates a new path for the focused curve.
- */
- private Path constructFocusedCurve() {
- // Initialize the focused curve. This curve is a piecewise curve composed of several
- // linear pieces that goes from (0,1) through (0.5, peek height offset),
- // (0.5, bottom task offsets), and (1,0).
- float topPeekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
- float bottomPeekHeightPct = (float) (mStackBottomOffset + mFocusedBottomPeekHeight) /
- mStackRect.height();
- float minBottomPeekHeightPct = (float) (mFocusedTopPeekHeight + mTaskRect.height() -
- mMinMargin) / mStackRect.height();
- Path p = new Path();
- p.moveTo(0f, 1f);
- p.lineTo(0.5f, 1f - topPeekHeightPct);
- p.lineTo(1f - (0.5f / mFocusedRange.relativeMax), Math.max(1f - minBottomPeekHeightPct,
- bottomPeekHeightPct));
- p.lineTo(1f, 0f);
- return p;
- }
-
- /**
- * Creates a new path for the unfocused curve.
- */
- private Path constructUnfocusedCurve() {
- // Initialize the unfocused curve. This curve is a piecewise curve composed of two quadradic
- // beziers that goes from (0,1) through (0.5, peek height offset) and ends at (1,0). This
- // ensures that we match the range, at which 0.5 represents the stack scroll at the current
- // task progress. Because the height offset can change depending on a resource, we compute
- // the control point of the second bezier such that between it and a first known point,
- // there is a tangent at (0.5, peek height offset).
- float cpoint1X = 0.4f;
- float cpoint1Y = 0.975f;
- float topPeekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
- float slope = ((1f - topPeekHeightPct) - cpoint1Y) / (0.5f - cpoint1X);
- float b = 1f - slope * cpoint1X;
- float cpoint2X = 0.65f;
- float cpoint2Y = slope * cpoint2X + b;
- Path p = new Path();
- p.moveTo(0f, 1f);
- p.cubicTo(0f, 1f, cpoint1X, cpoint1Y, 0.5f, 1f - topPeekHeightPct);
- p.cubicTo(0.5f, 1f - topPeekHeightPct, cpoint2X, cpoint2Y, 1f, 0f);
- return p;
- }
-
- /**
- * Creates a new path for the focused dim curve.
- */
- private Path constructFocusedDimCurve() {
- Path p = new Path();
- // The focused dim interpolator starts at max dim, reduces to zero at 0.5 (the focused
- // task), then goes back to max dim at the next task
- p.moveTo(0f, MAX_DIM);
- p.lineTo(0.5f, 0f);
- p.lineTo(0.5f + (0.5f / mFocusedRange.relativeMax), MAX_DIM);
- p.lineTo(1f, MAX_DIM);
- return p;
- }
-
- /**
- * Creates a new path for the unfocused dim curve.
- */
- private Path constructUnfocusedDimCurve() {
- float focusX = getNormalizedXFromUnfocusedY(mInitialTopOffset, FROM_TOP);
- float cpoint2X = focusX + (1f - focusX) / 2;
- Path p = new Path();
- // The unfocused dim interpolator starts at max dim, reduces to zero at 0.5 (the focused
- // task), then goes back to max dim towards the front of the stack
- p.moveTo(0f, MAX_DIM);
- p.cubicTo(focusX * 0.5f, MAX_DIM, focusX * 0.75f, MAX_DIM * 0.75f, focusX, 0f);
- p.cubicTo(cpoint2X, 0f, cpoint2X, MED_DIM, 1f, MED_DIM);
- return p;
- }
-
- /**
- * Scales the given {@param value} to the scale of the {@param instance} rect relative to the
- * {@param other} rect in the {@param extent} side.
- */
- private int getScaleForExtent(Rect instance, Rect other, int value, int minValue,
- @Extent int extent) {
- if (extent == WIDTH) {
- float scale = Utilities.clamp01((float) instance.width() / other.width());
- return Math.max(minValue, (int) (scale * value));
- } else if (extent == HEIGHT) {
- float scale = Utilities.clamp01((float) instance.height() / other.height());
- return Math.max(minValue, (int) (scale * value));
- }
- return value;
- }
-
- /**
- * Updates the current transforms that would put a TaskView at the front and back of the stack.
- */
- private void updateFrontBackTransforms() {
- // Return early if we have not yet initialized
- if (mStackRect.isEmpty()) {
- return;
- }
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- mTaskStackLowRamLayoutAlgorithm.getBackOfStackTransform(mBackOfStackTransform, this);
- mTaskStackLowRamLayoutAlgorithm.getFrontOfStackTransform(mFrontOfStackTransform, this);
- return;
- }
-
- float min = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMin,
- mFocusedRange.relativeMin);
- float max = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMax,
- mFocusedRange.relativeMax);
- getStackTransform(min, min, 0f, mFocusState, mBackOfStackTransform, null,
- true /* ignoreSingleTaskCase */, true /* forceUpdate */);
- getStackTransform(max, max, 0f, mFocusState, mFrontOfStackTransform, null,
- true /* ignoreSingleTaskCase */, true /* forceUpdate */);
- mBackOfStackTransform.visible = true;
- mFrontOfStackTransform.visible = true;
- }
-
- /**
- * Returns the proper task rectangle according to the current grid state.
- */
- public Rect getTaskRect() {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return mTaskStackLowRamLayoutAlgorithm.getTaskRect();
- }
- return useGridLayout() ? mTaskGridLayoutAlgorithm.getTaskGridRect() : mTaskRect;
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
-
- writer.print(prefix); writer.print(TAG);
- writer.write(" numStackTasks="); writer.print(mNumStackTasks);
- writer.println();
-
- writer.print(innerPrefix);
- writer.print("insets="); writer.print(Utilities.dumpRect(mSystemInsets));
- writer.print(" stack="); writer.print(Utilities.dumpRect(mStackRect));
- writer.print(" task="); writer.print(Utilities.dumpRect(mTaskRect));
- writer.print(" actionButton="); writer.print(
- Utilities.dumpRect(mStackActionButtonRect));
- writer.println();
-
- writer.print(innerPrefix);
- writer.print("minScroll="); writer.print(mMinScrollP);
- writer.print(" maxScroll="); writer.print(mMaxScrollP);
- writer.print(" initialScroll="); writer.print(mInitialScrollP);
- writer.println();
-
- writer.print(innerPrefix);
- writer.print("focusState="); writer.print(mFocusState);
- writer.println();
-
- if (mTaskIndexOverrideMap.size() > 0) {
- for (int i = mTaskIndexOverrideMap.size() - 1; i >= 0; i--) {
- int taskId = mTaskIndexOverrideMap.keyAt(i);
- float x = mTaskIndexMap.get(taskId);
- float overrideX = mTaskIndexOverrideMap.get(taskId, 0f);
-
- writer.print(innerPrefix);
- writer.print("taskId= "); writer.print(taskId);
- writer.print(" x= "); writer.print(x);
- writer.print(" overrideX= "); writer.print(overrideX);
- writer.println();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java
deleted file mode 100644
index b89218c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackView.java
+++ /dev/null
@@ -1,2291 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
-import android.annotation.IntDef;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Rect;
-import android.os.Bundle;
-import android.util.ArrayMap;
-import android.util.ArraySet;
-import android.util.MutableBoolean;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewDebug;
-import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
-import android.widget.FrameLayout;
-import android.widget.ScrollView;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.Dependency;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.plugins.FalsingManager;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivity;
-import com.android.systemui.recents.RecentsActivityLaunchState;
-import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.RecentsDebugFlags;
-import com.android.systemui.recents.RecentsImpl;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
-import com.android.systemui.recents.events.activity.ConfigurationChangedEvent;
-import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
-import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
-import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.activity.HideStackActionButtonEvent;
-import com.android.systemui.recents.events.activity.LaunchMostRecentTaskRequestEvent;
-import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskEvent;
-import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent;
-import com.android.systemui.recents.events.activity.MultiWindowStateChangedEvent;
-import com.android.systemui.recents.events.activity.PackagesChangedEvent;
-import com.android.systemui.recents.events.activity.ShowEmptyViewEvent;
-import com.android.systemui.recents.events.activity.ShowStackActionButtonEvent;
-import com.android.systemui.recents.events.component.ActivityPinnedEvent;
-import com.android.systemui.recents.events.component.ExpandPipEvent;
-import com.android.systemui.recents.events.component.HidePipMenuEvent;
-import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
-import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
-import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
-import com.android.systemui.recents.events.ui.DismissAllTaskViewsEvent;
-import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
-import com.android.systemui.recents.events.ui.RecentsGrowingEvent;
-import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
-import com.android.systemui.recents.events.ui.UserInteractionEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
-import com.android.systemui.recents.events.ui.focus.DismissFocusedTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.FocusNextTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.FocusPreviousTaskViewEvent;
-import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent;
-import com.android.systemui.recents.misc.DozeTrigger;
-import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.recents.views.grid.GridTaskView;
-import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm;
-import com.android.systemui.recents.views.grid.TaskViewFocusFrame;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-
-import java.io.PrintWriter;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/* The visual representation of a task stack view */
-public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCallbacks,
- TaskView.TaskViewCallbacks, TaskStackViewScroller.TaskStackViewScrollerCallbacks,
- TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks,
- ViewPool.ViewPoolConsumer<TaskView, Task> {
-
- private static final String TAG = "TaskStackView";
-
- // The thresholds at which to show/hide the stack action button.
- private static final float SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD = 0.3f;
- private static final float HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD = 0.3f;
-
- public static final int DEFAULT_SYNC_STACK_DURATION = 200;
- public static final int SLOW_SYNC_STACK_DURATION = 250;
- private static final int DRAG_SCALE_DURATION = 175;
- static final float DRAG_SCALE_FACTOR = 1.05f;
-
- private static final int LAUNCH_NEXT_SCROLL_BASE_DURATION = 216;
- private static final int LAUNCH_NEXT_SCROLL_INCR_DURATION = 32;
-
- // The actions to perform when resetting to initial state,
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({INITIAL_STATE_UPDATE_NONE, INITIAL_STATE_UPDATE_ALL, INITIAL_STATE_UPDATE_LAYOUT_ONLY})
- public @interface InitialStateAction {}
- /** Do not update the stack and layout to the initial state. */
- private static final int INITIAL_STATE_UPDATE_NONE = 0;
- /** Update both the stack and layout to the initial state. */
- private static final int INITIAL_STATE_UPDATE_ALL = 1;
- /** Update only the layout to the initial state. */
- private static final int INITIAL_STATE_UPDATE_LAYOUT_ONLY = 2;
-
- private LayoutInflater mInflater;
- private TaskStack mStack = new TaskStack();
- @ViewDebug.ExportedProperty(deepExport=true, prefix="layout_")
- TaskStackLayoutAlgorithm mLayoutAlgorithm;
- // The stable layout algorithm is only used to calculate the task rect with the stable bounds
- private TaskStackLayoutAlgorithm mStableLayoutAlgorithm;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="scroller_")
- private TaskStackViewScroller mStackScroller;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="touch_")
- private TaskStackViewTouchHandler mTouchHandler;
- private TaskStackAnimationHelper mAnimationHelper;
- private ViewPool<TaskView, Task> mViewPool;
-
- private ArrayList<TaskView> mTaskViews = new ArrayList<>();
- private ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<>();
- private ArraySet<Task.TaskKey> mIgnoreTasks = new ArraySet<>();
- private AnimationProps mDeferredTaskViewLayoutAnimation = null;
-
- @ViewDebug.ExportedProperty(deepExport=true, prefix="doze_")
- private DozeTrigger mUIDozeTrigger;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="focused_task_")
- private Task mFocusedTask;
-
- private int mTaskCornerRadiusPx;
- private int mDividerSize;
- private int mStartTimerIndicatorDuration;
-
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mTaskViewsClipDirty = true;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mEnterAnimationComplete = false;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mStackReloaded = false;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mFinishedLayoutAfterStackReload = false;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mLaunchNextAfterFirstMeasure = false;
- @ViewDebug.ExportedProperty(category="recents")
- @InitialStateAction
- private int mInitialState = INITIAL_STATE_UPDATE_ALL;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mInMeasureLayout = false;
- @ViewDebug.ExportedProperty(category="recents")
- boolean mTouchExplorationEnabled;
- @ViewDebug.ExportedProperty(category="recents")
- boolean mScreenPinningEnabled;
-
- // The stable stack bounds are the full bounds that we were measured with from RecentsView
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mStableStackBounds = new Rect();
- // The current stack bounds are dynamic and may change as the user drags and drops
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mStackBounds = new Rect();
- // The current window bounds at the point we were measured
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mStableWindowRect = new Rect();
- // The current window bounds are dynamic and may change as the user drags and drops
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mWindowRect = new Rect();
- // The current display bounds
- @ViewDebug.ExportedProperty(category="recents")
- private Rect mDisplayRect = new Rect();
- // The current display orientation
- @ViewDebug.ExportedProperty(category="recents")
- private int mDisplayOrientation = Configuration.ORIENTATION_UNDEFINED;
-
- private Rect mTmpRect = new Rect();
- private ArrayMap<Task.TaskKey, TaskView> mTmpTaskViewMap = new ArrayMap<>();
- private List<TaskView> mTmpTaskViews = new ArrayList<>();
- private TaskViewTransform mTmpTransform = new TaskViewTransform();
- private int[] mTmpIntPair = new int[2];
- private boolean mResetToInitialStateWhenResized;
- private int mLastWidth;
- private int mLastHeight;
- private boolean mStackActionButtonVisible;
-
- // Percentage of last ScrollP from the min to max scrollP that lives after configuration changes
- private float mLastScrollPPercent = -1;
-
- // We keep track of the task view focused by user interaction and draw a frame around it in the
- // grid layout.
- private TaskViewFocusFrame mTaskViewFocusFrame;
-
- private Task mPrefetchingTask;
- private final float mFastFlingVelocity;
-
- // A convenience update listener to request updating clipping of tasks
- private ValueAnimator.AnimatorUpdateListener mRequestUpdateClippingListener =
- new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- if (!mTaskViewsClipDirty) {
- mTaskViewsClipDirty = true;
- invalidate();
- }
- }
- };
-
- private DropTarget mStackDropTarget = new DropTarget() {
- @Override
- public boolean acceptsDrop(int x, int y, int width, int height, Rect insets,
- boolean isCurrentTarget) {
- // This drop target has a fixed bounds and should be checked last, so just fall through
- // if it is the current target
- if (!isCurrentTarget) {
- return mLayoutAlgorithm.mStackRect.contains(x, y);
- }
- return false;
- }
- };
-
- public TaskStackView(Context context) {
- super(context);
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- Resources res = context.getResources();
-
- // Set the stack first
- mStack.setCallbacks(this);
- mViewPool = new ViewPool<>(context, this);
- mInflater = LayoutInflater.from(context);
- mLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, this);
- mStableLayoutAlgorithm = new TaskStackLayoutAlgorithm(context, null);
- mStackScroller = new TaskStackViewScroller(context, this, mLayoutAlgorithm);
- mTouchHandler = new TaskStackViewTouchHandler(
- context, this, mStackScroller, Dependency.get(FalsingManager.class));
- mAnimationHelper = new TaskStackAnimationHelper(context, this);
- mTaskCornerRadiusPx = LegacyRecentsImpl.getConfiguration().isGridEnabled ?
- res.getDimensionPixelSize(R.dimen.recents_grid_task_view_rounded_corners_radius) :
- res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
- mFastFlingVelocity = res.getDimensionPixelSize(R.dimen.recents_fast_fling_velocity);
- mDividerSize = ssp.getDockedDividerSize(context);
- mDisplayOrientation = Utilities.getAppConfiguration(mContext).orientation;
- mDisplayRect = ssp.getDisplayRect();
- mStackActionButtonVisible = false;
-
- // Create a frame to draw around the focused task view
- if (LegacyRecentsImpl.getConfiguration().isGridEnabled) {
- mTaskViewFocusFrame = new TaskViewFocusFrame(mContext, this,
- mLayoutAlgorithm.mTaskGridLayoutAlgorithm);
- addView(mTaskViewFocusFrame);
- getViewTreeObserver().addOnGlobalFocusChangeListener(mTaskViewFocusFrame);
- }
-
- int taskBarDismissDozeDelaySeconds = getResources().getInteger(
- R.integer.recents_task_bar_dismiss_delay_seconds);
- mUIDozeTrigger = new DozeTrigger(taskBarDismissDozeDelaySeconds, new Runnable() {
- @Override
- public void run() {
- // Show the task bar dismiss buttons
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- tv.startNoUserInteractionAnimation();
- }
- }
- });
- setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
- }
-
- @Override
- protected void onAttachedToWindow() {
- EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
- super.onAttachedToWindow();
- readSystemFlags();
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- EventBus.getDefault().unregister(this);
- }
-
- /**
- * Called from RecentsActivity when it is relaunched.
- */
- void onReload(boolean isResumingFromVisible) {
- if (!isResumingFromVisible) {
- // Reset the focused task
- resetFocusedTask(getFocusedTask());
- }
-
- // Reset the state of each of the task views
- List<TaskView> taskViews = new ArrayList<>();
- taskViews.addAll(getTaskViews());
- taskViews.addAll(mViewPool.getViews());
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- taskViews.get(i).onReload(isResumingFromVisible);
- }
-
- // Reset the stack state
- readSystemFlags();
- mTaskViewsClipDirty = true;
- mUIDozeTrigger.stopDozing();
- if (!isResumingFromVisible) {
- mStackScroller.reset();
- mStableLayoutAlgorithm.reset();
- mLayoutAlgorithm.reset();
- mLastScrollPPercent = -1;
- }
-
- // Since we always animate to the same place in (the initial state), always reset the stack
- // to the initial state when resuming
- mStackReloaded = true;
- mFinishedLayoutAfterStackReload = false;
- mLaunchNextAfterFirstMeasure = false;
- mInitialState = INITIAL_STATE_UPDATE_ALL;
- requestLayout();
- }
-
- /**
- * Sets the stack tasks of this TaskStackView from the given TaskStack.
- */
- public void setTasks(TaskStack stack, boolean allowNotifyStackChanges) {
- boolean isInitialized = mLayoutAlgorithm.isInitialized();
-
- // Only notify if we are already initialized, otherwise, everything will pick up all the
- // new and old tasks when we next layout
- mStack.setTasks(stack, allowNotifyStackChanges && isInitialized);
- }
-
- /** Returns the task stack. */
- public TaskStack getStack() {
- return mStack;
- }
-
- /**
- * Updates this TaskStackView to the initial state.
- */
- public void updateToInitialState() {
- mStackScroller.setStackScrollToInitialState();
- mLayoutAlgorithm.setTaskOverridesForInitialState(mStack, false /* ignoreScrollToFront */);
- }
-
- /** Updates the list of task views */
- void updateTaskViewsList() {
- mTaskViews.clear();
- int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- View v = getChildAt(i);
- if (v instanceof TaskView) {
- mTaskViews.add((TaskView) v);
- }
- }
- }
-
- /** Gets the list of task views */
- List<TaskView> getTaskViews() {
- return mTaskViews;
- }
-
- /**
- * Returns the front most task view.
- */
- private TaskView getFrontMostTaskView() {
- List<TaskView> taskViews = getTaskViews();
- if (taskViews.isEmpty()) {
- return null;
- }
- return taskViews.get(taskViews.size() - 1);
- }
-
- /**
- * Finds the child view given a specific {@param task}.
- */
- public TaskView getChildViewForTask(Task t) {
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- if (tv.getTask() == t) {
- return tv;
- }
- }
- return null;
- }
-
- /** Returns the stack algorithm for this task stack. */
- public TaskStackLayoutAlgorithm getStackAlgorithm() {
- return mLayoutAlgorithm;
- }
-
- /** Returns the grid algorithm for this task stack. */
- public TaskGridLayoutAlgorithm getGridAlgorithm() {
- return mLayoutAlgorithm.mTaskGridLayoutAlgorithm;
- }
-
- /**
- * Returns the touch handler for this task stack.
- */
- public TaskStackViewTouchHandler getTouchHandler() {
- return mTouchHandler;
- }
-
- /**
- * Adds a task to the ignored set.
- */
- void addIgnoreTask(Task task) {
- mIgnoreTasks.add(task.key);
- }
-
- /**
- * Removes a task from the ignored set.
- */
- void removeIgnoreTask(Task task) {
- mIgnoreTasks.remove(task.key);
- }
-
- /**
- * Returns whether the specified {@param task} is ignored.
- */
- boolean isIgnoredTask(Task task) {
- return mIgnoreTasks.contains(task.key);
- }
-
- /**
- * Computes the task transforms at the current stack scroll for all visible tasks. If a valid
- * target stack scroll is provided (ie. is different than {@param curStackScroll}), then the
- * visible range includes all tasks at the target stack scroll. This is useful for ensure that
- * all views necessary for a transition or animation will be visible at the start.
- *
- * @param taskTransforms The set of task view transforms to reuse, this list will be sized to
- * match the size of {@param tasks}
- * @param tasks The set of tasks for which to generate transforms
- * @param curStackScroll The current stack scroll
- * @param targetStackScroll The stack scroll that we anticipate we are going to be scrolling to.
- * The range of the union of the visible views at the current and
- * target stack scrolls will be returned.
- * @param ignoreTasksSet The set of tasks to skip for purposes of calculaing the visible range.
- * Transforms will still be calculated for the ignore tasks.
- * @return the front and back most visible task indices (there may be non visible tasks in
- * between this range)
- */
- int[] computeVisibleTaskTransforms(ArrayList<TaskViewTransform> taskTransforms,
- ArrayList<Task> tasks, float curStackScroll, float targetStackScroll,
- ArraySet<Task.TaskKey> ignoreTasksSet, boolean ignoreTaskOverrides) {
- int taskCount = tasks.size();
- int[] visibleTaskRange = mTmpIntPair;
- visibleTaskRange[0] = -1;
- visibleTaskRange[1] = -1;
- boolean useTargetStackScroll = Float.compare(curStackScroll, targetStackScroll) != 0;
-
- // We can reuse the task transforms where possible to reduce object allocation
- matchTaskListSize(tasks, taskTransforms);
-
- // Update the stack transforms
- TaskViewTransform frontTransform = null;
- TaskViewTransform frontTransformAtTarget = null;
- TaskViewTransform transform = null;
- TaskViewTransform transformAtTarget = null;
- for (int i = taskCount - 1; i >= 0; i--) {
- Task task = tasks.get(i);
-
- // Calculate the current and (if necessary) the target transform for the task
- transform = mLayoutAlgorithm.getStackTransform(task, curStackScroll,
- taskTransforms.get(i), frontTransform, ignoreTaskOverrides);
- if (useTargetStackScroll && !transform.visible) {
- // If we have a target stack scroll and the task is not currently visible, then we
- // just update the transform at the new scroll
- // TODO: Optimize this
- transformAtTarget = mLayoutAlgorithm.getStackTransform(task, targetStackScroll,
- new TaskViewTransform(), frontTransformAtTarget);
- if (transformAtTarget.visible) {
- transform.copyFrom(transformAtTarget);
- }
- }
-
- // For ignore tasks, only calculate the stack transform and skip the calculation of the
- // visible stack indices
- if (ignoreTasksSet.contains(task.key)) {
- continue;
- }
-
- frontTransform = transform;
- frontTransformAtTarget = transformAtTarget;
- if (transform.visible) {
- if (visibleTaskRange[0] < 0) {
- visibleTaskRange[0] = i;
- }
- visibleTaskRange[1] = i;
- }
- }
- return visibleTaskRange;
- }
-
- /**
- * Binds the visible {@link TaskView}s at the given target scroll.
- */
- void bindVisibleTaskViews(float targetStackScroll) {
- bindVisibleTaskViews(targetStackScroll, false /* ignoreTaskOverrides */);
- }
-
- /**
- * Synchronizes the set of children {@link TaskView}s to match the visible set of tasks in the
- * current {@link TaskStack}. This call does not continue on to update their position to the
- * computed {@link TaskViewTransform}s of the visible range, but only ensures that they will
- * be added/removed from the view hierarchy and placed in the correct Z order and initial
- * position (if not currently on screen).
- *
- * @param targetStackScroll If provided, will ensure that the set of visible {@link TaskView}s
- * includes those visible at the current stack scroll, and all at the
- * target stack scroll.
- * @param ignoreTaskOverrides If set, the visible task computation will get the transforms for
- * tasks at their non-overridden task progress
- */
- void bindVisibleTaskViews(float targetStackScroll, boolean ignoreTaskOverrides) {
- // Get all the task transforms
- ArrayList<Task> tasks = mStack.getTasks();
- int[] visibleTaskRange = computeVisibleTaskTransforms(mCurrentTaskTransforms, tasks,
- mStackScroller.getStackScroll(), targetStackScroll, mIgnoreTasks,
- ignoreTaskOverrides);
-
- // Return all the invisible children to the pool
- mTmpTaskViewMap.clear();
- List<TaskView> taskViews = getTaskViews();
- int lastFocusedTaskIndex = -1;
- int taskViewCount = taskViews.size();
- for (int i = taskViewCount - 1; i >= 0; i--) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- // Skip ignored tasks
- if (mIgnoreTasks.contains(task.key)) {
- continue;
- }
-
- // It is possible for the set of lingering TaskViews to differ from the stack if the
- // stack was updated before the relayout. If the task view is no longer in the stack,
- // then just return it back to the view pool.
- int taskIndex = mStack.indexOfTask(task);
- TaskViewTransform transform = null;
- if (taskIndex != -1) {
- transform = mCurrentTaskTransforms.get(taskIndex);
- }
-
- if (transform != null && transform.visible) {
- mTmpTaskViewMap.put(task.key, tv);
- } else {
- if (mTouchExplorationEnabled && Utilities.isDescendentAccessibilityFocused(tv)) {
- lastFocusedTaskIndex = taskIndex;
- resetFocusedTask(task);
- }
- mViewPool.returnViewToPool(tv);
- }
- }
-
- // Pick up all the newly visible children
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task task = tasks.get(i);
- TaskViewTransform transform = mCurrentTaskTransforms.get(i);
-
- // Skip ignored tasks
- if (mIgnoreTasks.contains(task.key)) {
- continue;
- }
-
- // Skip the invisible stack tasks
- if (!transform.visible) {
- continue;
- }
-
- TaskView tv = mTmpTaskViewMap.get(task.key);
- if (tv == null) {
- tv = mViewPool.pickUpViewFromPool(task, task);
- if (transform.rect.top <= mLayoutAlgorithm.mStackRect.top) {
- updateTaskViewToTransform(tv, mLayoutAlgorithm.getBackOfStackTransform(),
- AnimationProps.IMMEDIATE);
- } else {
- updateTaskViewToTransform(tv, mLayoutAlgorithm.getFrontOfStackTransform(),
- AnimationProps.IMMEDIATE);
- }
- } else {
- // Reattach it in the right z order
- final int taskIndex = mStack.indexOfTask(task);
- final int insertIndex = findTaskViewInsertIndex(task, taskIndex);
- if (insertIndex != getTaskViews().indexOf(tv)){
- detachViewFromParent(tv);
- attachViewToParent(tv, insertIndex, tv.getLayoutParams());
- updateTaskViewsList();
- }
- }
- }
-
- updatePrefetchingTask(tasks, visibleTaskRange[0], visibleTaskRange[1]);
-
- // Update the focus if the previous focused task was returned to the view pool
- if (lastFocusedTaskIndex != -1) {
- int newFocusedTaskIndex = (lastFocusedTaskIndex < visibleTaskRange[1])
- ? visibleTaskRange[1]
- : visibleTaskRange[0];
- setFocusedTask(newFocusedTaskIndex, false /* scrollToTask */,
- true /* requestViewFocus */);
- TaskView focusedTaskView = getChildViewForTask(mFocusedTask);
- if (focusedTaskView != null) {
- focusedTaskView.requestAccessibilityFocus();
- }
- }
- }
-
- /**
- * @see #relayoutTaskViews(AnimationProps, ArrayMap<Task, AnimationProps>, boolean)
- */
- public void relayoutTaskViews(AnimationProps animation) {
- relayoutTaskViews(animation, null /* animationOverrides */,
- false /* ignoreTaskOverrides */);
- }
-
- /**
- * Relayout the the visible {@link TaskView}s to their current transforms as specified by the
- * {@link TaskStackLayoutAlgorithm} with the given {@param animation}. This call cancels any
- * animations that are current running on those task views, and will ensure that the children
- * {@link TaskView}s will match the set of visible tasks in the stack. If a {@link Task} has
- * an animation provided in {@param animationOverrides}, that will be used instead.
- */
- private void relayoutTaskViews(AnimationProps animation,
- ArrayMap<Task, AnimationProps> animationOverrides, boolean ignoreTaskOverrides) {
- // If we had a deferred animation, cancel that
- cancelDeferredTaskViewLayoutAnimation();
-
- // Synchronize the current set of TaskViews
- bindVisibleTaskViews(mStackScroller.getStackScroll(), ignoreTaskOverrides);
-
- // Animate them to their final transforms with the given animation
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (mIgnoreTasks.contains(task.key)) {
- continue;
- }
-
- int taskIndex = mStack.indexOfTask(task);
- TaskViewTransform transform = mCurrentTaskTransforms.get(taskIndex);
- if (animationOverrides != null && animationOverrides.containsKey(task)) {
- animation = animationOverrides.get(task);
- }
-
- updateTaskViewToTransform(tv, transform, animation);
- }
- }
-
- /**
- * Posts an update to synchronize the {@link TaskView}s with the stack on the next frame.
- */
- void relayoutTaskViewsOnNextFrame(AnimationProps animation) {
- mDeferredTaskViewLayoutAnimation = animation;
- invalidate();
- }
-
- /**
- * Called to update a specific {@link TaskView} to a given {@link TaskViewTransform} with a
- * given set of {@link AnimationProps} properties.
- */
- public void updateTaskViewToTransform(TaskView taskView, TaskViewTransform transform,
- AnimationProps animation) {
- if (taskView.isAnimatingTo(transform)) {
- return;
- }
- taskView.cancelTransformAnimation();
- taskView.updateViewPropertiesToTaskTransform(transform, animation,
- mRequestUpdateClippingListener);
- }
-
- /**
- * Returns the current task transforms of all tasks, falling back to the stack layout if there
- * is no {@link TaskView} for the task.
- */
- public void getCurrentTaskTransforms(ArrayList<Task> tasks,
- ArrayList<TaskViewTransform> transformsOut) {
- matchTaskListSize(tasks, transformsOut);
- int focusState = mLayoutAlgorithm.getFocusState();
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task task = tasks.get(i);
- TaskViewTransform transform = transformsOut.get(i);
- TaskView tv = getChildViewForTask(task);
- if (tv != null) {
- transform.fillIn(tv);
- } else {
- mLayoutAlgorithm.getStackTransform(task, mStackScroller.getStackScroll(),
- focusState, transform, null, true /* forceUpdate */,
- false /* ignoreTaskOverrides */);
- }
- transform.visible = true;
- }
- }
-
- /**
- * Returns the task transforms for all the tasks in the stack if the stack was at the given
- * {@param stackScroll} and {@param focusState}.
- */
- public void getLayoutTaskTransforms(float stackScroll, int focusState, ArrayList<Task> tasks,
- boolean ignoreTaskOverrides, ArrayList<TaskViewTransform> transformsOut) {
- matchTaskListSize(tasks, transformsOut);
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task task = tasks.get(i);
- TaskViewTransform transform = transformsOut.get(i);
- mLayoutAlgorithm.getStackTransform(task, stackScroll, focusState, transform, null,
- true /* forceUpdate */, ignoreTaskOverrides);
- transform.visible = true;
- }
- }
-
- /**
- * Cancels the next deferred task view layout.
- */
- void cancelDeferredTaskViewLayoutAnimation() {
- mDeferredTaskViewLayoutAnimation = null;
- }
-
- /**
- * Cancels all {@link TaskView} animations.
- */
- void cancelAllTaskViewAnimations() {
- List<TaskView> taskViews = getTaskViews();
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- final TaskView tv = taskViews.get(i);
- if (!mIgnoreTasks.contains(tv.getTask().key)) {
- tv.cancelTransformAnimation();
- }
- }
- }
-
- /**
- * Updates the clip for each of the task views from back to front.
- */
- private void clipTaskViews() {
- // We never clip task views in grid layout
- if (LegacyRecentsImpl.getConfiguration().isGridEnabled) {
- return;
- }
-
- // Update the clip on each task child
- List<TaskView> taskViews = getTaskViews();
- TaskView tmpTv = null;
- TaskView prevVisibleTv = null;
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- TaskView frontTv = null;
- int clipBottom = 0;
-
- if (isIgnoredTask(tv.getTask())) {
- // For each of the ignore tasks, update the translationZ of its TaskView to be
- // between the translationZ of the tasks immediately underneath it
- if (prevVisibleTv != null) {
- tv.setTranslationZ(Math.max(tv.getTranslationZ(),
- prevVisibleTv.getTranslationZ() + 0.1f));
- }
- }
-
- if (i < (taskViewCount - 1) && tv.shouldClipViewInStack()) {
- // Find the next view to clip against
- for (int j = i + 1; j < taskViewCount; j++) {
- tmpTv = taskViews.get(j);
-
- if (tmpTv.shouldClipViewInStack()) {
- frontTv = tmpTv;
- break;
- }
- }
-
- // Clip against the next view, this is just an approximation since we are
- // stacked and we can make assumptions about the visibility of the this
- // task relative to the ones in front of it.
- if (frontTv != null) {
- float taskBottom = tv.getBottom();
- float frontTaskTop = frontTv.getTop();
- if (frontTaskTop < taskBottom) {
- // Map the stack view space coordinate (the rects) to view space
- clipBottom = (int) (taskBottom - frontTaskTop) - mTaskCornerRadiusPx;
- }
- }
- }
- tv.getViewBounds().setClipBottom(clipBottom);
- tv.mThumbnailView.updateThumbnailVisibility(clipBottom - tv.getPaddingBottom());
- prevVisibleTv = tv;
- }
- mTaskViewsClipDirty = false;
- }
-
- public void updateLayoutAlgorithm(boolean boundScrollToNewMinMax) {
- updateLayoutAlgorithm(boundScrollToNewMinMax, LegacyRecentsImpl.getConfiguration().getLaunchState());
- }
-
- /**
- * Updates the layout algorithm min and max virtual scroll bounds.
- */
- public void updateLayoutAlgorithm(boolean boundScrollToNewMinMax,
- RecentsActivityLaunchState launchState) {
- // Compute the min and max scroll values
- mLayoutAlgorithm.update(mStack, mIgnoreTasks, launchState, mLastScrollPPercent);
-
- if (boundScrollToNewMinMax) {
- mStackScroller.boundScroll();
- }
- }
-
- /**
- * Updates the stack layout to its stable places.
- */
- private void updateLayoutToStableBounds() {
- mWindowRect.set(mStableWindowRect);
- mStackBounds.set(mStableStackBounds);
- mLayoutAlgorithm.setSystemInsets(mStableLayoutAlgorithm.mSystemInsets);
- mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds);
- updateLayoutAlgorithm(true /* boundScroll */);
- }
-
- /** Returns the scroller. */
- public TaskStackViewScroller getScroller() {
- return mStackScroller;
- }
-
- /**
- * Sets the focused task to the provided (bounded taskIndex).
- *
- * @return whether or not the stack will scroll as a part of this focus change
- */
- public boolean setFocusedTask(int taskIndex, boolean scrollToTask,
- final boolean requestViewFocus) {
- return setFocusedTask(taskIndex, scrollToTask, requestViewFocus, 0);
- }
-
- /**
- * Sets the focused task to the provided (bounded focusTaskIndex).
- *
- * @return whether or not the stack will scroll as a part of this focus change
- */
- public boolean setFocusedTask(int focusTaskIndex, boolean scrollToTask,
- boolean requestViewFocus, int timerIndicatorDuration) {
- // Find the next task to focus
- int newFocusedTaskIndex = mStack.getTaskCount() > 0 ?
- Utilities.clamp(focusTaskIndex, 0, mStack.getTaskCount() - 1) : -1;
- final Task newFocusedTask = (newFocusedTaskIndex != -1) ?
- mStack.getTasks().get(newFocusedTaskIndex) : null;
-
- // Reset the last focused task state if changed
- if (mFocusedTask != null) {
- // Cancel the timer indicator, if applicable
- if (timerIndicatorDuration > 0) {
- final TaskView tv = getChildViewForTask(mFocusedTask);
- if (tv != null) {
- tv.getHeaderView().cancelFocusTimerIndicator();
- }
- }
-
- resetFocusedTask(mFocusedTask);
- }
-
- boolean willScroll = false;
- mFocusedTask = newFocusedTask;
-
- if (newFocusedTask != null) {
- // Start the timer indicator, if applicable
- if (timerIndicatorDuration > 0) {
- final TaskView tv = getChildViewForTask(mFocusedTask);
- if (tv != null) {
- tv.getHeaderView().startFocusTimerIndicator(timerIndicatorDuration);
- } else {
- // The view is null; set a flag for later
- mStartTimerIndicatorDuration = timerIndicatorDuration;
- }
- }
-
- if (scrollToTask) {
- // Cancel any running enter animations at this point when we scroll or change focus
- if (!mEnterAnimationComplete) {
- cancelAllTaskViewAnimations();
- }
-
- mLayoutAlgorithm.clearUnfocusedTaskOverrides();
- willScroll = mAnimationHelper.startScrollToFocusedTaskAnimation(newFocusedTask,
- requestViewFocus);
- if (willScroll) {
- sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SCROLLED);
- }
- } else {
- // Focus the task view
- TaskView newFocusedTaskView = getChildViewForTask(newFocusedTask);
- if (newFocusedTaskView != null) {
- newFocusedTaskView.setFocusedState(true, requestViewFocus);
- }
- }
- // Any time a task view gets the focus, we move the focus frame around it.
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.moveGridTaskViewFocus(getChildViewForTask(newFocusedTask));
- }
- }
- return willScroll;
- }
-
- /**
- * Sets the focused task relative to the currently focused task.
- *
- * @param forward whether to go to the next task in the stack (along the curve) or the previous
- * @param stackTasksOnly if set, will ensure that the traversal only goes along stack tasks, and
- * if the currently focused task is not a stack task, will set the focus
- * to the first visible stack task
- * @param animated determines whether to actually draw the highlight along with the change in
- * focus.
- */
- public void setRelativeFocusedTask(boolean forward, boolean stackTasksOnly, boolean animated) {
- setRelativeFocusedTask(forward, stackTasksOnly, animated, false, 0);
- }
-
- /**
- * Sets the focused task relative to the currently focused task.
- *
- * @param forward whether to go to the next task in the stack (along the curve) or the previous
- * @param stackTasksOnly if set, will ensure that the traversal only goes along stack tasks, and
- * if the currently focused task is not a stack task, will set the focus
- * to the first visible stack task
- * @param animated determines whether to actually draw the highlight along with the change in
- * focus.
- * @param cancelWindowAnimations if set, will attempt to cancel window animations if a scroll
- * happens.
- * @param timerIndicatorDuration the duration to initialize the auto-advance timer indicator
- */
- public void setRelativeFocusedTask(boolean forward, boolean stackTasksOnly, boolean animated,
- boolean cancelWindowAnimations, int timerIndicatorDuration) {
- Task focusedTask = getFocusedTask();
- int newIndex = mStack.indexOfTask(focusedTask);
- if (focusedTask != null) {
- if (stackTasksOnly) {
- List<Task> tasks = mStack.getTasks();
- // Try the next task if it is a stack task
- int tmpNewIndex = newIndex + (forward ? -1 : 1);
- if (0 <= tmpNewIndex && tmpNewIndex < tasks.size()) {
- newIndex = tmpNewIndex;
- }
- } else {
- // No restrictions, lets just move to the new task (looping forward/backwards if
- // necessary)
- int taskCount = mStack.getTaskCount();
- newIndex = (newIndex + (forward ? -1 : 1) + taskCount) % taskCount;
- }
- } else {
- // We don't have a focused task
- float stackScroll = mStackScroller.getStackScroll();
- ArrayList<Task> tasks = mStack.getTasks();
- int taskCount = tasks.size();
- if (useGridLayout()) {
- // For the grid layout, we directly set focus to the most recently used task
- // no matter we're moving forwards or backwards.
- newIndex = taskCount - 1;
- } else {
- // For the grid layout we pick a proper task to focus, according to the current
- // stack scroll.
- if (forward) {
- // Walk backwards and focus the next task smaller than the current stack scroll
- for (newIndex = taskCount - 1; newIndex >= 0; newIndex--) {
- float taskP = mLayoutAlgorithm.getStackScrollForTask(tasks.get(newIndex));
- if (Float.compare(taskP, stackScroll) <= 0) {
- break;
- }
- }
- } else {
- // Walk forwards and focus the next task larger than the current stack scroll
- for (newIndex = 0; newIndex < taskCount; newIndex++) {
- float taskP = mLayoutAlgorithm.getStackScrollForTask(tasks.get(newIndex));
- if (Float.compare(taskP, stackScroll) >= 0) {
- break;
- }
- }
- }
- }
- }
- if (newIndex != -1) {
- boolean willScroll = setFocusedTask(newIndex, true /* scrollToTask */,
- true /* requestViewFocus */, timerIndicatorDuration);
- if (willScroll && cancelWindowAnimations) {
- // As we iterate to the next/previous task, cancel any current/lagging window
- // transition animations
- EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null));
- }
- }
- }
-
- /**
- * Resets the focused task.
- */
- public void resetFocusedTask(Task task) {
- if (task != null) {
- TaskView tv = getChildViewForTask(task);
- if (tv != null) {
- tv.setFocusedState(false, false /* requestViewFocus */);
- }
- }
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.moveGridTaskViewFocus(null);
- }
- mFocusedTask = null;
- }
-
- /**
- * Returns the focused task.
- */
- public Task getFocusedTask() {
- return mFocusedTask;
- }
-
- /**
- * Returns the accessibility focused task.
- */
- Task getAccessibilityFocusedTask() {
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- if (Utilities.isDescendentAccessibilityFocused(tv)) {
- return tv.getTask();
- }
- }
- TaskView frontTv = getFrontMostTaskView();
- if (frontTv != null) {
- return frontTv.getTask();
- }
- return null;
- }
-
- @Override
- public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
- super.onInitializeAccessibilityEvent(event);
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- if (taskViewCount > 0) {
- TaskView backMostTask = taskViews.get(0);
- TaskView frontMostTask = taskViews.get(taskViewCount - 1);
- event.setFromIndex(mStack.indexOfTask(backMostTask.getTask()));
- event.setToIndex(mStack.indexOfTask(frontMostTask.getTask()));
- event.setContentDescription(frontMostTask.getTask().title);
- }
- event.setItemCount(mStack.getTaskCount());
-
- int stackHeight = mLayoutAlgorithm.mStackRect.height();
- event.setScrollY((int) (mStackScroller.getStackScroll() * stackHeight));
- event.setMaxScrollY((int) (mLayoutAlgorithm.mMaxScrollP * stackHeight));
- }
-
- @Override
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(info);
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- if (taskViewCount > 1) {
- // Find the accessibility focused task
- Task focusedTask = getAccessibilityFocusedTask();
- info.setScrollable(true);
- int focusedTaskIndex = mStack.indexOfTask(focusedTask);
- if (focusedTaskIndex > 0 || !mStackActionButtonVisible) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
- }
- if (0 <= focusedTaskIndex && focusedTaskIndex < mStack.getTaskCount() - 1) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
- }
- }
- }
-
- @Override
- public CharSequence getAccessibilityClassName() {
- return ScrollView.class.getName();
- }
-
- @Override
- public boolean performAccessibilityAction(int action, Bundle arguments) {
- if (super.performAccessibilityAction(action, arguments)) {
- return true;
- }
- Task focusedTask = getAccessibilityFocusedTask();
- int taskIndex = mStack.indexOfTask(focusedTask);
- if (0 <= taskIndex && taskIndex < mStack.getTaskCount()) {
- switch (action) {
- case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
- setFocusedTask(taskIndex + 1, true /* scrollToTask */, true /* requestViewFocus */,
- 0);
- return true;
- }
- case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
- setFocusedTask(taskIndex - 1, true /* scrollToTask */, true /* requestViewFocus */,
- 0);
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- return mTouchHandler.onInterceptTouchEvent(ev);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- return mTouchHandler.onTouchEvent(ev);
- }
-
- @Override
- public boolean onGenericMotionEvent(MotionEvent ev) {
- return mTouchHandler.onGenericMotionEvent(ev);
- }
-
- @Override
- public void computeScroll() {
- if (mStackScroller.computeScroll()) {
- // Notify accessibility
- sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SCROLLED);
- LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().setFlingingFast(
- mStackScroller.getScrollVelocity() > mFastFlingVelocity);
- }
- if (mDeferredTaskViewLayoutAnimation != null) {
- relayoutTaskViews(mDeferredTaskViewLayoutAnimation);
- mTaskViewsClipDirty = true;
- mDeferredTaskViewLayoutAnimation = null;
- }
- if (mTaskViewsClipDirty) {
- clipTaskViews();
- }
- mLastScrollPPercent = Utilities.clamp(Utilities.unmapRange(mStackScroller.getStackScroll(),
- mLayoutAlgorithm.mMinScrollP, mLayoutAlgorithm.mMaxScrollP), 0, 1);
- }
-
- /**
- * Computes the maximum number of visible tasks and thumbnails. Requires that
- * updateLayoutForStack() is called first.
- */
- public TaskStackLayoutAlgorithm.VisibilityReport computeStackVisibilityReport() {
- return mLayoutAlgorithm.computeStackVisibilityReport(mStack.getTasks());
- }
-
- /**
- * Updates the system insets.
- */
- public void setSystemInsets(Rect systemInsets) {
- boolean changed = false;
- changed |= mStableLayoutAlgorithm.setSystemInsets(systemInsets);
- changed |= mLayoutAlgorithm.setSystemInsets(systemInsets);
- if (changed) {
- requestLayout();
- }
- }
-
- /**
- * This is called with the full window width and height to allow stack view children to
- * perform the full screen transition down.
- */
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- mInMeasureLayout = true;
- int width = MeasureSpec.getSize(widthMeasureSpec);
- int height = MeasureSpec.getSize(heightMeasureSpec);
-
- // Update the stable stack bounds, but only update the current stack bounds if the stable
- // bounds have changed. This is because we may get spurious measures while dragging where
- // our current stack bounds reflect the target drop region.
- mLayoutAlgorithm.getTaskStackBounds(mDisplayRect, new Rect(0, 0, width, height),
- mLayoutAlgorithm.mSystemInsets.top, mLayoutAlgorithm.mSystemInsets.left,
- mLayoutAlgorithm.mSystemInsets.right, mTmpRect);
- if (!mTmpRect.equals(mStableStackBounds)) {
- mStableStackBounds.set(mTmpRect);
- mStackBounds.set(mTmpRect);
- mStableWindowRect.set(0, 0, width, height);
- mWindowRect.set(0, 0, width, height);
- }
-
- // Compute the rects in the stack algorithm
- mStableLayoutAlgorithm.initialize(mDisplayRect, mStableWindowRect, mStableStackBounds);
- mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds);
- updateLayoutAlgorithm(false /* boundScroll */);
-
- // If this is the first layout, then scroll to the front of the stack, then update the
- // TaskViews with the stack so that we can lay them out
- boolean resetToInitialState = (width != mLastWidth || height != mLastHeight)
- && mResetToInitialStateWhenResized;
- if (!mFinishedLayoutAfterStackReload || mInitialState != INITIAL_STATE_UPDATE_NONE
- || resetToInitialState) {
- if (mInitialState != INITIAL_STATE_UPDATE_LAYOUT_ONLY || resetToInitialState) {
- updateToInitialState();
- mResetToInitialStateWhenResized = false;
- }
- if (mFinishedLayoutAfterStackReload) {
- mInitialState = INITIAL_STATE_UPDATE_NONE;
- }
- }
- // If we got the launch-next event before the first layout pass, then re-send it after the
- // initial state has been updated
- if (mLaunchNextAfterFirstMeasure) {
- mLaunchNextAfterFirstMeasure = false;
- EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
- }
-
- // Rebind all the views, including the ignore ones
- bindVisibleTaskViews(mStackScroller.getStackScroll(), false /* ignoreTaskOverrides */);
-
- // Measure each of the TaskViews
- mTmpTaskViews.clear();
- mTmpTaskViews.addAll(getTaskViews());
- mTmpTaskViews.addAll(mViewPool.getViews());
- int taskViewCount = mTmpTaskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- measureTaskView(mTmpTaskViews.get(i));
- }
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.measure();
- }
-
- setMeasuredDimension(width, height);
- mLastWidth = width;
- mLastHeight = height;
- mInMeasureLayout = false;
- }
-
- /**
- * Measures a TaskView.
- */
- private void measureTaskView(TaskView tv) {
- Rect padding = new Rect();
- if (tv.getBackground() != null) {
- tv.getBackground().getPadding(padding);
- }
- mTmpRect.set(mStableLayoutAlgorithm.getTaskRect());
- mTmpRect.union(mLayoutAlgorithm.getTaskRect());
- tv.measure(
- MeasureSpec.makeMeasureSpec(mTmpRect.width() + padding.left + padding.right,
- MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(mTmpRect.height() + padding.top + padding.bottom,
- MeasureSpec.EXACTLY));
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- // Layout each of the TaskViews
- mTmpTaskViews.clear();
- mTmpTaskViews.addAll(getTaskViews());
- mTmpTaskViews.addAll(mViewPool.getViews());
- int taskViewCount = mTmpTaskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- layoutTaskView(changed, mTmpTaskViews.get(i));
- }
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.layout();
- }
-
- if (changed) {
- if (mStackScroller.isScrollOutOfBounds()) {
- mStackScroller.boundScroll();
- }
- }
-
- // Relayout all of the task views including the ignored ones
- relayoutTaskViews(AnimationProps.IMMEDIATE);
- clipTaskViews();
-
- if (!mFinishedLayoutAfterStackReload) {
- // Prepare the task enter animations (this can be called numerous times)
- mInitialState = INITIAL_STATE_UPDATE_NONE;
- onFirstLayout();
-
- if (mStackReloaded) {
- mFinishedLayoutAfterStackReload = true;
- tryStartEnterAnimation();
- }
- }
- }
-
- /**
- * Lays out a TaskView.
- */
- private void layoutTaskView(boolean changed, TaskView tv) {
- if (changed) {
- Rect padding = new Rect();
- if (tv.getBackground() != null) {
- tv.getBackground().getPadding(padding);
- }
- mTmpRect.set(mStableLayoutAlgorithm.getTaskRect());
- mTmpRect.union(mLayoutAlgorithm.getTaskRect());
- tv.cancelTransformAnimation();
- tv.layout(mTmpRect.left - padding.left, mTmpRect.top - padding.top,
- mTmpRect.right + padding.right, mTmpRect.bottom + padding.bottom);
- } else {
- // If the layout has not changed, then just lay it out again in-place
- tv.layout(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
- }
- }
-
- /** Handler for the first layout. */
- void onFirstLayout() {
- // Setup the view for the enter animation
- mAnimationHelper.prepareForEnterAnimation();
-
- // Set the task focused state without requesting view focus, and leave the focus animations
- // until after the enter-animation
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
-
- // We set the initial focused task view iff the following conditions are satisfied:
- // 1. Recents is showing task views in stack layout.
- // 2. Recents is launched with ALT + TAB.
- boolean setFocusOnFirstLayout = !useGridLayout() || launchState.launchedWithAltTab;
- if (setFocusOnFirstLayout) {
- int focusedTaskIndex = getInitialFocusTaskIndex(launchState, mStack.getTaskCount(),
- useGridLayout());
- if (focusedTaskIndex != -1) {
- setFocusedTask(focusedTaskIndex, false /* scrollToTask */,
- false /* requestViewFocus */);
- }
- }
- updateStackActionButtonVisibility();
- }
-
- public boolean isTouchPointInView(float x, float y, TaskView tv) {
- mTmpRect.set(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
- mTmpRect.offset((int) tv.getTranslationX(), (int) tv.getTranslationY());
- return mTmpRect.contains((int) x, (int) y);
- }
-
- /**
- * Returns a non-ignored task in the {@param tasks} list that can be used as an achor when
- * calculating the scroll position before and after a layout change.
- */
- public Task findAnchorTask(List<Task> tasks, MutableBoolean isFrontMostTask) {
- for (int i = tasks.size() - 1; i >= 0; i--) {
- Task task = tasks.get(i);
-
- // Ignore deleting tasks
- if (isIgnoredTask(task)) {
- if (i == tasks.size() - 1) {
- isFrontMostTask.value = true;
- }
- continue;
- }
- return task;
- }
- return null;
- }
-
- /**** TaskStackCallbacks Implementation ****/
-
- @Override
- public void onStackTaskAdded(TaskStack stack, Task newTask) {
- // Update the min/max scroll and animate other task views into their new positions
- updateLayoutAlgorithm(true /* boundScroll */);
-
- // Animate all the tasks into place
- relayoutTaskViews(!mFinishedLayoutAfterStackReload
- ? AnimationProps.IMMEDIATE
- : new AnimationProps(DEFAULT_SYNC_STACK_DURATION, Interpolators.FAST_OUT_SLOW_IN));
- }
-
- /**
- * We expect that the {@link TaskView} associated with the removed task is already hidden.
- */
- @Override
- public void onStackTaskRemoved(TaskStack stack, Task removedTask, Task newFrontMostTask,
- AnimationProps animation, boolean fromDockGesture, boolean dismissRecentsIfAllRemoved) {
- if (mFocusedTask == removedTask) {
- resetFocusedTask(removedTask);
- }
-
- // Remove the view associated with this task, we can't rely on updateTransforms
- // to work here because the task is no longer in the list
- TaskView tv = getChildViewForTask(removedTask);
- if (tv != null) {
- mViewPool.returnViewToPool(tv);
- }
-
- // Remove the task from the ignored set
- removeIgnoreTask(removedTask);
-
- // If requested, relayout with the given animation
- if (animation != null) {
- updateLayoutAlgorithm(true /* boundScroll */);
- relayoutTaskViews(animation);
- }
-
- // Update the new front most task's action button
- if (mScreenPinningEnabled && newFrontMostTask != null) {
- TaskView frontTv = getChildViewForTask(newFrontMostTask);
- if (frontTv != null) {
- frontTv.showActionButton(true /* fadeIn */, DEFAULT_SYNC_STACK_DURATION);
- }
- }
-
- // If there are no remaining tasks, then just close recents
- if (mStack.getTaskCount() == 0) {
- if (dismissRecentsIfAllRemoved) {
- EventBus.getDefault().send(new AllTaskViewsDismissedEvent(fromDockGesture
- ? R.string.recents_empty_message
- : R.string.recents_empty_message_dismissed_all));
- } else {
- EventBus.getDefault().send(new ShowEmptyViewEvent());
- }
- }
- }
-
- @Override
- public void onStackTasksRemoved(TaskStack stack) {
- // Reset the focused task
- resetFocusedTask(getFocusedTask());
-
- // Return all the views to the pool
- List<TaskView> taskViews = new ArrayList<>();
- taskViews.addAll(getTaskViews());
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- mViewPool.returnViewToPool(taskViews.get(i));
- }
-
- // Remove all the ignore tasks
- mIgnoreTasks.clear();
-
- // If there are no remaining tasks, then just close recents
- EventBus.getDefault().send(new AllTaskViewsDismissedEvent(
- R.string.recents_empty_message_dismissed_all));
- }
-
- @Override
- public void onStackTasksUpdated(TaskStack stack) {
- if (!mFinishedLayoutAfterStackReload) {
- return;
- }
-
- // Update the layout and immediately layout
- updateLayoutAlgorithm(false /* boundScroll */);
- relayoutTaskViews(AnimationProps.IMMEDIATE);
-
- // Rebind all the task views. This will not trigger new resources to be loaded
- // unless they have actually changed
- List<TaskView> taskViews = getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- bindTaskView(tv, tv.getTask());
- }
- }
-
- /**** ViewPoolConsumer Implementation ****/
-
- @Override
- public TaskView createView(Context context) {
- if (LegacyRecentsImpl.getConfiguration().isGridEnabled) {
- return (GridTaskView) mInflater.inflate(R.layout.recents_grid_task_view, this, false);
- } else {
- return (TaskView) mInflater.inflate(R.layout.recents_task_view, this, false);
- }
- }
-
- @Override
- public void onReturnViewToPool(TaskView tv) {
- final Task task = tv.getTask();
-
- // Unbind the task from the task view
- unbindTaskView(tv, task);
-
- // Reset the view properties and view state
- tv.clearAccessibilityFocus();
- tv.resetViewProperties();
- tv.setFocusedState(false, false /* requestViewFocus */);
- tv.setClipViewInStack(false);
- if (mScreenPinningEnabled) {
- tv.hideActionButton(false /* fadeOut */, 0 /* duration */, false /* scaleDown */, null);
- }
-
- // Detach the view from the hierarchy
- detachViewFromParent(tv);
- // Update the task views list after removing the task view
- updateTaskViewsList();
- }
-
- @Override
- public void onPickUpViewFromPool(TaskView tv, Task task, boolean isNewView) {
- // Find the index where this task should be placed in the stack
- int taskIndex = mStack.indexOfTask(task);
- int insertIndex = findTaskViewInsertIndex(task, taskIndex);
-
- // Add/attach the view to the hierarchy
- if (isNewView) {
- if (mInMeasureLayout) {
- // If we are measuring the layout, then just add the view normally as it will be
- // laid out during the layout pass
- addView(tv, insertIndex);
- } else {
- // Otherwise, this is from a bindVisibleTaskViews() call outside the measure/layout
- // pass, and we should layout the new child ourselves
- ViewGroup.LayoutParams params = tv.getLayoutParams();
- if (params == null) {
- params = generateDefaultLayoutParams();
- }
- addViewInLayout(tv, insertIndex, params, true /* preventRequestLayout */);
- measureTaskView(tv);
- layoutTaskView(true /* changed */, tv);
- }
- } else {
- attachViewToParent(tv, insertIndex, tv.getLayoutParams());
- }
- // Update the task views list after adding the new task view
- updateTaskViewsList();
-
- // Bind the task view to the new task
- bindTaskView(tv, task);
-
- // Set the new state for this view, including the callbacks and view clipping
- tv.setCallbacks(this);
- tv.setTouchEnabled(true);
- tv.setClipViewInStack(true);
- if (mFocusedTask == task) {
- tv.setFocusedState(true, false /* requestViewFocus */);
- if (mStartTimerIndicatorDuration > 0) {
- // The timer indicator couldn't be started before, so start it now
- tv.getHeaderView().startFocusTimerIndicator(mStartTimerIndicatorDuration);
- mStartTimerIndicatorDuration = 0;
- }
- }
-
- // Restore the action button visibility if it is the front most task view
- if (mScreenPinningEnabled && tv.getTask() == mStack.getFrontMostTask()) {
- tv.showActionButton(false /* fadeIn */, 0 /* fadeInDuration */);
- }
- }
-
- @Override
- public boolean hasPreferredData(TaskView tv, Task preferredData) {
- return (tv.getTask() == preferredData);
- }
-
- private void bindTaskView(TaskView tv, Task task) {
- // Rebind the task and request that this task's data be filled into the TaskView
- tv.onTaskBound(task, mTouchExplorationEnabled, mDisplayOrientation, mDisplayRect);
-
- // If the doze trigger has already fired, then update the state for this task view
- if (mUIDozeTrigger.isAsleep() ||
- useGridLayout() || LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- tv.setNoUserInteractionState();
- }
-
- if (task == mPrefetchingTask) {
- task.notifyTaskDataLoaded(task.thumbnail, task.icon);
- } else {
- // Load the task data
- LegacyRecentsImpl.getTaskLoader().loadTaskData(task);
- }
- LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().onTaskVisible(task);
- }
-
- private void unbindTaskView(TaskView tv, Task task) {
- if (task != mPrefetchingTask) {
- // Report that this task's data is no longer being used
- LegacyRecentsImpl.getTaskLoader().unloadTaskData(task);
- }
- LegacyRecentsImpl.getTaskLoader().getHighResThumbnailLoader().onTaskInvisible(task);
- }
-
- private void updatePrefetchingTask(ArrayList<Task> tasks, int frontIndex, int backIndex) {
- Task t = null;
- boolean somethingVisible = frontIndex != -1 && backIndex != -1;
- if (somethingVisible && frontIndex < tasks.size() - 1) {
- t = tasks.get(frontIndex + 1);
- }
- if (mPrefetchingTask != t) {
- if (mPrefetchingTask != null) {
- int index = tasks.indexOf(mPrefetchingTask);
- if (index < backIndex || index > frontIndex) {
- LegacyRecentsImpl.getTaskLoader().unloadTaskData(mPrefetchingTask);
- }
- }
- mPrefetchingTask = t;
- if (t != null) {
- LegacyRecentsImpl.getTaskLoader().loadTaskData(t);
- }
- }
- }
-
- private void clearPrefetchingTask() {
- if (mPrefetchingTask != null) {
- LegacyRecentsImpl.getTaskLoader().unloadTaskData(mPrefetchingTask);
- }
- mPrefetchingTask = null;
- }
-
- /**** TaskViewCallbacks Implementation ****/
-
- @Override
- public void onTaskViewClipStateChanged(TaskView tv) {
- if (!mTaskViewsClipDirty) {
- mTaskViewsClipDirty = true;
- invalidate();
- }
- }
-
- /**** TaskStackLayoutAlgorithm.TaskStackLayoutAlgorithmCallbacks ****/
-
- @Override
- public void onFocusStateChanged(int prevFocusState, int curFocusState) {
- if (mDeferredTaskViewLayoutAnimation == null) {
- mUIDozeTrigger.poke();
- relayoutTaskViewsOnNextFrame(AnimationProps.IMMEDIATE);
- }
- }
-
- /**** TaskStackViewScroller.TaskStackViewScrollerCallbacks ****/
-
- @Override
- public void onStackScrollChanged(float prevScroll, float curScroll, AnimationProps animation) {
- mUIDozeTrigger.poke();
- if (animation != null) {
- relayoutTaskViewsOnNextFrame(animation);
- }
-
- // In grid layout, the stack action button always remains visible.
- if (mEnterAnimationComplete && !useGridLayout()) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- // Show stack button when user drags down to show older tasks on low ram devices
- if (mStack.getTaskCount() > 0 && !mStackActionButtonVisible
- && mTouchHandler.mIsScrolling && curScroll - prevScroll < 0) {
- // Going up
- EventBus.getDefault().send(
- new ShowStackActionButtonEvent(true /* translate */));
- }
- return;
- }
- if (prevScroll > SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD &&
- curScroll <= SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD &&
- mStack.getTaskCount() > 0) {
- EventBus.getDefault().send(new ShowStackActionButtonEvent(true /* translate */));
- } else if (prevScroll < HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD &&
- curScroll >= HIDE_STACK_ACTION_BUTTON_SCROLL_THRESHOLD) {
- EventBus.getDefault().send(new HideStackActionButtonEvent());
- }
- }
- }
-
- /**** EventBus Events ****/
-
- public final void onBusEvent(PackagesChangedEvent event) {
- // Compute which components need to be removed
- ArraySet<ComponentName> removedComponents = mStack.computeComponentsRemoved(
- event.packageName, event.userId);
-
- // For other tasks, just remove them directly if they no longer exist
- ArrayList<Task> tasks = mStack.getTasks();
- for (int i = tasks.size() - 1; i >= 0; i--) {
- final Task t = tasks.get(i);
- if (removedComponents.contains(t.key.getComponent())) {
- final TaskView tv = getChildViewForTask(t);
- if (tv != null) {
- // For visible children, defer removing the task until after the animation
- tv.dismissTask();
- } else {
- // Otherwise, remove the task from the stack immediately
- mStack.removeTask(t, AnimationProps.IMMEDIATE, false /* fromDockGesture */);
- }
- }
- }
- }
-
- public final void onBusEvent(LaunchTaskEvent event) {
- // Cancel any doze triggers once a task is launched
- mUIDozeTrigger.stopDozing();
- }
-
- public final void onBusEvent(LaunchMostRecentTaskRequestEvent event) {
- if (mStack.getTaskCount() > 0) {
- Task mostRecentTask = mStack.getFrontMostTask();
- launchTask(mostRecentTask);
- }
- }
-
- public final void onBusEvent(ShowStackActionButtonEvent event) {
- mStackActionButtonVisible = true;
- }
-
- public final void onBusEvent(HideStackActionButtonEvent event) {
- mStackActionButtonVisible = false;
- }
-
- public final void onBusEvent(LaunchNextTaskRequestEvent event) {
- if (!mFinishedLayoutAfterStackReload) {
- mLaunchNextAfterFirstMeasure = true;
- return;
- }
-
- if (mStack.getTaskCount() == 0) {
- if (RecentsImpl.getLastPipTime() != -1) {
- EventBus.getDefault().send(new ExpandPipEvent());
- MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK,
- "pip");
- } else {
- // If there are no tasks, then just hide recents back to home.
- EventBus.getDefault().send(new HideRecentsEvent(false, true));
- }
- return;
- }
-
- if (!LegacyRecentsImpl.getConfiguration().getLaunchState().launchedFromPipApp
- && mStack.isNextLaunchTargetPip(RecentsImpl.getLastPipTime())) {
- // If the launch task is in the pinned stack, then expand the PiP now
- EventBus.getDefault().send(new ExpandPipEvent());
- MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK, "pip");
- } else {
- final Task launchTask = mStack.getNextLaunchTarget();
- if (launchTask != null) {
- // Defer launching the task until the PiP menu has been dismissed (if it is
- // showing at all)
- HidePipMenuEvent hideMenuEvent = new HidePipMenuEvent();
- hideMenuEvent.addPostAnimationCallback(() -> {
- launchTask(launchTask);
- });
- EventBus.getDefault().send(hideMenuEvent);
- MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_LAUNCH_PREVIOUS_TASK,
- launchTask.key.getComponent().toString());
- }
- }
- }
-
- public final void onBusEvent(LaunchTaskStartedEvent event) {
- mAnimationHelper.startLaunchTaskAnimation(event.taskView, event.screenPinningRequested,
- event.getAnimationTrigger());
- }
-
- public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
- // Stop any scrolling
- mTouchHandler.cancelNonDismissTaskAnimations();
- mStackScroller.stopScroller();
- mStackScroller.stopBoundScrollAnimation();
- cancelDeferredTaskViewLayoutAnimation();
-
- // Start the task animations
- mAnimationHelper.startExitToHomeAnimation(event.animated, event.getAnimationTrigger());
-
- // Dismiss the grid task view focus frame
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.moveGridTaskViewFocus(null);
- }
- }
-
- public final void onBusEvent(DismissFocusedTaskViewEvent event) {
- if (mFocusedTask != null) {
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.moveGridTaskViewFocus(null);
- }
- TaskView tv = getChildViewForTask(mFocusedTask);
- if (tv != null) {
- tv.dismissTask();
- }
- resetFocusedTask(mFocusedTask);
- }
- }
-
- public final void onBusEvent(DismissTaskViewEvent event) {
- // For visible children, defer removing the task until after the animation
- mAnimationHelper.startDeleteTaskAnimation(
- event.taskView, useGridLayout(), event.getAnimationTrigger());
- }
-
- public final void onBusEvent(final DismissAllTaskViewsEvent event) {
- // Keep track of the tasks which will have their data removed
- ArrayList<Task> tasks = new ArrayList<>(mStack.getTasks());
- mAnimationHelper.startDeleteAllTasksAnimation(
- getTaskViews(), useGridLayout(), event.getAnimationTrigger());
- event.addPostAnimationCallback(new Runnable() {
- @Override
- public void run() {
- // Announce for accessibility
- announceForAccessibility(getContext().getString(
- R.string.accessibility_recents_all_items_dismissed));
-
- // Remove all tasks and delete the task data for all tasks
- mStack.removeAllTasks(true /* notifyStackChanges */);
- for (int i = tasks.size() - 1; i >= 0; i--) {
- EventBus.getDefault().send(new DeleteTaskDataEvent(tasks.get(i)));
- }
-
- MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS_ALL);
- }
- });
-
- }
-
- public final void onBusEvent(TaskViewDismissedEvent event) {
- // Announce for accessibility
- announceForAccessibility(getContext().getString(
- R.string.accessibility_recents_item_dismissed, event.task.title));
-
- if (useGridLayout() && event.animation != null) {
- event.animation.setListener(new AnimatorListenerAdapter() {
- public void onAnimationEnd(Animator animator) {
- if (mTaskViewFocusFrame != null) {
- // Resize the grid layout task view focus frame
- mTaskViewFocusFrame.resize();
- }
- }
- });
- }
-
- // Remove the task from the stack
- mStack.removeTask(event.task, event.animation, false /* fromDockGesture */);
- EventBus.getDefault().send(new DeleteTaskDataEvent(event.task));
- if (mStack.getTaskCount() > 0 && LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- EventBus.getDefault().send(new ShowStackActionButtonEvent(false /* translate */));
- }
-
- MetricsLogger.action(getContext(), MetricsEvent.OVERVIEW_DISMISS,
- event.task.key.getComponent().toString());
- }
-
- public final void onBusEvent(FocusNextTaskViewEvent event) {
- // Stop any scrolling
- mStackScroller.stopScroller();
- mStackScroller.stopBoundScrollAnimation();
-
- setRelativeFocusedTask(true, false /* stackTasksOnly */, true /* animated */, false, 0);
- }
-
- public final void onBusEvent(FocusPreviousTaskViewEvent event) {
- // Stop any scrolling
- mStackScroller.stopScroller();
- mStackScroller.stopBoundScrollAnimation();
-
- setRelativeFocusedTask(false, false /* stackTasksOnly */, true /* animated */);
- }
-
- public final void onBusEvent(NavigateTaskViewEvent event) {
- if (useGridLayout()) {
- final int taskCount = mStack.getTaskCount();
- final int currentIndex = mStack.indexOfTask(getFocusedTask());
- final int nextIndex = mLayoutAlgorithm.mTaskGridLayoutAlgorithm.navigateFocus(taskCount,
- currentIndex, event.direction);
- setFocusedTask(nextIndex, false, true);
- } else {
- switch (event.direction) {
- case UP:
- EventBus.getDefault().send(new FocusPreviousTaskViewEvent());
- break;
- case DOWN:
- EventBus.getDefault().send(new FocusNextTaskViewEvent());
- break;
- }
- }
- }
-
- public final void onBusEvent(UserInteractionEvent event) {
- // Poke the doze trigger on user interaction
- mUIDozeTrigger.poke();
-
- RecentsDebugFlags debugFlags = LegacyRecentsImpl.getDebugFlags();
- if (mFocusedTask != null) {
- TaskView tv = getChildViewForTask(mFocusedTask);
- if (tv != null) {
- tv.getHeaderView().cancelFocusTimerIndicator();
- }
- }
- }
-
- public final void onBusEvent(DragStartEvent event) {
- // Ensure that the drag task is not animated
- addIgnoreTask(event.task);
-
- // Enlarge the dragged view slightly
- float finalScale = event.taskView.getScaleX() * DRAG_SCALE_FACTOR;
- mLayoutAlgorithm.getStackTransform(event.task, getScroller().getStackScroll(),
- mTmpTransform, null);
- mTmpTransform.scale = finalScale;
- mTmpTransform.translationZ = mLayoutAlgorithm.mMaxTranslationZ + 1;
- mTmpTransform.dimAlpha = 0f;
- updateTaskViewToTransform(event.taskView, mTmpTransform,
- new AnimationProps(DRAG_SCALE_DURATION, Interpolators.FAST_OUT_SLOW_IN));
- }
-
- public final void onBusEvent(DragDropTargetChangedEvent event) {
- AnimationProps animation = new AnimationProps(SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN);
- boolean ignoreTaskOverrides = false;
- if (event.dropTarget instanceof DockState) {
- // Calculate the new task stack bounds that matches the window size that Recents will
- // have after the drop
- final DockState dockState = (DockState) event.dropTarget;
- Rect systemInsets = new Rect(mStableLayoutAlgorithm.mSystemInsets);
- // When docked, the nav bar insets are consumed and the activity is measured without
- // insets. However, the window bounds include the insets, so we need to subtract them
- // here to make them identical.
- int height = getMeasuredHeight();
- height -= systemInsets.bottom;
- systemInsets.bottom = 0;
- mStackBounds.set(dockState.getDockedTaskStackBounds(mDisplayRect, getMeasuredWidth(),
- height, mDividerSize, systemInsets,
- mLayoutAlgorithm, getResources(), mWindowRect));
- mLayoutAlgorithm.setSystemInsets(systemInsets);
- mLayoutAlgorithm.initialize(mDisplayRect, mWindowRect, mStackBounds);
- updateLayoutAlgorithm(true /* boundScroll */);
- ignoreTaskOverrides = true;
- } else {
- // Restore the pre-drag task stack bounds, but ensure that we don't layout the dragging
- // task view, so add it back to the ignore set after updating the layout
- removeIgnoreTask(event.task);
- updateLayoutToStableBounds();
- addIgnoreTask(event.task);
- }
- relayoutTaskViews(animation, null /* animationOverrides */, ignoreTaskOverrides);
- }
-
- public final void onBusEvent(final DragEndEvent event) {
- // We don't handle drops on the dock regions
- if (event.dropTarget instanceof DockState) {
- // However, we do need to reset the overrides, since the last state of this task stack
- // view layout was ignoring task overrides (see DragDropTargetChangedEvent handler)
- mLayoutAlgorithm.clearUnfocusedTaskOverrides();
- return;
- }
-
- // Restore the task, so that relayout will apply to it below
- removeIgnoreTask(event.task);
-
- // Convert the dragging task view back to its final layout-space rect
- Utilities.setViewFrameFromTranslation(event.taskView);
-
- // Animate all the tasks into place
- ArrayMap<Task, AnimationProps> animationOverrides = new ArrayMap<>();
- animationOverrides.put(event.task, new AnimationProps(SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN,
- event.getAnimationTrigger().decrementOnAnimationEnd()));
- relayoutTaskViews(new AnimationProps(SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN));
- event.getAnimationTrigger().increment();
- }
-
- public final void onBusEvent(final DragEndCancelledEvent event) {
- // Restore the pre-drag task stack bounds, including the dragging task view
- removeIgnoreTask(event.task);
- updateLayoutToStableBounds();
-
- // Convert the dragging task view back to its final layout-space rect
- Utilities.setViewFrameFromTranslation(event.taskView);
-
- // Animate all the tasks into place
- ArrayMap<Task, AnimationProps> animationOverrides = new ArrayMap<>();
- animationOverrides.put(event.task, new AnimationProps(SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN,
- event.getAnimationTrigger().decrementOnAnimationEnd()));
- relayoutTaskViews(new AnimationProps(SLOW_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN));
- event.getAnimationTrigger().increment();
- }
-
- public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
- mEnterAnimationComplete = true;
- tryStartEnterAnimation();
- }
-
- private void tryStartEnterAnimation() {
- if (!mStackReloaded || !mFinishedLayoutAfterStackReload || !mEnterAnimationComplete) {
- return;
- }
-
- if (mStack.getTaskCount() > 0) {
- // Start the task enter animations
- ReferenceCountedTrigger trigger = new ReferenceCountedTrigger();
- mAnimationHelper.startEnterAnimation(trigger);
-
- // Add a runnable to the post animation ref counter to clear all the views
- trigger.addLastDecrementRunnable(() -> {
- // Start the dozer to trigger to trigger any UI that shows after a timeout
- mUIDozeTrigger.startDozing();
-
- // Update the focused state here -- since we only set the focused task without
- // requesting view focus in onFirstLayout(), actually request view focus and
- // animate the focused state if we are alt-tabbing now, after the window enter
- // animation is completed
- if (mFocusedTask != null) {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- RecentsActivityLaunchState launchState = config.getLaunchState();
- setFocusedTask(mStack.indexOfTask(mFocusedTask),
- false /* scrollToTask */, launchState.launchedWithAltTab);
- TaskView focusedTaskView = getChildViewForTask(mFocusedTask);
- if (mTouchExplorationEnabled && focusedTaskView != null) {
- focusedTaskView.requestAccessibilityFocus();
- }
- }
- });
- }
-
- // This flag is only used to choreograph the enter animation, so we can reset it here
- mStackReloaded = false;
- }
-
- public final void onBusEvent(final MultiWindowStateChangedEvent event) {
- if (event.inMultiWindow || !event.showDeferredAnimation) {
- setTasks(event.stack, true /* allowNotifyStackChanges */);
- } else {
- // Reset the launch state before handling the multiwindow change
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- launchState.reset();
-
- // Defer until the next frame to ensure that we have received all the system insets, and
- // initial layout updates
- event.getAnimationTrigger().increment();
- post(new Runnable() {
- @Override
- public void run() {
- // Scroll the stack to the front to see the undocked task
- mAnimationHelper.startNewStackScrollAnimation(event.stack,
- event.getAnimationTrigger());
- event.getAnimationTrigger().decrement();
- }
- });
- }
- }
-
- public final void onBusEvent(ConfigurationChangedEvent event) {
- if (event.fromDeviceOrientationChange) {
- mDisplayOrientation = Utilities.getAppConfiguration(mContext).orientation;
- mDisplayRect = LegacyRecentsImpl.getSystemServices().getDisplayRect();
-
- // Always stop the scroller, otherwise, we may continue setting the stack scroll to the
- // wrong bounds in the new layout
- mStackScroller.stopScroller();
- }
- reloadOnConfigurationChange();
-
- // Notify the task views of the configuration change so they can reload their resources
- if (!event.fromMultiWindow) {
- mTmpTaskViews.clear();
- mTmpTaskViews.addAll(getTaskViews());
- mTmpTaskViews.addAll(mViewPool.getViews());
- int taskViewCount = mTmpTaskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- mTmpTaskViews.get(i).onConfigurationChanged();
- }
- }
-
- // Update the Clear All button in case we're switching in or out of grid layout.
- updateStackActionButtonVisibility();
-
- // Trigger a new layout and update to the initial state if necessary. When entering split
- // screen, the multi-window configuration change event can happen after the stack is already
- // reloaded (but pending measure/layout), in this case, do not override the intiial state
- // and just wait for the upcoming measure/layout pass.
- if (event.fromMultiWindow && mInitialState == INITIAL_STATE_UPDATE_NONE) {
- mInitialState = INITIAL_STATE_UPDATE_LAYOUT_ONLY;
- requestLayout();
- } else if (event.fromDeviceOrientationChange) {
- mInitialState = INITIAL_STATE_UPDATE_ALL;
- requestLayout();
- }
- }
-
- public final void onBusEvent(RecentsGrowingEvent event) {
- mResetToInitialStateWhenResized = true;
- }
-
- public final void onBusEvent(RecentsVisibilityChangedEvent event) {
- if (!event.visible) {
- if (mTaskViewFocusFrame != null) {
- mTaskViewFocusFrame.moveGridTaskViewFocus(null);
- }
-
- List<TaskView> taskViews = new ArrayList<>(getTaskViews());
- for (int i = 0; i < taskViews.size(); i++) {
- mViewPool.returnViewToPool(taskViews.get(i));
- }
- clearPrefetchingTask();
-
- // We can not reset mEnterAnimationComplete in onReload() because when docking the top
- // task, we can receive the enter animation callback before onReload(), so reset it
- // here onces Recents is not visible
- mEnterAnimationComplete = false;
- }
- }
-
- public final void onBusEvent(ActivityPinnedEvent event) {
- // If an activity enters PiP while Recents is open, remove the stack task associated with
- // the new PiP task
- Task removeTask = mStack.findTaskWithId(event.taskId);
- if (removeTask != null) {
- // In this case, we remove the task, but if the last task is removed, don't dismiss
- // Recents to home
- mStack.removeTask(removeTask, AnimationProps.IMMEDIATE, false /* fromDockGesture */,
- false /* dismissRecentsIfAllRemoved */);
- }
- updateLayoutAlgorithm(false /* boundScroll */);
- updateToInitialState();
- }
-
- public void reloadOnConfigurationChange() {
- mStableLayoutAlgorithm.reloadOnConfigurationChange(getContext());
- mLayoutAlgorithm.reloadOnConfigurationChange(getContext());
- }
-
- /**
- * Returns the insert index for the task in the current set of task views. If the given task
- * is already in the task view list, then this method returns the insert index assuming it
- * is first removed at the previous index.
- *
- * @param task the task we are finding the index for
- * @param taskIndex the index of the task in the stack
- */
- private int findTaskViewInsertIndex(Task task, int taskIndex) {
- if (taskIndex != -1) {
- List<TaskView> taskViews = getTaskViews();
- boolean foundTaskView = false;
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- Task tvTask = taskViews.get(i).getTask();
- if (tvTask == task) {
- foundTaskView = true;
- } else if (taskIndex < mStack.indexOfTask(tvTask)) {
- if (foundTaskView) {
- return i - 1;
- } else {
- return i;
- }
- }
- }
- }
- return -1;
- }
-
- private void launchTask(Task task) {
- // Stop all animations
- cancelAllTaskViewAnimations();
-
- float curScroll = mStackScroller.getStackScroll();
- float targetScroll = mLayoutAlgorithm.getStackScrollForTaskAtInitialOffset(task);
- float absScrollDiff = Math.abs(targetScroll - curScroll);
- if (getChildViewForTask(task) == null || absScrollDiff > 0.35f) {
- int duration = (int) (LAUNCH_NEXT_SCROLL_BASE_DURATION +
- absScrollDiff * LAUNCH_NEXT_SCROLL_INCR_DURATION);
- mStackScroller.animateScroll(targetScroll,
- duration, new Runnable() {
- @Override
- public void run() {
- EventBus.getDefault().send(new LaunchTaskEvent(
- getChildViewForTask(task), task, null,
- false /* screenPinningRequested */));
- }
- });
- } else {
- EventBus.getDefault().send(new LaunchTaskEvent(getChildViewForTask(task), task, null,
- false /* screenPinningRequested */));
- }
- }
-
- /**
- * Check whether we should use the grid layout.
- */
- public boolean useGridLayout() {
- return mLayoutAlgorithm.useGridLayout();
- }
-
- /**
- * Reads current system flags related to accessibility and screen pinning.
- */
- private void readSystemFlags() {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- mTouchExplorationEnabled = ssp.isTouchExplorationEnabled();
- mScreenPinningEnabled = ActivityManagerWrapper.getInstance().isScreenPinningEnabled()
- && !ActivityManagerWrapper.getInstance().isLockToAppActive();
- }
-
- private void updateStackActionButtonVisibility() {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return;
- }
-
- // Always show the button in grid layout.
- if (useGridLayout() ||
- (mStackScroller.getStackScroll() < SHOW_STACK_ACTION_BUTTON_SCROLL_THRESHOLD &&
- mStack.getTaskCount() > 0)) {
- EventBus.getDefault().send(new ShowStackActionButtonEvent(false /* translate */));
- } else {
- EventBus.getDefault().send(new HideStackActionButtonEvent());
- }
- }
-
- /**
- * Returns the task to focus given the current launch state.
- */
- private int getInitialFocusTaskIndex(RecentsActivityLaunchState launchState, int numTasks,
- boolean useGridLayout) {
- if (launchState.launchedFromApp) {
- if (useGridLayout) {
- // If coming from another app to the grid layout, focus the front most task
- return numTasks - 1;
- }
-
- // If coming from another app, focus the next task
- return Math.max(0, numTasks - 2);
- } else {
- // If coming from home, focus the front most task
- return numTasks - 1;
- }
- }
-
- /**
- * Updates {@param transforms} to be the same size as {@param tasks}.
- */
- private void matchTaskListSize(List<Task> tasks, List<TaskViewTransform> transforms) {
- // We can reuse the task transforms where possible to reduce object allocation
- int taskTransformCount = transforms.size();
- int taskCount = tasks.size();
- if (taskTransformCount < taskCount) {
- // If there are less transforms than tasks, then add as many transforms as necessary
- for (int i = taskTransformCount; i < taskCount; i++) {
- transforms.add(new TaskViewTransform());
- }
- } else if (taskTransformCount > taskCount) {
- // If there are more transforms than tasks, then just subset the transform list
- transforms.subList(taskCount, taskTransformCount).clear();
- }
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
- String id = Integer.toHexString(System.identityHashCode(this));
-
- writer.print(prefix); writer.print(TAG);
- writer.print(" hasDefRelayout=");
- writer.print(mDeferredTaskViewLayoutAnimation != null ? "Y" : "N");
- writer.print(" clipDirty="); writer.print(mTaskViewsClipDirty ? "Y" : "N");
- writer.print(" awaitingStackReload="); writer.print(mFinishedLayoutAfterStackReload ? "Y" : "N");
- writer.print(" initialState="); writer.print(mInitialState);
- writer.print(" inMeasureLayout="); writer.print(mInMeasureLayout ? "Y" : "N");
- writer.print(" enterAnimCompleted="); writer.print(mEnterAnimationComplete ? "Y" : "N");
- writer.print(" touchExplorationOn="); writer.print(mTouchExplorationEnabled ? "Y" : "N");
- writer.print(" screenPinningOn="); writer.print(mScreenPinningEnabled ? "Y" : "N");
- writer.print(" numIgnoreTasks="); writer.print(mIgnoreTasks.size());
- writer.print(" numViewPool="); writer.print(mViewPool.getViews().size());
- writer.print(" stableStackBounds="); writer.print(
- Utilities.dumpRect(mStableStackBounds));
- writer.print(" stackBounds="); writer.print(
- Utilities.dumpRect(mStackBounds));
- writer.print(" stableWindow="); writer.print(
- Utilities.dumpRect(mStableWindowRect));
- writer.print(" window="); writer.print(Utilities.dumpRect(mWindowRect));
- writer.print(" display="); writer.print(Utilities.dumpRect(mDisplayRect));
- writer.print(" orientation="); writer.print(mDisplayOrientation);
- writer.print(" [0x"); writer.print(id); writer.print("]");
- writer.println();
-
- if (mFocusedTask != null) {
- writer.print(innerPrefix);
- writer.print("Focused task: ");
- mFocusedTask.dump("", writer);
- }
-
- int numTaskViews = mTaskViews.size();
- for (int i = 0; i < numTaskViews; i++) {
- mTaskViews.get(i).dump(innerPrefix, writer);
- }
-
- mLayoutAlgorithm.dump(innerPrefix, writer);
- mStackScroller.dump(innerPrefix, writer);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewScroller.java
deleted file mode 100644
index 42efe59..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewScroller.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.util.FloatProperty;
-import android.util.Log;
-import android.util.Property;
-import android.view.ViewConfiguration;
-import android.view.ViewDebug;
-import android.widget.OverScroller;
-
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.recents.views.lowram.TaskStackLowRamLayoutAlgorithm;
-import com.android.systemui.statusbar.FlingAnimationUtils;
-
-import java.io.PrintWriter;
-
-/* The scrolling logic for a TaskStackView */
-public class TaskStackViewScroller {
-
- private static final String TAG = "TaskStackViewScroller";
- private static final boolean DEBUG = false;
-
- public interface TaskStackViewScrollerCallbacks {
- void onStackScrollChanged(float prevScroll, float curScroll, AnimationProps animation);
- }
-
- /**
- * A Property wrapper around the <code>stackScroll</code> functionality handled by the
- * {@link #setStackScroll(float)} and
- * {@link #getStackScroll()} methods.
- */
- private static final Property<TaskStackViewScroller, Float> STACK_SCROLL =
- new FloatProperty<TaskStackViewScroller>("stackScroll") {
- @Override
- public void setValue(TaskStackViewScroller object, float value) {
- object.setStackScroll(value);
- }
-
- @Override
- public Float get(TaskStackViewScroller object) {
- return object.getStackScroll();
- }
- };
-
- Context mContext;
- TaskStackLayoutAlgorithm mLayoutAlgorithm;
- TaskStackViewScrollerCallbacks mCb;
-
- @ViewDebug.ExportedProperty(category="recents")
- float mStackScrollP;
- @ViewDebug.ExportedProperty(category="recents")
- float mLastDeltaP = 0f;
- float mFlingDownScrollP;
- int mFlingDownY;
-
- OverScroller mScroller;
- ObjectAnimator mScrollAnimator;
- float mFinalAnimatedScroll;
-
- final FlingAnimationUtils mFlingAnimationUtils;
-
- public TaskStackViewScroller(Context context, TaskStackViewScrollerCallbacks cb,
- TaskStackLayoutAlgorithm layoutAlgorithm) {
- mContext = context;
- mCb = cb;
- mScroller = new OverScroller(context);
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- mScroller.setFriction(0.06f);
- }
- mLayoutAlgorithm = layoutAlgorithm;
- mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
- }
-
- /** Resets the task scroller. */
- void reset() {
- mStackScrollP = 0f;
- mLastDeltaP = 0f;
- }
-
- void resetDeltaScroll() {
- mLastDeltaP = 0f;
- }
-
- /** Gets the current stack scroll */
- public float getStackScroll() {
- return mStackScrollP;
- }
-
- /**
- * Sets the current stack scroll immediately.
- */
- public void setStackScroll(float s) {
- setStackScroll(s, AnimationProps.IMMEDIATE);
- }
-
- /**
- * Sets the current stack scroll immediately, and returns the difference between the target
- * scroll and the actual scroll after accounting for the effect on the focus state.
- */
- public float setDeltaStackScroll(float downP, float deltaP) {
- float targetScroll = downP + deltaP;
- float newScroll = mLayoutAlgorithm.updateFocusStateOnScroll(downP + mLastDeltaP, targetScroll,
- mStackScrollP);
- setStackScroll(newScroll, AnimationProps.IMMEDIATE);
- mLastDeltaP = deltaP;
- return newScroll - targetScroll;
- }
-
- /**
- * Sets the current stack scroll, but indicates to the callback the preferred animation to
- * update to this new scroll.
- */
- public void setStackScroll(float newScroll, AnimationProps animation) {
- float prevScroll = mStackScrollP;
- mStackScrollP = newScroll;
- if (mCb != null) {
- mCb.onStackScrollChanged(prevScroll, mStackScrollP, animation);
- }
- }
-
- /**
- * Sets the current stack scroll to the initial state when you first enter recents.
- * @return whether the stack progress changed.
- */
- public boolean setStackScrollToInitialState() {
- float prevScroll = mStackScrollP;
- setStackScroll(mLayoutAlgorithm.mInitialScrollP);
- return Float.compare(prevScroll, mStackScrollP) != 0;
- }
-
- /**
- * Starts a fling that is coordinated with the {@link TaskStackViewTouchHandler}.
- */
- public void fling(float downScrollP, int downY, int y, int velY, int minY, int maxY,
- int overscroll) {
- if (DEBUG) {
- Log.d(TAG, "fling: " + downScrollP + ", downY: " + downY + ", y: " + y +
- ", velY: " + velY + ", minY: " + minY + ", maxY: " + maxY);
- }
- mFlingDownScrollP = downScrollP;
- mFlingDownY = downY;
- mScroller.fling(0, y, 0, velY, 0, 0, minY, maxY, 0, overscroll);
- }
-
- /** Bounds the current scroll if necessary */
- public boolean boundScroll() {
- float curScroll = getStackScroll();
- float newScroll = getBoundedStackScroll(curScroll);
- if (Float.compare(newScroll, curScroll) != 0) {
- setStackScroll(newScroll);
- return true;
- }
- return false;
- }
-
- /** Returns the bounded stack scroll */
- float getBoundedStackScroll(float scroll) {
- return Utilities.clamp(scroll, mLayoutAlgorithm.mMinScrollP, mLayoutAlgorithm.mMaxScrollP);
- }
-
- /** Returns the amount that the absolute value of how much the scroll is out of bounds. */
- float getScrollAmountOutOfBounds(float scroll) {
- if (scroll < mLayoutAlgorithm.mMinScrollP) {
- return Math.abs(scroll - mLayoutAlgorithm.mMinScrollP);
- } else if (scroll > mLayoutAlgorithm.mMaxScrollP) {
- return Math.abs(scroll - mLayoutAlgorithm.mMaxScrollP);
- }
- return 0f;
- }
-
- /** Returns whether the specified scroll is out of bounds */
- boolean isScrollOutOfBounds() {
- return Float.compare(getScrollAmountOutOfBounds(mStackScrollP), 0f) != 0;
- }
-
- /**
- * Scrolls the closest task and snaps into place. Only used in recents for low ram devices.
- * @param velocity of scroll
- */
- void scrollToClosestTask(int velocity) {
- float stackScroll = getStackScroll();
-
- // Skip if not in low ram layout and if the scroll is out of min and max bounds
- if (!LegacyRecentsImpl.getConfiguration().isLowRamDevice || stackScroll < mLayoutAlgorithm.mMinScrollP
- || stackScroll > mLayoutAlgorithm.mMaxScrollP) {
- return;
- }
- TaskStackLowRamLayoutAlgorithm algorithm = mLayoutAlgorithm.mTaskStackLowRamLayoutAlgorithm;
-
- float flingThreshold = ViewConfiguration.get(mContext).getScaledMinimumFlingVelocity();
- if (Math.abs(velocity) > flingThreshold) {
- int minY = algorithm.percentageToScroll(mLayoutAlgorithm.mMinScrollP);
- int maxY = algorithm.percentageToScroll(mLayoutAlgorithm.mMaxScrollP);
-
- // Calculate the fling and snap to closest task from final y position, computeScroll()
- // never runs when cancelled with animateScroll() and the overscroll is not calculated
- // here
- fling(0 /* downScrollP */, 0 /* downY */, algorithm.percentageToScroll(stackScroll),
- -velocity, minY, maxY, 0 /* overscroll */);
- float pos = algorithm.scrollToPercentage(mScroller.getFinalY());
-
- float newScrollP = algorithm.getClosestTaskP(pos, mLayoutAlgorithm.mNumStackTasks,
- velocity);
- ValueAnimator animator = ObjectAnimator.ofFloat(stackScroll, newScrollP);
- mFlingAnimationUtils.apply(animator, algorithm.percentageToScroll(stackScroll),
- algorithm.percentageToScroll(newScrollP), velocity);
- animateScroll(newScrollP, (int) animator.getDuration(), animator.getInterpolator(),
- null /* postRunnable */);
- } else {
- float newScrollP = algorithm.getClosestTaskP(stackScroll,
- mLayoutAlgorithm.mNumStackTasks, velocity);
- animateScroll(newScrollP, 300, Interpolators.ACCELERATE_DECELERATE,
- null /* postRunnable */);
- }
- }
-
- /** Animates the stack scroll into bounds */
- ObjectAnimator animateBoundScroll() {
- // TODO: Take duration for snap back
- float curScroll = getStackScroll();
- float newScroll = getBoundedStackScroll(curScroll);
- if (Float.compare(newScroll, curScroll) != 0) {
- // Start a new scroll animation
- animateScroll(newScroll, null /* postScrollRunnable */);
- }
- return mScrollAnimator;
- }
-
- /** Animates the stack scroll */
- void animateScroll(float newScroll, final Runnable postRunnable) {
- int duration = mContext.getResources().getInteger(
- R.integer.recents_animate_task_stack_scroll_duration);
- animateScroll(newScroll, duration, postRunnable);
- }
-
- /** Animates the stack scroll */
- void animateScroll(float newScroll, int duration, final Runnable postRunnable) {
- animateScroll(newScroll, duration, Interpolators.LINEAR_OUT_SLOW_IN, postRunnable);
- }
-
- /** Animates the stack scroll with time interpolator */
- void animateScroll(float newScroll, int duration, TimeInterpolator interpolator,
- final Runnable postRunnable) {
- ObjectAnimator an = ObjectAnimator.ofFloat(this, STACK_SCROLL, getStackScroll(), newScroll);
- an.setDuration(duration);
- an.setInterpolator(interpolator);
- animateScroll(newScroll, an, postRunnable);
- }
-
- /** Animates the stack scroll with animator */
- private void animateScroll(float newScroll, ObjectAnimator animator,
- final Runnable postRunnable) {
- // Finish any current scrolling animations
- if (mScrollAnimator != null && mScrollAnimator.isRunning()) {
- setStackScroll(mFinalAnimatedScroll);
- mScroller.forceFinished(true);
- }
- stopScroller();
- stopBoundScrollAnimation();
-
- if (Float.compare(mStackScrollP, newScroll) != 0) {
- mFinalAnimatedScroll = newScroll;
- mScrollAnimator = animator;
- mScrollAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (postRunnable != null) {
- postRunnable.run();
- }
- mScrollAnimator.removeAllListeners();
- }
- });
- mScrollAnimator.start();
- } else {
- if (postRunnable != null) {
- postRunnable.run();
- }
- }
- }
-
- /** Aborts any current stack scrolls */
- void stopBoundScrollAnimation() {
- Utilities.cancelAnimationWithoutCallbacks(mScrollAnimator);
- }
-
- /**** OverScroller ****/
-
- /** Called from the view draw, computes the next scroll. */
- boolean computeScroll() {
- if (mScroller.computeScrollOffset()) {
- float deltaP = mLayoutAlgorithm.getDeltaPForY(mFlingDownY, mScroller.getCurrY());
- mFlingDownScrollP += setDeltaStackScroll(mFlingDownScrollP, deltaP);
- if (DEBUG) {
- Log.d(TAG, "computeScroll: " + (mFlingDownScrollP + deltaP));
- }
- return true;
- }
- return false;
- }
-
- /** Returns whether the overscroller is scrolling. */
- boolean isScrolling() {
- return !mScroller.isFinished();
- }
-
- float getScrollVelocity() {
- return mScroller.getCurrVelocity();
- }
-
- /** Stops the scroller and any current fling. */
- void stopScroller() {
- if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- }
- }
-
- public void dump(String prefix, PrintWriter writer) {
- writer.print(prefix); writer.print(TAG);
- writer.print(" stackScroll:"); writer.print(mStackScrollP);
- writer.println();
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
deleted file mode 100644
index a7fb4fa..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Path;
-import android.util.ArrayMap;
-import android.util.MutableBoolean;
-import android.view.InputDevice;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewDebug;
-import android.view.ViewParent;
-import android.view.animation.Interpolator;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.SwipeHelper;
-import com.android.systemui.plugins.FalsingManager;
-import com.android.systemui.recents.Constants;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
-import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
-import com.android.systemui.recents.misc.FreePathInterpolator;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.statusbar.FlingAnimationUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Handles touch events for a TaskStackView.
- */
-class TaskStackViewTouchHandler implements SwipeHelper.Callback {
-
- private static final int INACTIVE_POINTER_ID = -1;
- private static final float CHALLENGING_SWIPE_ESCAPE_VELOCITY = 800f; // dp/sec
- // The min overscroll is the amount of task progress overscroll we want / the max overscroll
- // curve value below
- private static final float MAX_OVERSCROLL = 0.7f / 0.3f;
- private static final Interpolator OVERSCROLL_INTERP;
- static {
- Path OVERSCROLL_PATH = new Path();
- OVERSCROLL_PATH.moveTo(0, 0);
- OVERSCROLL_PATH.cubicTo(0.2f, 0.175f, 0.25f, 0.3f, 1f, 0.3f);
- OVERSCROLL_INTERP = new FreePathInterpolator(OVERSCROLL_PATH);
- }
-
- Context mContext;
- TaskStackView mSv;
- TaskStackViewScroller mScroller;
- VelocityTracker mVelocityTracker;
- FlingAnimationUtils mFlingAnimUtils;
- ValueAnimator mScrollFlingAnimator;
-
- @ViewDebug.ExportedProperty(category="recents")
- boolean mIsScrolling;
- float mDownScrollP;
- int mDownX, mDownY;
- int mLastY;
- int mActivePointerId = INACTIVE_POINTER_ID;
- int mOverscrollSize;
- TaskView mActiveTaskView = null;
-
- int mMinimumVelocity;
- int mMaximumVelocity;
- // The scroll touch slop is used to calculate when we start scrolling
- int mScrollTouchSlop;
- // Used to calculate when a tap is outside a task view rectangle.
- final int mWindowTouchSlop;
-
- private final StackViewScrolledEvent mStackViewScrolledEvent = new StackViewScrolledEvent();
-
- // The current and final set of task transforms, sized to match the list of tasks in the stack
- private ArrayList<Task> mCurrentTasks = new ArrayList<>();
- private ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<>();
- private ArrayList<TaskViewTransform> mFinalTaskTransforms = new ArrayList<>();
- private ArrayMap<View, Animator> mSwipeHelperAnimations = new ArrayMap<>();
- private TaskViewTransform mTmpTransform = new TaskViewTransform();
- private float mTargetStackScroll;
-
- SwipeHelper mSwipeHelper;
- boolean mInterceptedBySwipeHelper;
-
- public TaskStackViewTouchHandler(Context context, TaskStackView sv,
- TaskStackViewScroller scroller, FalsingManager falsingManager) {
- Resources res = context.getResources();
- ViewConfiguration configuration = ViewConfiguration.get(context);
- mContext = context;
- mSv = sv;
- mScroller = scroller;
- mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
- mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
- mScrollTouchSlop = configuration.getScaledTouchSlop();
- mWindowTouchSlop = configuration.getScaledWindowTouchSlop();
- mFlingAnimUtils = new FlingAnimationUtils(context, 0.2f);
- mOverscrollSize = res.getDimensionPixelSize(R.dimen.recents_fling_overscroll_distance);
- mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, context, falsingManager) {
- @Override
- protected float getSize(View v) {
- return getScaledDismissSize();
- }
-
- @Override
- protected void prepareDismissAnimation(View v, Animator anim) {
- mSwipeHelperAnimations.put(v, anim);
- }
-
- @Override
- protected void prepareSnapBackAnimation(View v, Animator anim) {
- anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
- mSwipeHelperAnimations.put(v, anim);
- }
-
- @Override
- protected float getUnscaledEscapeVelocity() {
- return CHALLENGING_SWIPE_ESCAPE_VELOCITY;
- }
-
- @Override
- protected long getMaxEscapeAnimDuration() {
- return 700;
- }
- };
- mSwipeHelper.setDisableHardwareLayers(true);
- }
-
- /** Velocity tracker helpers */
- void initOrResetVelocityTracker() {
- if (mVelocityTracker == null) {
- mVelocityTracker = VelocityTracker.obtain();
- } else {
- mVelocityTracker.clear();
- }
- }
- void recycleVelocityTracker() {
- if (mVelocityTracker != null) {
- mVelocityTracker.recycle();
- mVelocityTracker = null;
- }
- }
-
- /** Touch preprocessing for handling below */
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- // Pass through to swipe helper if we are swiping
- mInterceptedBySwipeHelper = isSwipingEnabled() && mSwipeHelper.onInterceptTouchEvent(ev);
- if (mInterceptedBySwipeHelper) {
- return true;
- }
-
- return handleTouchEvent(ev);
- }
-
- /** Handles touch events once we have intercepted them */
- public boolean onTouchEvent(MotionEvent ev) {
- // Pass through to swipe helper if we are swiping
- if (mInterceptedBySwipeHelper && mSwipeHelper.onTouchEvent(ev)) {
- return true;
- }
-
- handleTouchEvent(ev);
- return true;
- }
-
- /**
- * Finishes all scroll-fling and non-dismissing animations currently running.
- */
- public void cancelNonDismissTaskAnimations() {
- Utilities.cancelAnimationWithoutCallbacks(mScrollFlingAnimator);
- if (!mSwipeHelperAnimations.isEmpty()) {
- // For the non-dismissing tasks, freeze the position into the task overrides
- List<TaskView> taskViews = mSv.getTaskViews();
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- TaskView tv = taskViews.get(i);
-
- if (mSv.isIgnoredTask(tv.getTask())) {
- continue;
- }
-
- tv.cancelTransformAnimation();
- mSv.getStackAlgorithm().addUnfocusedTaskOverride(tv, mTargetStackScroll);
- }
- mSv.getStackAlgorithm().setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
- // Update the scroll to the final scroll position from onBeginDrag()
- mSv.getScroller().setStackScroll(mTargetStackScroll, null);
-
- mSwipeHelperAnimations.clear();
- }
- mActiveTaskView = null;
- }
-
- private boolean handleTouchEvent(MotionEvent ev) {
- // Short circuit if we have no children
- if (mSv.getTaskViews().size() == 0) {
- return false;
- }
-
- final TaskStackLayoutAlgorithm layoutAlgorithm = mSv.mLayoutAlgorithm;
- int action = ev.getAction();
- switch (action & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_DOWN: {
- // Stop the current scroll if it is still flinging
- mScroller.stopScroller();
- mScroller.stopBoundScrollAnimation();
- mScroller.resetDeltaScroll();
- cancelNonDismissTaskAnimations();
- mSv.cancelDeferredTaskViewLayoutAnimation();
-
- // Save the touch down info
- mDownX = (int) ev.getX();
- mDownY = (int) ev.getY();
- mLastY = mDownY;
- mDownScrollP = mScroller.getStackScroll();
- mActivePointerId = ev.getPointerId(0);
- mActiveTaskView = findViewAtPoint(mDownX, mDownY);
-
- // Initialize the velocity tracker
- initOrResetVelocityTracker();
- mVelocityTracker.addMovement(ev);
- break;
- }
- case MotionEvent.ACTION_POINTER_DOWN: {
- final int index = ev.getActionIndex();
- mActivePointerId = ev.getPointerId(index);
- mDownX = (int) ev.getX(index);
- mDownY = (int) ev.getY(index);
- mLastY = mDownY;
- mDownScrollP = mScroller.getStackScroll();
- mScroller.resetDeltaScroll();
- mVelocityTracker.addMovement(ev);
- break;
- }
- case MotionEvent.ACTION_MOVE: {
- int activePointerIndex = ev.findPointerIndex(mActivePointerId);
- if (activePointerIndex == -1) {
- break;
- }
- int y = (int) ev.getY(activePointerIndex);
- int x = (int) ev.getX(activePointerIndex);
- if (!mIsScrolling) {
- int yDiff = Math.abs(y - mDownY);
- int xDiff = Math.abs(x - mDownX);
- if (Math.abs(y - mDownY) > mScrollTouchSlop && yDiff > xDiff) {
- mIsScrolling = true;
- float stackScroll = mScroller.getStackScroll();
- List<TaskView> taskViews = mSv.getTaskViews();
- for (int i = taskViews.size() - 1; i >= 0; i--) {
- layoutAlgorithm.addUnfocusedTaskOverride(taskViews.get(i).getTask(),
- stackScroll);
- }
- layoutAlgorithm.setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
-
- // Disallow parents from intercepting touch events
- final ViewParent parent = mSv.getParent();
- if (parent != null) {
- parent.requestDisallowInterceptTouchEvent(true);
- }
-
- MetricsLogger.action(mSv.getContext(), MetricsEvent.OVERVIEW_SCROLL);
- mLastY = mDownY = y;
- }
- }
- if (mIsScrolling) {
- // If we just move linearly on the screen, then that would map to 1/arclength
- // of the curve, so just move the scroll proportional to that
- float deltaP = layoutAlgorithm.getDeltaPForY(mDownY, y);
-
- // Modulate the overscroll to prevent users from pulling the stack too far
- float minScrollP = layoutAlgorithm.mMinScrollP;
- float maxScrollP = layoutAlgorithm.mMaxScrollP;
- float curScrollP = mDownScrollP + deltaP;
- if (curScrollP < minScrollP || curScrollP > maxScrollP) {
- float clampedScrollP = Utilities.clamp(curScrollP, minScrollP, maxScrollP);
- float overscrollP = (curScrollP - clampedScrollP);
- float maxOverscroll = LegacyRecentsImpl.getConfiguration().isLowRamDevice
- ? layoutAlgorithm.mTaskStackLowRamLayoutAlgorithm.getMaxOverscroll()
- : MAX_OVERSCROLL;
- float overscrollX = Math.abs(overscrollP) / maxOverscroll;
- float interpX = OVERSCROLL_INTERP.getInterpolation(overscrollX);
- curScrollP = clampedScrollP + Math.signum(overscrollP) *
- (interpX * maxOverscroll);
- }
- mDownScrollP += mScroller.setDeltaStackScroll(mDownScrollP,
- curScrollP - mDownScrollP);
- mStackViewScrolledEvent.updateY(y - mLastY);
- EventBus.getDefault().send(mStackViewScrolledEvent);
- }
-
- mLastY = y;
- mVelocityTracker.addMovement(ev);
- break;
- }
- case MotionEvent.ACTION_POINTER_UP: {
- int pointerIndex = ev.getActionIndex();
- int pointerId = ev.getPointerId(pointerIndex);
- if (pointerId == mActivePointerId) {
- // Select a new active pointer id and reset the motion state
- final int newPointerIndex = (pointerIndex == 0) ? 1 : 0;
- mActivePointerId = ev.getPointerId(newPointerIndex);
- mDownX = (int) ev.getX(pointerIndex);
- mDownY = (int) ev.getY(pointerIndex);
- mLastY = mDownY;
- mDownScrollP = mScroller.getStackScroll();
- }
- mVelocityTracker.addMovement(ev);
- break;
- }
- case MotionEvent.ACTION_UP: {
- mVelocityTracker.addMovement(ev);
- mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
- int activePointerIndex = ev.findPointerIndex(mActivePointerId);
- int y = (int) ev.getY(activePointerIndex);
- int velocity = (int) mVelocityTracker.getYVelocity(mActivePointerId);
- if (mIsScrolling) {
- if (mScroller.isScrollOutOfBounds()) {
- mScroller.animateBoundScroll();
- } else if (Math.abs(velocity) > mMinimumVelocity &&
- !LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- float minY = mDownY + layoutAlgorithm.getYForDeltaP(mDownScrollP,
- layoutAlgorithm.mMaxScrollP);
- float maxY = mDownY + layoutAlgorithm.getYForDeltaP(mDownScrollP,
- layoutAlgorithm.mMinScrollP);
- mScroller.fling(mDownScrollP, mDownY, y, velocity, (int) minY, (int) maxY,
- mOverscrollSize);
- mSv.invalidate();
- }
-
- // Reset the focused task after the user has scrolled, but we have no scrolling
- // in grid layout and therefore we don't want to reset the focus there.
- if (!mSv.mTouchExplorationEnabled && !mSv.useGridLayout()) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- mScroller.scrollToClosestTask(velocity);
- } else {
- mSv.resetFocusedTask(mSv.getFocusedTask());
- }
- }
- } else if (mActiveTaskView == null) {
- // This tap didn't start on a task.
- maybeHideRecentsFromBackgroundTap((int) ev.getX(), (int) ev.getY());
- }
-
- mActivePointerId = INACTIVE_POINTER_ID;
- mIsScrolling = false;
- recycleVelocityTracker();
- break;
- }
- case MotionEvent.ACTION_CANCEL: {
- mActivePointerId = INACTIVE_POINTER_ID;
- mIsScrolling = false;
- recycleVelocityTracker();
- break;
- }
- }
- return mIsScrolling;
- }
-
- /** Hides recents if the up event at (x, y) is a tap on the background area. */
- void maybeHideRecentsFromBackgroundTap(int x, int y) {
- // Ignore the up event if it's too far from its start position. The user might have been
- // trying to scroll or swipe.
- int dx = Math.abs(mDownX - x);
- int dy = Math.abs(mDownY - y);
- if (dx > mScrollTouchSlop || dy > mScrollTouchSlop) {
- return;
- }
-
- // Shift the tap position toward the center of the task stack and check to see if it would
- // have hit a view. The user might have tried to tap on a task and missed slightly.
- int shiftedX = x;
- if (x > (mSv.getRight() - mSv.getLeft()) / 2) {
- shiftedX -= mWindowTouchSlop;
- } else {
- shiftedX += mWindowTouchSlop;
- }
- if (findViewAtPoint(shiftedX, y) != null) {
- return;
- }
-
- // Disallow tapping above and below the stack to dismiss recents
- if (x > mSv.mLayoutAlgorithm.mStackRect.left && x < mSv.mLayoutAlgorithm.mStackRect.right) {
- return;
- }
-
- // The user intentionally tapped on the background, which is like a tap on the "desktop".
- // Hide recents and transition to the launcher.
- EventBus.getDefault().send(new HideRecentsEvent(false, true));
- }
-
- /** Handles generic motion events */
- public boolean onGenericMotionEvent(MotionEvent ev) {
- if ((ev.getSource() & InputDevice.SOURCE_CLASS_POINTER) ==
- InputDevice.SOURCE_CLASS_POINTER) {
- int action = ev.getAction();
- switch (action & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_SCROLL:
- // Find the front most task and scroll the next task to the front
- float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
- if (vScroll > 0) {
- mSv.setRelativeFocusedTask(true, true /* stackTasksOnly */,
- false /* animated */);
- } else {
- mSv.setRelativeFocusedTask(false, true /* stackTasksOnly */,
- false /* animated */);
- }
- return true;
- }
- }
- return false;
- }
-
- /**** SwipeHelper Implementation ****/
-
- @Override
- public View getChildAtPosition(MotionEvent ev) {
- TaskView tv = findViewAtPoint((int) ev.getX(), (int) ev.getY());
- if (tv != null && canChildBeDismissed(tv)) {
- return tv;
- }
- return null;
- }
-
- @Override
- public boolean canChildBeDismissed(View v) {
- // Disallow dismissing an already dismissed task
- TaskView tv = (TaskView) v;
- Task task = tv.getTask();
- return !mSwipeHelperAnimations.containsKey(v) &&
- (mSv.getStack().indexOfTask(task) != -1);
- }
-
- /**
- * Starts a manual drag that goes through the same swipe helper path.
- */
- public void onBeginManualDrag(TaskView v) {
- mActiveTaskView = v;
- mSwipeHelperAnimations.put(v, null);
- onBeginDrag(v);
- }
-
- @Override
- public void onBeginDrag(View v) {
- TaskView tv = (TaskView) v;
-
- // Disable clipping with the stack while we are swiping
- tv.setClipViewInStack(false);
- // Disallow touch events from this task view
- tv.setTouchEnabled(false);
- // Disallow parents from intercepting touch events
- final ViewParent parent = mSv.getParent();
- if (parent != null) {
- parent.requestDisallowInterceptTouchEvent(true);
- }
-
- // Add this task to the set of tasks we are deleting
- mSv.addIgnoreTask(tv.getTask());
-
- // Determine if we are animating the other tasks while dismissing this task
- mCurrentTasks = new ArrayList<Task>(mSv.getStack().getTasks());
- MutableBoolean isFrontMostTask = new MutableBoolean(false);
- Task anchorTask = mSv.findAnchorTask(mCurrentTasks, isFrontMostTask);
- TaskStackLayoutAlgorithm layoutAlgorithm = mSv.getStackAlgorithm();
- TaskStackViewScroller stackScroller = mSv.getScroller();
- if (anchorTask != null) {
- // Get the current set of task transforms
- mSv.getCurrentTaskTransforms(mCurrentTasks, mCurrentTaskTransforms);
-
- // Get the stack scroll of the task to anchor to (since we are removing something, the
- // front most task will be our anchor task)
- float prevAnchorTaskScroll = 0;
- boolean pullStackForward = mCurrentTasks.size() > 0;
- if (pullStackForward) {
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- float index = layoutAlgorithm.getStackScrollForTask(anchorTask);
- prevAnchorTaskScroll = mSv.getStackAlgorithm().mTaskStackLowRamLayoutAlgorithm
- .getScrollPForTask((int) index);
- } else {
- prevAnchorTaskScroll = layoutAlgorithm.getStackScrollForTask(anchorTask);
- }
- }
-
- // Calculate where the views would be without the deleting tasks
- mSv.updateLayoutAlgorithm(false /* boundScroll */);
-
- float newStackScroll = stackScroller.getStackScroll();
- if (isFrontMostTask.value) {
- // Bound the stack scroll to pull tasks forward if necessary
- newStackScroll = stackScroller.getBoundedStackScroll(newStackScroll);
- } else if (pullStackForward) {
- // Otherwise, offset the scroll by the movement of the anchor task
- float anchorTaskScroll =
- layoutAlgorithm.getStackScrollForTaskIgnoreOverrides(anchorTask);
- if (LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- float index = layoutAlgorithm.getStackScrollForTask(anchorTask);
- anchorTaskScroll = mSv.getStackAlgorithm().mTaskStackLowRamLayoutAlgorithm
- .getScrollPForTask((int) index);
- }
- float stackScrollOffset = (anchorTaskScroll - prevAnchorTaskScroll);
- if (layoutAlgorithm.getFocusState() != TaskStackLayoutAlgorithm.STATE_FOCUSED
- && !LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- // If we are focused, we don't want the front task to move, but otherwise, we
- // allow the back task to move up, and the front task to move back
- stackScrollOffset *= 0.75f;
- }
- newStackScroll = stackScroller.getBoundedStackScroll(stackScroller.getStackScroll()
- + stackScrollOffset);
- }
-
- // Pick up the newly visible views, not including the deleting tasks
- mSv.bindVisibleTaskViews(newStackScroll, true /* ignoreTaskOverrides */);
-
- // Get the final set of task transforms (with task removed)
- mSv.getLayoutTaskTransforms(newStackScroll, TaskStackLayoutAlgorithm.STATE_UNFOCUSED,
- mCurrentTasks, true /* ignoreTaskOverrides */, mFinalTaskTransforms);
-
- // Set the target to scroll towards upon dismissal
- mTargetStackScroll = newStackScroll;
-
- /*
- * Post condition: All views that will be visible as a part of the gesture are retrieved
- * and at their initial positions. The stack is still at the current
- * scroll, but the layout is updated without the task currently being
- * dismissed. The final layout is in the unfocused stack state, which
- * will be applied when the current task is dismissed.
- */
- }
- }
-
- @Override
- public boolean updateSwipeProgress(View v, boolean dismissable, float swipeProgress) {
- // Only update the swipe progress for the surrounding tasks if the dismiss animation was not
- // preempted from a call to cancelNonDismissTaskAnimations
- if ((mActiveTaskView == v || mSwipeHelperAnimations.containsKey(v)) &&
- !LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- updateTaskViewTransforms(
- Interpolators.FAST_OUT_SLOW_IN.getInterpolation(swipeProgress));
- }
- return true;
- }
-
- /**
- * Called after the {@link TaskView} is finished animating away.
- */
- @Override
- public void onChildDismissed(View v) {
- TaskView tv = (TaskView) v;
-
- // Re-enable clipping with the stack (we will reuse this view)
- tv.setClipViewInStack(true);
- // Re-enable touch events from this task view
- tv.setTouchEnabled(true);
- // Update the scroll to the final scroll position before laying out the tasks during dismiss
- if (mSwipeHelperAnimations.containsKey(v)) {
- mSv.getScroller().setStackScroll(mTargetStackScroll, null);
- }
- // Remove the task view from the stack, ignoring the animation if we've started dragging
- // again
- EventBus.getDefault().send(new TaskViewDismissedEvent(tv.getTask(), tv,
- mSwipeHelperAnimations.containsKey(v)
- ? new AnimationProps(TaskStackView.DEFAULT_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN)
- : null));
- // Only update the final scroll and layout state (set in onBeginDrag()) if the dismiss
- // animation was not preempted from a call to cancelNonDismissTaskAnimations
- if (mSwipeHelperAnimations.containsKey(v)) {
- // Update the focus state to the final focus state
- mSv.getStackAlgorithm().setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
- mSv.getStackAlgorithm().clearUnfocusedTaskOverrides();
- // Stop tracking this deletion animation
- mSwipeHelperAnimations.remove(v);
- }
- // Keep track of deletions by keyboard
- MetricsLogger.histogram(tv.getContext(), "overview_task_dismissed_source",
- Constants.Metrics.DismissSourceSwipeGesture);
- }
-
- /**
- * Called after the {@link TaskView} is finished animating back into the list.
- * onChildDismissed() calls.
- */
- @Override
- public void onChildSnappedBack(View v, float targetLeft) {
- TaskView tv = (TaskView) v;
-
- // Re-enable clipping with the stack
- tv.setClipViewInStack(true);
- // Re-enable touch events from this task view
- tv.setTouchEnabled(true);
-
- // Stop tracking this deleting task, and update the layout to include this task again. The
- // stack scroll does not need to be reset, since the scroll has not actually changed in
- // onBeginDrag().
- mSv.removeIgnoreTask(tv.getTask());
- mSv.updateLayoutAlgorithm(false /* boundScroll */);
- mSv.relayoutTaskViews(AnimationProps.IMMEDIATE);
- mSwipeHelperAnimations.remove(v);
- }
-
- @Override
- public void onDragCancelled(View v) {
- // Do nothing
- }
-
- @Override
- public boolean isAntiFalsingNeeded() {
- return false;
- }
-
- @Override
- public float getFalsingThresholdFactor() {
- return 0;
- }
-
- /**
- * Interpolates the non-deleting tasks to their final transforms from their current transforms.
- */
- private void updateTaskViewTransforms(float dismissFraction) {
- List<TaskView> taskViews = mSv.getTaskViews();
- int taskViewCount = taskViews.size();
- for (int i = 0; i < taskViewCount; i++) {
- TaskView tv = taskViews.get(i);
- Task task = tv.getTask();
-
- if (mSv.isIgnoredTask(task)) {
- continue;
- }
-
- int taskIndex = mCurrentTasks.indexOf(task);
- if (taskIndex == -1) {
- // If a task was added to the stack view after the start of the dismiss gesture,
- // just ignore it
- continue;
- }
-
- TaskViewTransform fromTransform = mCurrentTaskTransforms.get(taskIndex);
- TaskViewTransform toTransform = mFinalTaskTransforms.get(taskIndex);
-
- mTmpTransform.copyFrom(fromTransform);
- // We only really need to interpolate the bounds, progress and translation
- mTmpTransform.rect.set(Utilities.RECTF_EVALUATOR.evaluate(dismissFraction,
- fromTransform.rect, toTransform.rect));
- mTmpTransform.dimAlpha = fromTransform.dimAlpha + (toTransform.dimAlpha -
- fromTransform.dimAlpha) * dismissFraction;
- mTmpTransform.viewOutlineAlpha = fromTransform.viewOutlineAlpha +
- (toTransform.viewOutlineAlpha - fromTransform.viewOutlineAlpha) *
- dismissFraction;
- mTmpTransform.translationZ = fromTransform.translationZ +
- (toTransform.translationZ - fromTransform.translationZ) * dismissFraction;
-
- mSv.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
- }
- }
-
- /** Returns the view at the specified coordinates */
- private TaskView findViewAtPoint(int x, int y) {
- List<Task> tasks = mSv.getStack().getTasks();
- int taskCount = tasks.size();
- for (int i = taskCount - 1; i >= 0; i--) {
- TaskView tv = mSv.getChildViewForTask(tasks.get(i));
- if (tv != null && tv.getVisibility() == View.VISIBLE) {
- if (mSv.isTouchPointInView(x, y, tv)) {
- return tv;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the scaled size used to calculate the dismiss fraction.
- */
- public float getScaledDismissSize() {
- return 1.5f * Math.max(mSv.getWidth(), mSv.getHeight());
- }
-
- /**
- * Returns whether swiping is enabled.
- */
- private boolean isSwipingEnabled() {
- return !mSv.useGridLayout();
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskView.java
deleted file mode 100644
index ab0bf95..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskView.java
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Outline;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.util.FloatProperty;
-import android.util.Property;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewDebug;
-import android.view.ViewOutlineProvider;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivity;
-import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.LaunchTaskEvent;
-import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
-import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndCancelledEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
-import com.android.systemui.recents.misc.ReferenceCountedTrigger;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-/**
- * A {@link TaskView} represents a fixed view of a task. Because the TaskView's layout is directed
- * solely by the {@link TaskStackView}, we make it a fixed size layout which allows relayouts down
- * the view hierarchy, but not upwards from any of its children (the TaskView will relayout itself
- * with the previous bounds if any child requests layout).
- */
-public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks,
- TaskStackAnimationHelper.Callbacks, View.OnClickListener, View.OnLongClickListener {
-
- /** The TaskView callbacks */
- interface TaskViewCallbacks {
- void onTaskViewClipStateChanged(TaskView tv);
- }
-
- /**
- * The dim overlay is generally calculated from the task progress, but occasionally (like when
- * launching) needs to be animated independently of the task progress. This call is only used
- * when animating the task into Recents, when the header dim is already applied
- */
- public static final Property<TaskView, Float> DIM_ALPHA_WITHOUT_HEADER =
- new FloatProperty<TaskView>("dimAlphaWithoutHeader") {
- @Override
- public void setValue(TaskView tv, float dimAlpha) {
- tv.setDimAlphaWithoutHeader(dimAlpha);
- }
-
- @Override
- public Float get(TaskView tv) {
- return tv.getDimAlpha();
- }
- };
-
- /**
- * The dim overlay is generally calculated from the task progress, but occasionally (like when
- * launching) needs to be animated independently of the task progress.
- */
- public static final Property<TaskView, Float> DIM_ALPHA =
- new FloatProperty<TaskView>("dimAlpha") {
- @Override
- public void setValue(TaskView tv, float dimAlpha) {
- tv.setDimAlpha(dimAlpha);
- }
-
- @Override
- public Float get(TaskView tv) {
- return tv.getDimAlpha();
- }
- };
-
- /**
- * The dim overlay is generally calculated from the task progress, but occasionally (like when
- * launching) needs to be animated independently of the task progress.
- */
- public static final Property<TaskView, Float> VIEW_OUTLINE_ALPHA =
- new FloatProperty<TaskView>("viewOutlineAlpha") {
- @Override
- public void setValue(TaskView tv, float alpha) {
- tv.getViewBounds().setAlpha(alpha);
- }
-
- @Override
- public Float get(TaskView tv) {
- return tv.getViewBounds().getAlpha();
- }
- };
-
- @ViewDebug.ExportedProperty(category="recents")
- private float mDimAlpha;
- private float mActionButtonTranslationZ;
-
- @ViewDebug.ExportedProperty(deepExport=true, prefix="task_")
- private Task mTask;
- private boolean mTaskBound;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mClipViewInStack = true;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mTouchExplorationEnabled;
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mIsDisabledInSafeMode;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="view_bounds_")
- private AnimateableViewBounds mViewBounds;
-
- private AnimatorSet mTransformAnimation;
- private ObjectAnimator mDimAnimator;
- private ObjectAnimator mOutlineAnimator;
- private final TaskViewTransform mTargetAnimationTransform = new TaskViewTransform();
- private ArrayList<Animator> mTmpAnimators = new ArrayList<>();
-
- @ViewDebug.ExportedProperty(deepExport=true, prefix="thumbnail_")
- protected TaskViewThumbnail mThumbnailView;
- @ViewDebug.ExportedProperty(deepExport=true, prefix="header_")
- protected TaskViewHeader mHeaderView;
- private View mActionButtonView;
- private View mIncompatibleAppToastView;
- private TaskViewCallbacks mCb;
-
- @ViewDebug.ExportedProperty(category="recents")
- private Point mDownTouchPos = new Point();
-
- private Toast mDisabledAppToast;
-
- public TaskView(Context context) {
- this(context, null);
- }
-
- public TaskView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public TaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- Resources res = context.getResources();
- mViewBounds = createOutlineProvider();
- if (config.fakeShadows) {
- setBackground(new FakeShadowDrawable(res, config));
- }
- setOutlineProvider(mViewBounds);
- setOnLongClickListener(this);
- setAccessibilityDelegate(new TaskViewAccessibilityDelegate(this));
- }
-
- /** Set callback */
- void setCallbacks(TaskViewCallbacks cb) {
- mCb = cb;
- }
-
- /**
- * Called from RecentsActivity when it is relaunched.
- */
- void onReload(boolean isResumingFromVisible) {
- resetNoUserInteractionState();
- if (!isResumingFromVisible) {
- resetViewProperties();
- }
- }
-
- /** Gets the task */
- public Task getTask() {
- return mTask;
- }
-
- /* Create an outline provider to clip and outline the view */
- protected AnimateableViewBounds createOutlineProvider() {
- return new AnimateableViewBounds(this, mContext.getResources().getDimensionPixelSize(
- R.dimen.recents_task_view_shadow_rounded_corners_radius));
- }
-
- /** Returns the view bounds. */
- AnimateableViewBounds getViewBounds() {
- return mViewBounds;
- }
-
- @Override
- protected void onFinishInflate() {
- // Bind the views
- mHeaderView = findViewById(R.id.task_view_bar);
- mThumbnailView = findViewById(R.id.task_view_thumbnail);
- mThumbnailView.updateClipToTaskBar(mHeaderView);
- mActionButtonView = findViewById(R.id.lock_to_app_fab);
- mActionButtonView.setOutlineProvider(new ViewOutlineProvider() {
- @Override
- public void getOutline(View view, Outline outline) {
- // Set the outline to match the FAB background
- outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight());
- outline.setAlpha(0.35f);
- }
- });
- mActionButtonView.setOnClickListener(this);
- mActionButtonTranslationZ = mActionButtonView.getTranslationZ();
- }
-
- /**
- * Update the task view when the configuration changes.
- */
- protected void onConfigurationChanged() {
- mHeaderView.onConfigurationChanged();
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- if (w > 0 && h > 0) {
- mHeaderView.onTaskViewSizeChanged(w, h);
- mThumbnailView.onTaskViewSizeChanged(w, h);
-
- mActionButtonView.setTranslationX(w - getMeasuredWidth());
- mActionButtonView.setTranslationY(h - getMeasuredHeight());
- }
- }
-
- @Override
- public boolean hasOverlappingRendering() {
- return false;
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- mDownTouchPos.set((int) (ev.getX() * getScaleX()), (int) (ev.getY() * getScaleY()));
- }
- return super.onInterceptTouchEvent(ev);
- }
-
- @Override
- protected void measureContents(int width, int height) {
- int widthWithoutPadding = width - mPaddingLeft - mPaddingRight;
- int heightWithoutPadding = height - mPaddingTop - mPaddingBottom;
- int widthSpec = MeasureSpec.makeMeasureSpec(widthWithoutPadding, MeasureSpec.EXACTLY);
- int heightSpec = MeasureSpec.makeMeasureSpec(heightWithoutPadding, MeasureSpec.EXACTLY);
-
- // Measure the content
- measureChildren(widthSpec, heightSpec);
-
- setMeasuredDimension(width, height);
- }
-
- void updateViewPropertiesToTaskTransform(TaskViewTransform toTransform,
- AnimationProps toAnimation, ValueAnimator.AnimatorUpdateListener updateCallback) {
- RecentsConfiguration config = LegacyRecentsImpl.getConfiguration();
- cancelTransformAnimation();
-
- // Compose the animations for the transform
- mTmpAnimators.clear();
- toTransform.applyToTaskView(this, mTmpAnimators, toAnimation, !config.fakeShadows);
- if (toAnimation.isImmediate()) {
- if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
- setDimAlpha(toTransform.dimAlpha);
- }
- if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
- mViewBounds.setAlpha(toTransform.viewOutlineAlpha);
- }
- // Manually call back to the animator listener and update callback
- if (toAnimation.getListener() != null) {
- toAnimation.getListener().onAnimationEnd(null);
- }
- if (updateCallback != null) {
- updateCallback.onAnimationUpdate(null);
- }
- } else {
- // Both the progress and the update are a function of the bounds movement of the task
- if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
- mDimAnimator = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(),
- toTransform.dimAlpha);
- mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mDimAnimator));
- }
- if (Float.compare(mViewBounds.getAlpha(), toTransform.viewOutlineAlpha) != 0) {
- mOutlineAnimator = ObjectAnimator.ofFloat(this, VIEW_OUTLINE_ALPHA,
- mViewBounds.getAlpha(), toTransform.viewOutlineAlpha);
- mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, mOutlineAnimator));
- }
- if (updateCallback != null) {
- ValueAnimator updateCallbackAnim = ValueAnimator.ofInt(0, 1);
- updateCallbackAnim.addUpdateListener(updateCallback);
- mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, updateCallbackAnim));
- }
-
- // Create the animator
- mTransformAnimation = toAnimation.createAnimator(mTmpAnimators);
- mTransformAnimation.start();
- mTargetAnimationTransform.copyFrom(toTransform);
- }
- }
-
- /** Resets this view's properties */
- void resetViewProperties() {
- cancelTransformAnimation();
- setDimAlpha(0);
- setVisibility(View.VISIBLE);
- getViewBounds().reset();
- getHeaderView().reset();
- TaskViewTransform.reset(this);
-
- mActionButtonView.setScaleX(1f);
- mActionButtonView.setScaleY(1f);
- mActionButtonView.setAlpha(0f);
- mActionButtonView.setTranslationX(0f);
- mActionButtonView.setTranslationY(0f);
- mActionButtonView.setTranslationZ(mActionButtonTranslationZ);
- if (mIncompatibleAppToastView != null) {
- mIncompatibleAppToastView.setVisibility(View.INVISIBLE);
- }
- }
-
- /**
- * @return whether we are animating towards {@param transform}
- */
- boolean isAnimatingTo(TaskViewTransform transform) {
- return mTransformAnimation != null && mTransformAnimation.isStarted()
- && mTargetAnimationTransform.isSame(transform);
- }
-
- /**
- * Cancels any current transform animations.
- */
- public void cancelTransformAnimation() {
- cancelDimAnimationIfExists();
- Utilities.cancelAnimationWithoutCallbacks(mTransformAnimation);
- Utilities.cancelAnimationWithoutCallbacks(mOutlineAnimator);
- }
-
- private void cancelDimAnimationIfExists() {
- if (mDimAnimator != null) {
- mDimAnimator.cancel();
- }
- }
-
- /** Enables/disables handling touch on this task view. */
- public void setTouchEnabled(boolean enabled) {
- setOnClickListener(enabled ? this : null);
- }
-
- /** Animates this task view if the user does not interact with the stack after a certain time. */
- public void startNoUserInteractionAnimation() {
- mHeaderView.startNoUserInteractionAnimation();
- }
-
- /** Mark this task view that the user does has not interacted with the stack after a certain time. */
- void setNoUserInteractionState() {
- mHeaderView.setNoUserInteractionState();
- }
-
- /** Resets the state tracking that the user has not interacted with the stack after a certain time. */
- void resetNoUserInteractionState() {
- mHeaderView.resetNoUserInteractionState();
- }
-
- /** Dismisses this task. */
- void dismissTask() {
- // Animate out the view and call the callback
- final TaskView tv = this;
- DismissTaskViewEvent dismissEvent = new DismissTaskViewEvent(tv);
- dismissEvent.addPostAnimationCallback(new Runnable() {
- @Override
- public void run() {
- EventBus.getDefault().send(new TaskViewDismissedEvent(mTask, tv,
- new AnimationProps(TaskStackView.DEFAULT_SYNC_STACK_DURATION,
- Interpolators.FAST_OUT_SLOW_IN)));
- }
- });
- EventBus.getDefault().send(dismissEvent);
- }
-
- /**
- * Returns whether this view should be clipped, or any views below should clip against this
- * view.
- */
- boolean shouldClipViewInStack() {
- if (getVisibility() != View.VISIBLE || LegacyRecentsImpl.getConfiguration().isLowRamDevice) {
- return false;
- }
- return mClipViewInStack;
- }
-
- /** Sets whether this view should be clipped, or clipped against. */
- void setClipViewInStack(boolean clip) {
- if (clip != mClipViewInStack) {
- mClipViewInStack = clip;
- if (mCb != null) {
- mCb.onTaskViewClipStateChanged(this);
- }
- }
- }
-
- public TaskViewHeader getHeaderView() {
- return mHeaderView;
- }
-
- /**
- * Sets the current dim.
- */
- public void setDimAlpha(float dimAlpha) {
- mDimAlpha = dimAlpha;
- mThumbnailView.setDimAlpha(dimAlpha);
- mHeaderView.setDimAlpha(dimAlpha);
- }
-
- /**
- * Sets the current dim without updating the header's dim.
- */
- public void setDimAlphaWithoutHeader(float dimAlpha) {
- mDimAlpha = dimAlpha;
- mThumbnailView.setDimAlpha(dimAlpha);
- }
-
- /**
- * Returns the current dim.
- */
- public float getDimAlpha() {
- return mDimAlpha;
- }
-
- /**
- * Explicitly sets the focused state of this task.
- */
- public void setFocusedState(boolean isFocused, boolean requestViewFocus) {
- if (isFocused) {
- if (requestViewFocus && !isFocused()) {
- requestFocus();
- }
- } else {
- if (isAccessibilityFocused() && mTouchExplorationEnabled) {
- clearAccessibilityFocus();
- }
- }
- }
-
- /**
- * Shows the action button.
- * @param fadeIn whether or not to animate the action button in.
- * @param fadeInDuration the duration of the action button animation, only used if
- * {@param fadeIn} is true.
- */
- public void showActionButton(boolean fadeIn, int fadeInDuration) {
- mActionButtonView.setVisibility(View.VISIBLE);
-
- if (fadeIn && mActionButtonView.getAlpha() < 1f) {
- mActionButtonView.animate()
- .alpha(1f)
- .scaleX(1f)
- .scaleY(1f)
- .setDuration(fadeInDuration)
- .setInterpolator(Interpolators.ALPHA_IN)
- .start();
- } else {
- mActionButtonView.setScaleX(1f);
- mActionButtonView.setScaleY(1f);
- mActionButtonView.setAlpha(1f);
- mActionButtonView.setTranslationZ(mActionButtonTranslationZ);
- }
- }
-
- /**
- * Immediately hides the action button.
- *
- * @param fadeOut whether or not to animate the action button out.
- */
- public void hideActionButton(boolean fadeOut, int fadeOutDuration, boolean scaleDown,
- final Animator.AnimatorListener animListener) {
- if (fadeOut && mActionButtonView.getAlpha() > 0f) {
- if (scaleDown) {
- float toScale = 0.9f;
- mActionButtonView.animate()
- .scaleX(toScale)
- .scaleY(toScale);
- }
- mActionButtonView.animate()
- .alpha(0f)
- .setDuration(fadeOutDuration)
- .setInterpolator(Interpolators.ALPHA_OUT)
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- if (animListener != null) {
- animListener.onAnimationEnd(null);
- }
- mActionButtonView.setVisibility(View.INVISIBLE);
- }
- })
- .start();
- } else {
- mActionButtonView.setAlpha(0f);
- mActionButtonView.setVisibility(View.INVISIBLE);
- if (animListener != null) {
- animListener.onAnimationEnd(null);
- }
- }
- }
-
- /**** TaskStackAnimationHelper.Callbacks Implementation ****/
-
- @Override
- public void onPrepareLaunchTargetForEnterAnimation() {
- // These values will be animated in when onStartLaunchTargetEnterAnimation() is called
- setDimAlphaWithoutHeader(0);
- mActionButtonView.setAlpha(0f);
- if (mIncompatibleAppToastView != null &&
- mIncompatibleAppToastView.getVisibility() == View.VISIBLE) {
- mIncompatibleAppToastView.setAlpha(0f);
- }
- }
-
- @Override
- public void onStartLaunchTargetEnterAnimation(TaskViewTransform transform, int duration,
- boolean screenPinningEnabled, ReferenceCountedTrigger postAnimationTrigger) {
- cancelDimAnimationIfExists();
-
- // Dim the view after the app window transitions down into recents
- postAnimationTrigger.increment();
- AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
- mDimAnimator = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
- DIM_ALPHA_WITHOUT_HEADER, getDimAlpha(), transform.dimAlpha));
- mDimAnimator.addListener(postAnimationTrigger.decrementOnAnimationEnd());
- mDimAnimator.start();
-
- if (screenPinningEnabled) {
- showActionButton(true /* fadeIn */, duration /* fadeInDuration */);
- }
-
- if (mIncompatibleAppToastView != null &&
- mIncompatibleAppToastView.getVisibility() == View.VISIBLE) {
- mIncompatibleAppToastView.animate()
- .alpha(1f)
- .setDuration(duration)
- .setInterpolator(Interpolators.ALPHA_IN)
- .start();
- }
- }
-
- @Override
- public void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
- ReferenceCountedTrigger postAnimationTrigger) {
- Utilities.cancelAnimationWithoutCallbacks(mDimAnimator);
-
- // Un-dim the view before/while launching the target
- AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
- mDimAnimator = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
- DIM_ALPHA, getDimAlpha(), 0));
- mDimAnimator.start();
-
- postAnimationTrigger.increment();
- hideActionButton(true /* fadeOut */, duration,
- !screenPinningRequested /* scaleDown */,
- postAnimationTrigger.decrementOnAnimationEnd());
- }
-
- @Override
- public void onStartFrontTaskEnterAnimation(boolean screenPinningEnabled) {
- if (screenPinningEnabled) {
- showActionButton(false /* fadeIn */, 0 /* fadeInDuration */);
- }
- }
-
- /**** TaskCallbacks Implementation ****/
-
- public void onTaskBound(Task t, boolean touchExplorationEnabled, int displayOrientation,
- Rect displayRect) {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- mTouchExplorationEnabled = touchExplorationEnabled;
- mTask = t;
- mTaskBound = true;
- mTask.addCallback(this);
- mIsDisabledInSafeMode = !mTask.isSystemApp && ssp.isInSafeMode();
- mThumbnailView.bindToTask(mTask, mIsDisabledInSafeMode, displayOrientation, displayRect);
- mHeaderView.bindToTask(mTask, mTouchExplorationEnabled, mIsDisabledInSafeMode);
-
- if (!t.isDockable && ssp.hasDockedTask()) {
- if (mIncompatibleAppToastView == null) {
- mIncompatibleAppToastView = Utilities.findViewStubById(this,
- R.id.incompatible_app_toast_stub).inflate();
- TextView msg = findViewById(com.android.internal.R.id.message);
- msg.setText(R.string.dock_non_resizeble_failed_to_dock_text);
- }
- mIncompatibleAppToastView.setVisibility(View.VISIBLE);
- } else if (mIncompatibleAppToastView != null) {
- mIncompatibleAppToastView.setVisibility(View.INVISIBLE);
- }
- }
-
- @Override
- public void onTaskDataLoaded(Task task, ThumbnailData thumbnailData) {
- if (mTaskBound) {
- // Update each of the views to the new task data
- mThumbnailView.onTaskDataLoaded(thumbnailData);
- mHeaderView.onTaskDataLoaded();
- }
- }
-
- @Override
- public void onTaskDataUnloaded() {
- // Unbind each of the views from the task and remove the task callback
- mTask.removeCallback(this);
- mThumbnailView.unbindFromTask();
- mHeaderView.unbindFromTask(mTouchExplorationEnabled);
- mTaskBound = false;
- }
-
- @Override
- public void onTaskWindowingModeChanged() {
- // Force rebind the header, the thumbnail does not change due to stack changes
- mHeaderView.bindToTask(mTask, mTouchExplorationEnabled, mIsDisabledInSafeMode);
- mHeaderView.onTaskDataLoaded();
- }
-
- /**** View.OnClickListener Implementation ****/
-
- @Override
- public void onClick(final View v) {
- if (mIsDisabledInSafeMode) {
- Context context = getContext();
- String msg = context.getString(R.string.recents_launch_disabled_message, mTask.title);
- if (mDisabledAppToast != null) {
- mDisabledAppToast.cancel();
- }
- mDisabledAppToast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
- mDisabledAppToast.show();
- return;
- }
-
- boolean screenPinningRequested = false;
- if (v == mActionButtonView) {
- // Reset the translation of the action button before we animate it out
- mActionButtonView.setTranslationZ(0f);
- screenPinningRequested = true;
- }
- EventBus.getDefault().send(new LaunchTaskEvent(this, mTask, null, screenPinningRequested));
-
- MetricsLogger.action(v.getContext(), MetricsEvent.ACTION_OVERVIEW_SELECT,
- mTask.key.getComponent().toString());
- }
-
- /**** View.OnLongClickListener Implementation ****/
-
- @Override
- public boolean onLongClick(View v) {
- if (!LegacyRecentsImpl.getConfiguration().dragToSplitEnabled) {
- return false;
- }
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- boolean inBounds = false;
- Rect clipBounds = new Rect(mViewBounds.getClipBounds());
- if (!clipBounds.isEmpty()) {
- // If we are clipping the view to the bounds, manually do the hit test.
- clipBounds.scale(getScaleX());
- inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y);
- } else {
- // Otherwise just make sure we're within the view's bounds.
- inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight();
- }
- if (v == this && inBounds && !ssp.hasDockedTask()) {
- // Start listening for drag events
- setClipViewInStack(false);
-
- mDownTouchPos.x += ((1f - getScaleX()) * getWidth()) / 2;
- mDownTouchPos.y += ((1f - getScaleY()) * getHeight()) / 2;
-
- EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1);
- EventBus.getDefault().send(new DragStartEvent(mTask, this, mDownTouchPos));
- return true;
- }
- return false;
- }
-
- /**** Events ****/
-
- public final void onBusEvent(DragEndEvent event) {
- if (!(event.dropTarget instanceof DockState)) {
- event.addPostAnimationCallback(() -> {
- // Reset the clip state for the drag view after the end animation completes
- setClipViewInStack(true);
- });
- }
- EventBus.getDefault().unregister(this);
- }
-
- public final void onBusEvent(DragEndCancelledEvent event) {
- // Reset the clip state for the drag view after the cancel animation completes
- event.addPostAnimationCallback(() -> {
- setClipViewInStack(true);
- });
- }
-
- public void dump(String prefix, PrintWriter writer) {
- String innerPrefix = prefix + " ";
-
- writer.print(prefix); writer.print("TaskView");
- writer.print(" mTask="); writer.print(mTask.key.id);
- writer.println();
-
- mThumbnailView.dump(innerPrefix, writer);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewAccessibilityDelegate.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewAccessibilityDelegate.java
deleted file mode 100644
index 7bcad75..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewAccessibilityDelegate.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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
- */
-
-package com.android.systemui.recents.views;
-
-import android.app.ActivityTaskManager;
-import android.content.Context;
-import android.graphics.Point;
-import android.os.Bundle;
-import android.util.SparseArray;
-import android.view.View;
-import android.view.accessibility.AccessibilityNodeInfo;
-import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
-import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
-
-public class TaskViewAccessibilityDelegate extends View.AccessibilityDelegate {
- private static final String TAG = "TaskViewAccessibilityDelegate";
-
- private final TaskView mTaskView;
-
- protected static final int SPLIT_TASK_TOP = R.id.action_split_task_to_top;
- protected static final int SPLIT_TASK_LEFT = R.id.action_split_task_to_left;
- protected static final int SPLIT_TASK_RIGHT = R.id.action_split_task_to_right;
-
- protected final SparseArray<AccessibilityAction> mActions = new SparseArray<>();
-
- public TaskViewAccessibilityDelegate(TaskView taskView) {
- mTaskView = taskView;
- Context context = taskView.getContext();
- mActions.put(SPLIT_TASK_TOP, new AccessibilityAction(SPLIT_TASK_TOP,
- context.getString(R.string.recents_accessibility_split_screen_top)));
- mActions.put(SPLIT_TASK_LEFT, new AccessibilityAction(SPLIT_TASK_LEFT,
- context.getString(R.string.recents_accessibility_split_screen_left)));
- mActions.put(SPLIT_TASK_RIGHT, new AccessibilityAction(SPLIT_TASK_RIGHT,
- context.getString(R.string.recents_accessibility_split_screen_right)));
- }
-
- @Override
- public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(host, info);
- if (ActivityTaskManager.supportsSplitScreenMultiWindow(mTaskView.getContext())
- && !LegacyRecentsImpl.getSystemServices().hasDockedTask()) {
- DockState[] dockStates = LegacyRecentsImpl.getConfiguration()
- .getDockStatesForCurrentOrientation();
- for (DockState dockState: dockStates) {
- if (dockState == DockState.TOP) {
- info.addAction(mActions.get(SPLIT_TASK_TOP));
- } else if (dockState == DockState.LEFT) {
- info.addAction(mActions.get(SPLIT_TASK_LEFT));
- } else if (dockState == DockState.RIGHT) {
- info.addAction(mActions.get(SPLIT_TASK_RIGHT));
- }
- }
- }
- }
-
- @Override
- public boolean performAccessibilityAction(View host, int action, Bundle args) {
- if (action == SPLIT_TASK_TOP) {
- simulateDragIntoMultiwindow(DockState.TOP);
- } else if (action == SPLIT_TASK_LEFT) {
- simulateDragIntoMultiwindow(DockState.LEFT);
- } else if (action == SPLIT_TASK_RIGHT) {
- simulateDragIntoMultiwindow(DockState.RIGHT);
- } else {
- return super.performAccessibilityAction(host, action, args);
- }
- return true;
- }
-
- /** Simulate a user drag event to split the screen to the respected side */
- private void simulateDragIntoMultiwindow(DockState dockState) {
- EventBus.getDefault().send(new DragStartEvent(mTaskView.getTask(), mTaskView,
- new Point(0,0), false /* isUserTouchInitiated */));
- EventBus.getDefault().send(new DragEndEvent(mTaskView.getTask(), mTaskView, dockState));
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewHeader.java
deleted file mode 100644
index 21c0234..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewHeader.java
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.Nullable;
-import android.app.AppGlobals;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.RippleDrawable;
-import android.os.CountDownTimer;
-import androidx.core.graphics.ColorUtils;
-import android.util.AttributeSet;
-import android.util.IconDrawableFactory;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewAnimationUtils;
-import android.view.ViewDebug;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.Interpolators;
-import com.android.systemui.R;
-import com.android.systemui.recents.Constants;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.LaunchTaskEvent;
-import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
-import com.android.systemui.recents.misc.SystemServicesProxy;
-import com.android.systemui.shared.system.ActivityManagerWrapper;
-import com.android.systemui.shared.system.PackageManagerWrapper;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-
-/* The task bar view */
-public class TaskViewHeader extends FrameLayout
- implements View.OnClickListener, View.OnLongClickListener {
-
- private static IconDrawableFactory sDrawableFactory;
-
- private static final float HIGHLIGHT_LIGHTNESS_INCREMENT = 0.075f;
- private static final float OVERLAY_LIGHTNESS_INCREMENT = -0.0625f;
- private static final int OVERLAY_REVEAL_DURATION = 250;
- private static final long FOCUS_INDICATOR_INTERVAL_MS = 30;
-
- /**
- * A color drawable that draws a slight highlight at the top to help it stand out.
- */
- private class HighlightColorDrawable extends Drawable {
-
- private Paint mHighlightPaint = new Paint();
- private Paint mBackgroundPaint = new Paint();
- private int mColor;
- private float mDimAlpha;
-
- public HighlightColorDrawable() {
- mBackgroundPaint.setColor(Color.argb(255, 0, 0, 0));
- mBackgroundPaint.setAntiAlias(true);
- mHighlightPaint.setColor(Color.argb(255, 255, 255, 255));
- mHighlightPaint.setAntiAlias(true);
- }
-
- public void setColorAndDim(int color, float dimAlpha) {
- if (mColor != color || Float.compare(mDimAlpha, dimAlpha) != 0) {
- mColor = color;
- mDimAlpha = dimAlpha;
- if (mShouldDarkenBackgroundColor) {
- color = getSecondaryColor(color, false /* useLightOverlayColor */);
- }
- mBackgroundPaint.setColor(color);
-
- ColorUtils.colorToHSL(color, mTmpHSL);
- // TODO: Consider using the saturation of the color to adjust the lightness as well
- mTmpHSL[2] = Math.min(1f,
- mTmpHSL[2] + HIGHLIGHT_LIGHTNESS_INCREMENT * (1.0f - dimAlpha));
- mHighlightPaint.setColor(ColorUtils.HSLToColor(mTmpHSL));
-
- invalidateSelf();
- }
- }
-
- @Override
- public void setColorFilter(@Nullable ColorFilter colorFilter) {
- // Do nothing
- }
-
- @Override
- public void setAlpha(int alpha) {
- // Do nothing
- }
-
- @Override
- public void draw(Canvas canvas) {
- // Draw the highlight at the top edge (but put the bottom edge just out of view)
- canvas.drawRoundRect(0, 0, mTaskViewRect.width(),
- 2 * Math.max(mHighlightHeight, mCornerRadius),
- mCornerRadius, mCornerRadius, mHighlightPaint);
-
- // Draw the background with the rounded corners
- canvas.drawRoundRect(0, mHighlightHeight, mTaskViewRect.width(),
- getHeight() + mCornerRadius,
- mCornerRadius, mCornerRadius, mBackgroundPaint);
- }
-
- @Override
- public int getOpacity() {
- return PixelFormat.OPAQUE;
- }
-
- public int getColor() {
- return mColor;
- }
- }
-
- Task mTask;
-
- // Header views
- ImageView mIconView;
- TextView mTitleView;
- ImageView mMoveTaskButton;
- ImageView mDismissButton;
- FrameLayout mAppOverlayView;
- ImageView mAppIconView;
- ImageView mAppInfoView;
- TextView mAppTitleView;
- ProgressBar mFocusTimerIndicator;
-
- // Header drawables
- @ViewDebug.ExportedProperty(category="recents")
- Rect mTaskViewRect = new Rect();
- int mHeaderBarHeight;
- int mHeaderButtonPadding;
- int mCornerRadius;
- int mHighlightHeight;
- @ViewDebug.ExportedProperty(category="recents")
- float mDimAlpha;
- Drawable mLightDismissDrawable;
- Drawable mDarkDismissDrawable;
- Drawable mLightFullscreenIcon;
- Drawable mDarkFullscreenIcon;
- Drawable mLightInfoIcon;
- Drawable mDarkInfoIcon;
- int mTaskBarViewLightTextColor;
- int mTaskBarViewDarkTextColor;
- int mDisabledTaskBarBackgroundColor;
- String mDismissDescFormat;
- String mAppInfoDescFormat;
- int mTaskWindowingMode = WINDOWING_MODE_UNDEFINED;
-
- // Header background
- private HighlightColorDrawable mBackground;
- private HighlightColorDrawable mOverlayBackground;
- private float[] mTmpHSL = new float[3];
-
- // Header dim, which is only used when task view hardware layers are not used
- private Paint mDimLayerPaint = new Paint();
-
- // Whether the background color should be darkened to differentiate from the primary color.
- // Used in grid layout.
- private boolean mShouldDarkenBackgroundColor = false;
-
- private CountDownTimer mFocusTimerCountDown;
-
- public TaskViewHeader(Context context) {
- this(context, null);
- }
-
- public TaskViewHeader(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setWillNotDraw(false);
-
- // Load the dismiss resources
- Resources res = context.getResources();
- mLightDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_light);
- mDarkDismissDrawable = context.getDrawable(R.drawable.recents_dismiss_dark);
- mCornerRadius = LegacyRecentsImpl.getConfiguration().isGridEnabled ?
- res.getDimensionPixelSize(R.dimen.recents_grid_task_view_rounded_corners_radius) :
- res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
- mHighlightHeight = res.getDimensionPixelSize(R.dimen.recents_task_view_highlight);
- mTaskBarViewLightTextColor = context.getColor(R.color.recents_task_bar_light_text_color);
- mTaskBarViewDarkTextColor = context.getColor(R.color.recents_task_bar_dark_text_color);
- mLightFullscreenIcon = context.getDrawable(R.drawable.recents_move_task_fullscreen_light);
- mDarkFullscreenIcon = context.getDrawable(R.drawable.recents_move_task_fullscreen_dark);
- mLightInfoIcon = context.getDrawable(R.drawable.recents_info_light);
- mDarkInfoIcon = context.getDrawable(R.drawable.recents_info_dark);
- mDisabledTaskBarBackgroundColor =
- context.getColor(R.color.recents_task_bar_disabled_background_color);
- mDismissDescFormat = mContext.getString(
- R.string.accessibility_recents_item_will_be_dismissed);
- mAppInfoDescFormat = mContext.getString(R.string.accessibility_recents_item_open_app_info);
-
- // Configure the background and dim
- mBackground = new HighlightColorDrawable();
- mBackground.setColorAndDim(Color.argb(255, 0, 0, 0), 0f);
- setBackground(mBackground);
- mOverlayBackground = new HighlightColorDrawable();
- mDimLayerPaint.setColor(Color.argb(255, 0, 0, 0));
- mDimLayerPaint.setAntiAlias(true);
- }
-
- /**
- * Resets this header along with the TaskView.
- */
- public void reset() {
- hideAppOverlay(true /* immediate */);
- }
-
- @Override
- protected void onFinishInflate() {
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
-
- // Initialize the icon and description views
- mIconView = findViewById(R.id.icon);
- mIconView.setOnLongClickListener(this);
- mTitleView = findViewById(R.id.title);
- mDismissButton = findViewById(R.id.dismiss_task);
-
- onConfigurationChanged();
- }
-
- /**
- * Programmatically sets the layout params for a header bar layout. This is necessary because
- * we can't get resources based on the current configuration, but instead need to get them
- * based on the device configuration.
- */
- private void updateLayoutParams(View icon, View title, View secondaryButton, View button) {
- FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT, mHeaderBarHeight, Gravity.TOP);
- setLayoutParams(lp);
- lp = new FrameLayout.LayoutParams(mHeaderBarHeight, mHeaderBarHeight, Gravity.START);
- icon.setLayoutParams(lp);
- lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL);
- lp.setMarginStart(mHeaderBarHeight);
- lp.setMarginEnd(mMoveTaskButton != null
- ? 2 * mHeaderBarHeight
- : mHeaderBarHeight);
- title.setLayoutParams(lp);
- if (secondaryButton != null) {
- lp = new FrameLayout.LayoutParams(mHeaderBarHeight, mHeaderBarHeight, Gravity.END);
- lp.setMarginEnd(mHeaderBarHeight);
- secondaryButton.setLayoutParams(lp);
- secondaryButton.setPadding(mHeaderButtonPadding, mHeaderButtonPadding,
- mHeaderButtonPadding, mHeaderButtonPadding);
- }
- lp = new FrameLayout.LayoutParams(mHeaderBarHeight, mHeaderBarHeight, Gravity.END);
- button.setLayoutParams(lp);
- button.setPadding(mHeaderButtonPadding, mHeaderButtonPadding, mHeaderButtonPadding,
- mHeaderButtonPadding);
- }
-
- /**
- * Update the header view when the configuration changes.
- */
- public void onConfigurationChanged() {
- // Update the dimensions of everything in the header. We do this because we need to use
- // resources for the display, and not the current configuration.
- Resources res = getResources();
- int headerBarHeight = TaskStackLayoutAlgorithm.getDimensionForDevice(getContext(),
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_task_view_header_height,
- R.dimen.recents_task_view_header_height_tablet_land,
- R.dimen.recents_grid_task_view_header_height);
- int headerButtonPadding = TaskStackLayoutAlgorithm.getDimensionForDevice(getContext(),
- R.dimen.recents_task_view_header_button_padding,
- R.dimen.recents_task_view_header_button_padding,
- R.dimen.recents_task_view_header_button_padding,
- R.dimen.recents_task_view_header_button_padding_tablet_land,
- R.dimen.recents_task_view_header_button_padding,
- R.dimen.recents_task_view_header_button_padding_tablet_land,
- R.dimen.recents_grid_task_view_header_button_padding);
- if (headerBarHeight != mHeaderBarHeight || headerButtonPadding != mHeaderButtonPadding) {
- mHeaderBarHeight = headerBarHeight;
- mHeaderButtonPadding = headerButtonPadding;
- updateLayoutParams(mIconView, mTitleView, mMoveTaskButton, mDismissButton);
- if (mAppOverlayView != null) {
- updateLayoutParams(mAppIconView, mAppTitleView, null, mAppInfoView);
- }
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
-
- // Since we update the position of children based on the width of the parent and this view
- // recompute these changes with the new view size
- onTaskViewSizeChanged(mTaskViewRect.width(), mTaskViewRect.height());
- }
-
- /**
- * Called when the task view frame changes, allowing us to move the contents of the header
- * to match the frame changes.
- */
- public void onTaskViewSizeChanged(int width, int height) {
- mTaskViewRect.set(0, 0, width, height);
-
- boolean showTitle = true;
- boolean showMoveIcon = true;
- boolean showDismissIcon = true;
- int rightInset = width - getMeasuredWidth();
-
- mTitleView.setVisibility(showTitle ? View.VISIBLE : View.INVISIBLE);
- if (mMoveTaskButton != null) {
- mMoveTaskButton.setVisibility(showMoveIcon ? View.VISIBLE : View.INVISIBLE);
- mMoveTaskButton.setTranslationX(rightInset);
- }
- mDismissButton.setVisibility(showDismissIcon ? View.VISIBLE : View.INVISIBLE);
- mDismissButton.setTranslationX(rightInset);
-
- setLeftTopRightBottom(0, 0, width, getMeasuredHeight());
- }
-
- @Override
- public void onDrawForeground(Canvas canvas) {
- super.onDrawForeground(canvas);
-
- // Draw the dim layer with the rounded corners
- canvas.drawRoundRect(0, 0, mTaskViewRect.width(), getHeight() + mCornerRadius,
- mCornerRadius, mCornerRadius, mDimLayerPaint);
- }
-
- /** Starts the focus timer. */
- public void startFocusTimerIndicator(int duration) {
- if (mFocusTimerIndicator == null) {
- return;
- }
-
- mFocusTimerIndicator.setVisibility(View.VISIBLE);
- mFocusTimerIndicator.setMax(duration);
- mFocusTimerIndicator.setProgress(duration);
- if (mFocusTimerCountDown != null) {
- mFocusTimerCountDown.cancel();
- }
- mFocusTimerCountDown = new CountDownTimer(duration,
- FOCUS_INDICATOR_INTERVAL_MS) {
- public void onTick(long millisUntilFinished) {
- mFocusTimerIndicator.setProgress((int) millisUntilFinished);
- }
-
- public void onFinish() {
- // Do nothing
- }
- }.start();
- }
-
- /** Cancels the focus timer. */
- public void cancelFocusTimerIndicator() {
- if (mFocusTimerIndicator == null) {
- return;
- }
-
- if (mFocusTimerCountDown != null) {
- mFocusTimerCountDown.cancel();
- mFocusTimerIndicator.setProgress(0);
- mFocusTimerIndicator.setVisibility(View.INVISIBLE);
- }
- }
-
- /** Only exposed for the workaround for b/27815919. */
- public ImageView getIconView() {
- return mIconView;
- }
-
- /** Returns the secondary color for a primary color. */
- int getSecondaryColor(int primaryColor, boolean useLightOverlayColor) {
- int overlayColor = useLightOverlayColor ? Color.WHITE : Color.BLACK;
- return Utilities.getColorWithOverlay(primaryColor, overlayColor, 0.8f);
- }
-
- /**
- * Sets the dim alpha, only used when we are not using hardware layers.
- * (see RecentsConfiguration.useHardwareLayers)
- */
- public void setDimAlpha(float dimAlpha) {
- if (Float.compare(mDimAlpha, dimAlpha) != 0) {
- mDimAlpha = dimAlpha;
- mTitleView.setAlpha(1f - dimAlpha);
- updateBackgroundColor(mBackground.getColor(), dimAlpha);
- }
- }
-
- /**
- * Updates the background and highlight colors for this header.
- */
- private void updateBackgroundColor(int color, float dimAlpha) {
- if (mTask != null) {
- mBackground.setColorAndDim(color, dimAlpha);
- // TODO: Consider using the saturation of the color to adjust the lightness as well
- ColorUtils.colorToHSL(color, mTmpHSL);
- mTmpHSL[2] = Math.min(1f, mTmpHSL[2] + OVERLAY_LIGHTNESS_INCREMENT * (1.0f - dimAlpha));
- mOverlayBackground.setColorAndDim(ColorUtils.HSLToColor(mTmpHSL), dimAlpha);
- mDimLayerPaint.setAlpha((int) (dimAlpha * 255));
- invalidate();
- }
- }
-
- /**
- * Sets whether the background color should be darkened to differentiate from the primary color.
- */
- public void setShouldDarkenBackgroundColor(boolean flag) {
- mShouldDarkenBackgroundColor = flag;
- }
-
- /**
- * Binds the bar view to the task.
- */
- public void bindToTask(Task t, boolean touchExplorationEnabled, boolean disabledInSafeMode) {
- mTask = t;
-
- int primaryColor = disabledInSafeMode
- ? mDisabledTaskBarBackgroundColor
- : t.colorPrimary;
- if (mBackground.getColor() != primaryColor) {
- updateBackgroundColor(primaryColor, mDimAlpha);
- }
- if (!mTitleView.getText().toString().equals(t.title)) {
- mTitleView.setText(t.title);
- }
- mTitleView.setContentDescription(t.titleDescription);
- mTitleView.setTextColor(t.useLightOnPrimaryColor ?
- mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
- mDismissButton.setImageDrawable(t.useLightOnPrimaryColor ?
- mLightDismissDrawable : mDarkDismissDrawable);
- mDismissButton.setContentDescription(String.format(mDismissDescFormat, t.titleDescription));
- mDismissButton.setOnClickListener(this);
- mDismissButton.setClickable(false);
- ((RippleDrawable) mDismissButton.getBackground()).setForceSoftware(true);
-
- // In accessibility, a single click on the focused app info button will show it
- if (touchExplorationEnabled) {
- mIconView.setContentDescription(String.format(mAppInfoDescFormat, t.titleDescription));
- mIconView.setOnClickListener(this);
- mIconView.setClickable(true);
- }
- }
-
- /**
- * Called when the bound task's data has loaded and this view should update to reflect the
- * changes.
- */
- public void onTaskDataLoaded() {
- if (mTask != null && mTask.icon != null) {
- mIconView.setImageDrawable(mTask.icon);
- }
- }
-
- /** Unbinds the bar view from the task */
- void unbindFromTask(boolean touchExplorationEnabled) {
- mTask = null;
- mIconView.setImageDrawable(null);
- if (touchExplorationEnabled) {
- mIconView.setClickable(false);
- }
- }
-
- /** Animates this task bar if the user does not interact with the stack after a certain time. */
- void startNoUserInteractionAnimation() {
- int duration = getResources().getInteger(R.integer.recents_task_enter_from_app_duration);
- mDismissButton.setVisibility(View.VISIBLE);
- mDismissButton.setClickable(true);
- if (mDismissButton.getVisibility() == VISIBLE) {
- mDismissButton.animate()
- .alpha(1f)
- .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN)
- .setDuration(duration)
- .start();
- } else {
- mDismissButton.setAlpha(1f);
- }
- if (mMoveTaskButton != null) {
- if (mMoveTaskButton.getVisibility() == VISIBLE) {
- mMoveTaskButton.setVisibility(View.VISIBLE);
- mMoveTaskButton.setClickable(true);
- mMoveTaskButton.animate()
- .alpha(1f)
- .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN)
- .setDuration(duration)
- .start();
- } else {
- mMoveTaskButton.setAlpha(1f);
- }
- }
- }
-
- /**
- * Mark this task view that the user does has not interacted with the stack after a certain
- * time.
- */
- public void setNoUserInteractionState() {
- mDismissButton.setVisibility(View.VISIBLE);
- mDismissButton.animate().cancel();
- mDismissButton.setAlpha(1f);
- mDismissButton.setClickable(true);
- if (mMoveTaskButton != null) {
- mMoveTaskButton.setVisibility(View.VISIBLE);
- mMoveTaskButton.animate().cancel();
- mMoveTaskButton.setAlpha(1f);
- mMoveTaskButton.setClickable(true);
- }
- }
-
- /**
- * Resets the state tracking that the user has not interacted with the stack after a certain
- * time.
- */
- void resetNoUserInteractionState() {
- mDismissButton.setVisibility(View.INVISIBLE);
- mDismissButton.setAlpha(0f);
- mDismissButton.setClickable(false);
- if (mMoveTaskButton != null) {
- mMoveTaskButton.setVisibility(View.INVISIBLE);
- mMoveTaskButton.setAlpha(0f);
- mMoveTaskButton.setClickable(false);
- }
- }
-
- @Override
- protected int[] onCreateDrawableState(int extraSpace) {
-
- // Don't forward our state to the drawable - we do it manually in onTaskViewFocusChanged.
- // This is to prevent layer trashing when the view is pressed.
- return new int[] {};
- }
-
- @Override
- public void onClick(View v) {
- if (v == mIconView) {
- // In accessibility, a single click on the focused app info button will show it
- EventBus.getDefault().send(new ShowApplicationInfoEvent(mTask));
- } else if (v == mDismissButton) {
- TaskView tv = Utilities.findParent(this, TaskView.class);
- tv.dismissTask();
-
- // Keep track of deletions by the dismiss button
- MetricsLogger.histogram(getContext(), "overview_task_dismissed_source",
- Constants.Metrics.DismissSourceHeaderButton);
- } else if (v == mMoveTaskButton) {
- TaskView tv = Utilities.findParent(this, TaskView.class);
- EventBus.getDefault().send(new LaunchTaskEvent(tv, mTask, null, false,
- mTaskWindowingMode, ACTIVITY_TYPE_UNDEFINED));
- } else if (v == mAppInfoView) {
- EventBus.getDefault().send(new ShowApplicationInfoEvent(mTask));
- } else if (v == mAppIconView) {
- hideAppOverlay(false /* immediate */);
- }
- }
-
- @Override
- public boolean onLongClick(View v) {
- if (v == mIconView) {
- showAppOverlay();
- return true;
- } else if (v == mAppIconView) {
- hideAppOverlay(false /* immediate */);
- return true;
- }
- return false;
- }
-
- /**
- * Shows the application overlay.
- */
- private void showAppOverlay() {
- // Skip early if the task is invalid
- SystemServicesProxy ssp = LegacyRecentsImpl.getSystemServices();
- ComponentName cn = mTask.key.getComponent();
- int userId = mTask.key.userId;
- ActivityInfo activityInfo = PackageManagerWrapper.getInstance().getActivityInfo(cn, userId);
- if (activityInfo == null) {
- return;
- }
-
- // Inflate the overlay if necessary
- if (mAppOverlayView == null) {
- mAppOverlayView = (FrameLayout) Utilities.findViewStubById(this,
- R.id.app_overlay_stub).inflate();
- mAppOverlayView.setBackground(mOverlayBackground);
- mAppIconView = (ImageView) mAppOverlayView.findViewById(R.id.app_icon);
- mAppIconView.setOnClickListener(this);
- mAppIconView.setOnLongClickListener(this);
- mAppInfoView = (ImageView) mAppOverlayView.findViewById(R.id.app_info);
- mAppInfoView.setOnClickListener(this);
- mAppTitleView = (TextView) mAppOverlayView.findViewById(R.id.app_title);
- updateLayoutParams(mAppIconView, mAppTitleView, null, mAppInfoView);
- }
-
- // Update the overlay contents for the current app
- mAppTitleView.setText(ActivityManagerWrapper.getInstance().getBadgedApplicationLabel(
- activityInfo.applicationInfo, userId));
- mAppTitleView.setTextColor(mTask.useLightOnPrimaryColor ?
- mTaskBarViewLightTextColor : mTaskBarViewDarkTextColor);
- mAppIconView.setImageDrawable(getIconDrawableFactory().getBadgedIcon(
- activityInfo.applicationInfo, userId));
- mAppInfoView.setImageDrawable(mTask.useLightOnPrimaryColor
- ? mLightInfoIcon
- : mDarkInfoIcon);
- mAppOverlayView.setVisibility(View.VISIBLE);
-
- int x = mIconView.getLeft() + mIconView.getWidth() / 2;
- int y = mIconView.getTop() + mIconView.getHeight() / 2;
- Animator revealAnim = ViewAnimationUtils.createCircularReveal(mAppOverlayView, x, y, 0,
- getWidth());
- revealAnim.setDuration(OVERLAY_REVEAL_DURATION);
- revealAnim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
- revealAnim.start();
- }
-
- /**
- * Hide the application overlay.
- */
- private void hideAppOverlay(boolean immediate) {
- // Skip if we haven't even loaded the overlay yet
- if (mAppOverlayView == null) {
- return;
- }
-
- if (immediate) {
- mAppOverlayView.setVisibility(View.GONE);
- } else {
- int x = mIconView.getLeft() + mIconView.getWidth() / 2;
- int y = mIconView.getTop() + mIconView.getHeight() / 2;
- Animator revealAnim = ViewAnimationUtils.createCircularReveal(mAppOverlayView, x, y,
- getWidth(), 0);
- revealAnim.setDuration(OVERLAY_REVEAL_DURATION);
- revealAnim.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
- revealAnim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mAppOverlayView.setVisibility(View.GONE);
- }
- });
- revealAnim.start();
- }
- }
-
- private static IconDrawableFactory getIconDrawableFactory() {
- if (sDrawableFactory == null) {
- sDrawableFactory = IconDrawableFactory.newInstance(AppGlobals.getInitialApplication());
- }
- return sDrawableFactory;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewThumbnail.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewThumbnail.java
deleted file mode 100644
index 68f85a5..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewThumbnail.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.LightingColorFilter;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.Shader;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewDebug;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.ui.TaskSnapshotChangedEvent;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import java.io.PrintWriter;
-
-
-/**
- * The task thumbnail view. It implements an image view that allows for animating the dim and
- * alpha of the thumbnail image.
- */
-public class TaskViewThumbnail extends View {
-
- private static final ColorMatrix TMP_FILTER_COLOR_MATRIX = new ColorMatrix();
- private static final ColorMatrix TMP_BRIGHTNESS_COLOR_MATRIX = new ColorMatrix();
-
- private Task mTask;
-
- private int mDisplayOrientation = Configuration.ORIENTATION_UNDEFINED;
- private Rect mDisplayRect = new Rect();
-
- // Drawing
- @ViewDebug.ExportedProperty(category="recents")
- protected Rect mTaskViewRect = new Rect();
- @ViewDebug.ExportedProperty(category="recents")
- protected Rect mThumbnailRect = new Rect();
- @ViewDebug.ExportedProperty(category="recents")
- protected float mThumbnailScale;
- private float mFullscreenThumbnailScale = 1f;
- /** The height, in pixels, of the task view's title bar. */
- private int mTitleBarHeight;
- private boolean mSizeToFit = false;
- private boolean mOverlayHeaderOnThumbnailActionBar = true;
- private ThumbnailData mThumbnailData;
-
- protected int mCornerRadius;
- @ViewDebug.ExportedProperty(category="recents")
- private float mDimAlpha;
- private Matrix mMatrix = new Matrix();
- private Paint mDrawPaint = new Paint();
- protected Paint mLockedPaint = new Paint();
- protected Paint mBgFillPaint = new Paint();
- protected BitmapShader mBitmapShader;
- protected boolean mUserLocked = false;
- private LightingColorFilter mLightingColorFilter = new LightingColorFilter(0xffffffff, 0);
-
- // Clip the top of the thumbnail against the opaque header bar that overlaps this view
- private View mTaskBar;
-
- // Visibility optimization, if the thumbnail height is less than the height of the header
- // bar for the task view, then just mark this thumbnail view as invisible
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mInvisible;
-
- @ViewDebug.ExportedProperty(category="recents")
- private boolean mDisabledInSafeMode;
-
- public TaskViewThumbnail(Context context) {
- this(context, null);
- }
-
- public TaskViewThumbnail(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- mDrawPaint.setColorFilter(mLightingColorFilter);
- mDrawPaint.setFilterBitmap(true);
- mDrawPaint.setAntiAlias(true);
- Resources res = getResources();
- mCornerRadius = res.getDimensionPixelSize(R.dimen.recents_task_view_rounded_corners_radius);
- mBgFillPaint.setColor(Color.WHITE);
- mLockedPaint.setColor(Color.WHITE);
- mTitleBarHeight = res.getDimensionPixelSize(R.dimen.recents_grid_task_view_header_height);
- }
-
- /**
- * Called when the task view frame changes, allowing us to move the contents of the header
- * to match the frame changes.
- */
- public void onTaskViewSizeChanged(int width, int height) {
- // Return early if the bounds have not changed
- if (mTaskViewRect.width() == width && mTaskViewRect.height() == height) {
- return;
- }
-
- mTaskViewRect.set(0, 0, width, height);
- setLeftTopRightBottom(0, 0, width, height);
- updateThumbnailMatrix();
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- if (mInvisible) {
- return;
- }
-
- int viewWidth = mTaskViewRect.width();
- int viewHeight = mTaskViewRect.height();
- int thumbnailWidth = Math.min(viewWidth,
- (int) (mThumbnailRect.width() * mThumbnailScale));
- int thumbnailHeight = Math.min(viewHeight,
- (int) (mThumbnailRect.height() * mThumbnailScale));
-
- if (mUserLocked) {
- canvas.drawRoundRect(0, 0, viewWidth, viewHeight, mCornerRadius, mCornerRadius,
- mLockedPaint);
- } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
- int topOffset = 0;
- if (mTaskBar != null && mOverlayHeaderOnThumbnailActionBar) {
- topOffset = mTaskBar.getHeight() - mCornerRadius;
- }
-
- // Draw the background, there will be some small overdraw with the thumbnail
- if (thumbnailWidth < viewWidth) {
- // Portrait thumbnail on a landscape task view
- canvas.drawRoundRect(Math.max(0, thumbnailWidth - mCornerRadius), topOffset,
- viewWidth, viewHeight,
- mCornerRadius, mCornerRadius, mBgFillPaint);
- }
- if (thumbnailHeight < viewHeight) {
- // Landscape thumbnail on a portrait task view
- canvas.drawRoundRect(0, Math.max(topOffset, thumbnailHeight - mCornerRadius),
- viewWidth, viewHeight,
- mCornerRadius, mCornerRadius, mBgFillPaint);
- }
-
- // Draw the thumbnail
- canvas.drawRoundRect(0, topOffset, thumbnailWidth, thumbnailHeight,
- mCornerRadius, mCornerRadius, mDrawPaint);
- } else {
- canvas.drawRoundRect(0, 0, viewWidth, viewHeight, mCornerRadius, mCornerRadius,
- mBgFillPaint);
- }
- }
-
- /** Sets the thumbnail to a given bitmap. */
- void setThumbnail(ThumbnailData thumbnailData) {
- if (thumbnailData != null && thumbnailData.thumbnail != null) {
- Bitmap bm = thumbnailData.thumbnail;
- bm.prepareToDraw();
- mFullscreenThumbnailScale = thumbnailData.scale;
- mBitmapShader = new BitmapShader(bm, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
- mDrawPaint.setShader(mBitmapShader);
- mThumbnailRect.set(0, 0,
- bm.getWidth() - thumbnailData.insets.left - thumbnailData.insets.right,
- bm.getHeight() - thumbnailData.insets.top - thumbnailData.insets.bottom);
- mThumbnailData = thumbnailData;
- updateThumbnailMatrix();
- updateThumbnailPaintFilter();
- } else {
- mBitmapShader = null;
- mDrawPaint.setShader(null);
- mThumbnailRect.setEmpty();
- mThumbnailData = null;
- }
- }
-
- /** Updates the paint to draw the thumbnail. */
- void updateThumbnailPaintFilter() {
- if (mInvisible) {
- return;
- }
- int mul = (int) ((1.0f - mDimAlpha) * 255);
- if (mBitmapShader != null) {
- if (mDisabledInSafeMode) {
- // Brightness: C-new = C-old*(1-amount) + amount
- TMP_FILTER_COLOR_MATRIX.setSaturation(0);
- float scale = 1f - mDimAlpha;
- float[] mat = TMP_BRIGHTNESS_COLOR_MATRIX.getArray();
- mat[0] = scale;
- mat[6] = scale;
- mat[12] = scale;
- mat[4] = mDimAlpha * 255f;
- mat[9] = mDimAlpha * 255f;
- mat[14] = mDimAlpha * 255f;
- TMP_FILTER_COLOR_MATRIX.preConcat(TMP_BRIGHTNESS_COLOR_MATRIX);
- ColorMatrixColorFilter filter = new ColorMatrixColorFilter(TMP_FILTER_COLOR_MATRIX);
- mDrawPaint.setColorFilter(filter);
- mBgFillPaint.setColorFilter(filter);
- mLockedPaint.setColorFilter(filter);
- } else {
- mLightingColorFilter.setColorMultiply(Color.argb(255, mul, mul, mul));
- mDrawPaint.setColorFilter(mLightingColorFilter);
- mDrawPaint.setColor(0xFFffffff);
- mBgFillPaint.setColorFilter(mLightingColorFilter);
- mLockedPaint.setColorFilter(mLightingColorFilter);
- }
- } else {
- int grey = mul;
- mDrawPaint.setColorFilter(null);
- mDrawPaint.setColor(Color.argb(255, grey, grey, grey));
- }
- if (!mInvisible) {
- invalidate();
- }
- }
-
- /**
- * Updates the scale of the bitmap relative to this view.
- */
- public void updateThumbnailMatrix() {
- mThumbnailScale = 1f;
- if (mBitmapShader != null && mThumbnailData != null) {
- if (mTaskViewRect.isEmpty()) {
- // If we haven't measured , skip the thumbnail drawing and only draw the background
- // color
- mThumbnailScale = 0f;
- } else if (mSizeToFit) {
- // Make sure we fill the entire space regardless of the orientation.
- float viewAspectRatio = (float) mTaskViewRect.width() /
- (float) (mTaskViewRect.height() - mTitleBarHeight);
- float thumbnailAspectRatio =
- (float) mThumbnailRect.width() / (float) mThumbnailRect.height();
- if (viewAspectRatio > thumbnailAspectRatio) {
- mThumbnailScale =
- (float) mTaskViewRect.width() / (float) mThumbnailRect.width();
- } else {
- mThumbnailScale = (float) (mTaskViewRect.height() - mTitleBarHeight)
- / (float) mThumbnailRect.height();
- }
- } else {
- float invThumbnailScale = 1f / mFullscreenThumbnailScale;
- if (mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT) {
- if (mThumbnailData.orientation == Configuration.ORIENTATION_PORTRAIT) {
- // If we are in the same orientation as the screenshot, just scale it to the
- // width of the task view
- mThumbnailScale = (float) mTaskViewRect.width() / mThumbnailRect.width();
- } else {
- // Scale the landscape thumbnail up to app size, then scale that to the task
- // view size to match other portrait screenshots
- mThumbnailScale = invThumbnailScale *
- ((float) mTaskViewRect.width() / mDisplayRect.width());
- }
- } else {
- // Otherwise, scale the screenshot to fit 1:1 in the current orientation
- mThumbnailScale = invThumbnailScale;
- }
- }
- mMatrix.setTranslate(-mThumbnailData.insets.left * mFullscreenThumbnailScale,
- -mThumbnailData.insets.top * mFullscreenThumbnailScale);
- mMatrix.postScale(mThumbnailScale, mThumbnailScale);
- mBitmapShader.setLocalMatrix(mMatrix);
- }
- if (!mInvisible) {
- invalidate();
- }
- }
-
- /** Sets whether the thumbnail should be resized to fit the task view in all orientations. */
- public void setSizeToFit(boolean flag) {
- mSizeToFit = flag;
- }
-
- /**
- * Sets whether the header should overlap (and hide) the action bar in the thumbnail, or
- * be stacked just above it.
- */
- public void setOverlayHeaderOnThumbnailActionBar(boolean flag) {
- mOverlayHeaderOnThumbnailActionBar = flag;
- }
-
- /** Updates the clip rect based on the given task bar. */
- void updateClipToTaskBar(View taskBar) {
- mTaskBar = taskBar;
- invalidate();
- }
-
- /** Updates the visibility of the the thumbnail. */
- void updateThumbnailVisibility(int clipBottom) {
- boolean invisible = mTaskBar != null && (getHeight() - clipBottom) <= mTaskBar.getHeight();
- if (invisible != mInvisible) {
- mInvisible = invisible;
- if (!mInvisible) {
- updateThumbnailPaintFilter();
- }
- }
- }
-
- /**
- * Sets the dim alpha, only used when we are not using hardware layers.
- * (see RecentsConfiguration.useHardwareLayers)
- */
- public void setDimAlpha(float dimAlpha) {
- mDimAlpha = dimAlpha;
- updateThumbnailPaintFilter();
- }
-
- /**
- * Returns the {@link Paint} used to draw a task screenshot, or {@link #mLockedPaint} if the
- * thumbnail shouldn't be drawn because it belongs to a locked user.
- */
- protected Paint getDrawPaint() {
- if (mUserLocked) {
- return mLockedPaint;
- }
- return mDrawPaint;
- }
-
- /**
- * Binds the thumbnail view to the task.
- */
- void bindToTask(Task t, boolean disabledInSafeMode, int displayOrientation, Rect displayRect) {
- mTask = t;
- mDisabledInSafeMode = disabledInSafeMode;
- mDisplayOrientation = displayOrientation;
- mDisplayRect.set(displayRect);
- if (t.colorBackground != 0) {
- mBgFillPaint.setColor(t.colorBackground);
- }
- if (t.colorPrimary != 0) {
- mLockedPaint.setColor(t.colorPrimary);
- }
- mUserLocked = t.isLocked;
- EventBus.getDefault().register(this);
- }
-
- /**
- * Called when the bound task's data has loaded and this view should update to reflect the
- * changes.
- */
- void onTaskDataLoaded(ThumbnailData thumbnailData) {
- setThumbnail(thumbnailData);
- }
-
- /** Unbinds the thumbnail view from the task */
- void unbindFromTask() {
- mTask = null;
- setThumbnail(null);
- EventBus.getDefault().unregister(this);
- }
-
- public final void onBusEvent(TaskSnapshotChangedEvent event) {
- if (mTask == null || event.taskId != mTask.key.id || event.thumbnailData == null
- || event.thumbnailData.thumbnail == null) {
- return;
- }
- setThumbnail(event.thumbnailData);
- }
-
- public void dump(String prefix, PrintWriter writer) {
- writer.print(prefix); writer.print("TaskViewThumbnail");
- writer.print(" mTaskViewRect="); writer.print(Utilities.dumpRect(mTaskViewRect));
- writer.print(" mThumbnailRect="); writer.print(Utilities.dumpRect(mThumbnailRect));
- writer.print(" mThumbnailScale="); writer.print(mThumbnailScale);
- writer.print(" mDimAlpha="); writer.print(mDimAlpha);
- writer.println();
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewTransform.java
deleted file mode 100644
index 48a7336..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/TaskViewTransform.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.animation.Animator;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.util.Property;
-import android.view.View;
-
-import com.android.systemui.recents.utilities.AnimationProps;
-import com.android.systemui.recents.utilities.Utilities;
-
-import java.util.ArrayList;
-
-/**
- * The visual properties for a {@link TaskView}.
- */
-public class TaskViewTransform {
-
- public static final Property<View, Rect> LTRB =
- new Property<View, Rect>(Rect.class, "leftTopRightBottom") {
-
- private Rect mTmpRect = new Rect();
-
- @Override
- public void set(View v, Rect ltrb) {
- v.setLeftTopRightBottom(ltrb.left, ltrb.top, ltrb.right, ltrb.bottom);
- }
-
- @Override
- public Rect get(View v) {
- mTmpRect.set(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
- return mTmpRect;
- }
- };
-
- public float translationZ = 0;
- public float scale = 1f;
- public float alpha = 1f;
- public float dimAlpha = 0f;
- public float viewOutlineAlpha = 0f;
-
- public boolean visible = false;
-
- // This is a window-space rect used for positioning the task in the stack
- public RectF rect = new RectF();
-
- /**
- * Fills int this transform from the state of the given TaskView.
- */
- public void fillIn(TaskView tv) {
- translationZ = tv.getTranslationZ();
- scale = tv.getScaleX();
- alpha = tv.getAlpha();
- visible = true;
- dimAlpha = tv.getDimAlpha();
- viewOutlineAlpha = tv.getViewBounds().getAlpha();
- rect.set(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
- }
-
- /**
- * Copies the transform state from another {@link TaskViewTransform}.
- */
- public void copyFrom(TaskViewTransform other) {
- translationZ = other.translationZ;
- scale = other.scale;
- alpha = other.alpha;
- visible = other.visible;
- dimAlpha = other.dimAlpha;
- viewOutlineAlpha = other.viewOutlineAlpha;
- rect.set(other.rect);
- }
-
- /**
- * @return whether {@param other} is the same transform as this
- */
- public boolean isSame(TaskViewTransform other) {
- return translationZ == other.translationZ
- && scale == other.scale
- && other.alpha == alpha
- && dimAlpha == other.dimAlpha
- && visible == other.visible
- && rect.equals(other.rect);
- }
-
- /**
- * Resets the current transform.
- */
- public void reset() {
- translationZ = 0;
- scale = 1f;
- alpha = 1f;
- dimAlpha = 0f;
- viewOutlineAlpha = 0f;
- visible = false;
- rect.setEmpty();
- }
-
- /** Convenience functions to compare against current property values */
- public boolean hasAlphaChangedFrom(float v) {
- return (Float.compare(alpha, v) != 0);
- }
-
- public boolean hasScaleChangedFrom(float v) {
- return (Float.compare(scale, v) != 0);
- }
-
- public boolean hasTranslationZChangedFrom(float v) {
- return (Float.compare(translationZ, v) != 0);
- }
-
- public boolean hasRectChangedFrom(View v) {
- return ((int) rect.left != v.getLeft()) || ((int) rect.right != v.getRight()) ||
- ((int) rect.top != v.getTop()) || ((int) rect.bottom != v.getBottom());
- }
-
- /**
- * Applies this transform to a view.
- */
- public void applyToTaskView(TaskView v, ArrayList<Animator> animators,
- AnimationProps animation, boolean allowShadows) {
- // Return early if not visible
- if (!visible) {
- return;
- }
-
- if (animation.isImmediate()) {
- if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) {
- v.setTranslationZ(translationZ);
- }
- if (hasScaleChangedFrom(v.getScaleX())) {
- v.setScaleX(scale);
- v.setScaleY(scale);
- }
- if (hasAlphaChangedFrom(v.getAlpha())) {
- v.setAlpha(alpha);
- }
- if (hasRectChangedFrom(v)) {
- v.setLeftTopRightBottom((int) rect.left, (int) rect.top, (int) rect.right,
- (int) rect.bottom);
- }
- } else {
- if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) {
- ObjectAnimator anim = ObjectAnimator.ofFloat(v, View.TRANSLATION_Z,
- v.getTranslationZ(), translationZ);
- animators.add(animation.apply(AnimationProps.TRANSLATION_Z, anim));
- }
- if (hasScaleChangedFrom(v.getScaleX())) {
- ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(v,
- PropertyValuesHolder.ofFloat(View.SCALE_X, v.getScaleX(), scale),
- PropertyValuesHolder.ofFloat(View.SCALE_Y, v.getScaleX(), scale));
- animators.add(animation.apply(AnimationProps.SCALE, anim));
- }
- if (hasAlphaChangedFrom(v.getAlpha())) {
- ObjectAnimator anim = ObjectAnimator.ofFloat(v, View.ALPHA, v.getAlpha(), alpha);
- animators.add(animation.apply(AnimationProps.ALPHA, anim));
- }
- if (hasRectChangedFrom(v)) {
- Rect fromViewRect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
- Rect toViewRect = new Rect();
- rect.round(toViewRect);
- ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(v,
- PropertyValuesHolder.ofObject(LTRB, Utilities.RECT_EVALUATOR,
- fromViewRect, toViewRect));
- animators.add(animation.apply(AnimationProps.BOUNDS, anim));
- }
- }
- }
-
- /** Reset the transform on a view. */
- public static void reset(TaskView v) {
- v.setTranslationX(0f);
- v.setTranslationY(0f);
- v.setTranslationZ(0f);
- v.setScaleX(1f);
- v.setScaleY(1f);
- v.setAlpha(1f);
- v.getViewBounds().setClipBottom(0);
- v.setLeftTopRightBottom(0, 0, 0, 0);
- }
-
- @Override
- public String toString() {
- return "R: " + rect + " V: " + visible;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/ViewPool.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/ViewPool.java
deleted file mode 100644
index a287fe6..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/ViewPool.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.recents.views;
-
-import android.content.Context;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-
-/* A view pool to manage more views than we can visibly handle */
-public class ViewPool<V, T> {
-
- /* An interface to the consumer of a view pool */
- public interface ViewPoolConsumer<V, T> {
- public V createView(Context context);
- public void onReturnViewToPool(V v);
- public void onPickUpViewFromPool(V v, T prepareData, boolean isNewView);
- public boolean hasPreferredData(V v, T preferredData);
- }
-
- Context mContext;
- ViewPoolConsumer<V, T> mViewCreator;
- LinkedList<V> mPool = new LinkedList<V>();
-
- /** Initializes the pool with a fixed predetermined pool size */
- public ViewPool(Context context, ViewPoolConsumer<V, T> viewCreator) {
- mContext = context;
- mViewCreator = viewCreator;
- }
-
- /** Returns a view into the pool */
- void returnViewToPool(V v) {
- mViewCreator.onReturnViewToPool(v);
- mPool.push(v);
- }
-
- /** Gets a view from the pool and prepares it */
- V pickUpViewFromPool(T preferredData, T prepareData) {
- V v = null;
- boolean isNewView = false;
- if (mPool.isEmpty()) {
- v = mViewCreator.createView(mContext);
- isNewView = true;
- } else {
- // Try and find a preferred view
- Iterator<V> iter = mPool.iterator();
- while (iter.hasNext()) {
- V vpv = iter.next();
- if (mViewCreator.hasPreferredData(vpv, preferredData)) {
- v = vpv;
- iter.remove();
- break;
- }
- }
- // Otherwise, just grab the first view
- if (v == null) {
- v = mPool.pop();
- }
- }
- mViewCreator.onPickUpViewFromPool(v, prepareData, isNewView);
- return v;
- }
-
- /**
- * Returns the list of views in the pool.
- */
- List<V> getViews() {
- return mPool;
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/AnimateableGridViewBounds.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/AnimateableGridViewBounds.java
deleted file mode 100644
index a029478..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/AnimateableGridViewBounds.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.views.grid;
-
-import android.view.View;
-import com.android.systemui.recents.views.AnimateableViewBounds;
-
-/* An outline provider for grid-based task views. */
-class AnimateableGridViewBounds extends AnimateableViewBounds {
-
- public AnimateableGridViewBounds(View source, int cornerRadius) {
- super(source, cornerRadius);
- }
-
- @Override
- protected void updateClipBounds() {
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskView.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskView.java
deleted file mode 100644
index 8b4700c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskView.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.views.grid;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import com.android.systemui.R;
-import com.android.systemui.recents.views.AnimateableViewBounds;
-import com.android.systemui.recents.views.TaskView;
-
-public class GridTaskView extends TaskView {
-
- /** The height, in pixels, of the header view. */
- private int mHeaderHeight;
-
- public GridTaskView(Context context) {
- this(context, null);
- }
-
- public GridTaskView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public GridTaskView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public GridTaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- mHeaderHeight = context.getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_view_header_height);
- }
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- // Show the full thumbnail and don't overlap with the header.
- mThumbnailView.setSizeToFit(true);
- mThumbnailView.setOverlayHeaderOnThumbnailActionBar(false);
- mThumbnailView.updateThumbnailMatrix();
- mThumbnailView.setTranslationY(mHeaderHeight);
- mHeaderView.setShouldDarkenBackgroundColor(true);
- }
-
- @Override
- protected AnimateableViewBounds createOutlineProvider() {
- return new AnimateableGridViewBounds(this, mContext.getResources().getDimensionPixelSize(
- R.dimen.recents_task_view_shadow_rounded_corners_radius));
- }
-
- @Override
- protected void onConfigurationChanged() {
- super.onConfigurationChanged();
- mHeaderHeight = mContext.getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_view_header_height);
- mThumbnailView.setTranslationY(mHeaderHeight);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java
deleted file mode 100644
index 2d7cfb1..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views.grid;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Path;
-import android.util.AttributeSet;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.views.TaskViewThumbnail;
-
-public class GridTaskViewThumbnail extends TaskViewThumbnail {
-
- private final Path mThumbnailOutline = new Path();
- private final Path mRestBackgroundOutline = new Path();
- // True if either this view's size or thumbnail scale has changed and mThumbnailOutline should
- // be updated.
- private boolean mUpdateThumbnailOutline = true;
-
- public GridTaskViewThumbnail(Context context) {
- this(context, null);
- }
-
- public GridTaskViewThumbnail(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public GridTaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public GridTaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- mCornerRadius = getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_view_rounded_corners_radius);
- }
-
- /**
- * Called when the task view frame changes, allowing us to move the contents of the header
- * to match the frame changes.
- */
- public void onTaskViewSizeChanged(int width, int height) {
- mUpdateThumbnailOutline = true;
- super.onTaskViewSizeChanged(width, height);
- }
-
- /**
- * Updates the scale of the bitmap relative to this view.
- */
- public void updateThumbnailMatrix() {
- mUpdateThumbnailOutline = true;
- super.updateThumbnailMatrix();
- }
-
- private void updateThumbnailOutline() {
- final int titleHeight = getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_view_header_height);
- final int viewWidth = mTaskViewRect.width();
- final int viewHeight = mTaskViewRect.height() - titleHeight;
- final int thumbnailWidth = Math.min(viewWidth,
- (int) (mThumbnailRect.width() * mThumbnailScale));
- final int thumbnailHeight = Math.min(viewHeight,
- (int) (mThumbnailRect.height() * mThumbnailScale));
-
- if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
- // Draw the thumbnail, we only round the bottom corners:
- //
- // outerLeft outerRight
- // <-----------------------> mRestBackgroundOutline
- // _________________________ (thumbnailWidth < viewWidth)
- // |_______________________| outerTop A ____ B
- // | | ↑ | |
- // | | | | |
- // | | | | |
- // | | | | | C
- // \_______________________/ ↓ |__/
- // mCornerRadius outerBottom E D
- //
- // mRestBackgroundOutline (thumbnailHeight < viewHeight)
- // A _________________________ B
- // | | C
- // F \_______________________/
- // E D
- final int outerLeft = 0;
- final int outerTop = 0;
- final int outerRight = outerLeft + thumbnailWidth;
- final int outerBottom = outerTop + thumbnailHeight;
- createThumbnailPath(outerLeft, outerTop, outerRight, outerBottom, mThumbnailOutline);
-
- if (thumbnailWidth < viewWidth) {
- final int l = Math.max(0, outerRight - mCornerRadius);
- final int r = outerRight;
- final int t = outerTop;
- final int b = outerBottom;
- mRestBackgroundOutline.reset();
- mRestBackgroundOutline.moveTo(l, t); // A
- mRestBackgroundOutline.lineTo(r, t); // B
- mRestBackgroundOutline.lineTo(r, b - mCornerRadius); // C
- mRestBackgroundOutline.arcTo(r - 2 * mCornerRadius, b - 2 * mCornerRadius, r, b,
- 0, 90, false); // D
- mRestBackgroundOutline.lineTo(l, b); // E
- mRestBackgroundOutline.lineTo(l, t); // A
- mRestBackgroundOutline.close();
-
- }
- if (thumbnailHeight < viewHeight) {
- final int l = outerLeft;
- final int r = outerRight;
- final int t = Math.max(0, thumbnailHeight - mCornerRadius);
- final int b = outerBottom;
- mRestBackgroundOutline.reset();
- mRestBackgroundOutline.moveTo(l, t); // A
- mRestBackgroundOutline.lineTo(r, t); // B
- mRestBackgroundOutline.lineTo(r, b - mCornerRadius); // C
- mRestBackgroundOutline.arcTo(r - 2 * mCornerRadius, b - 2 * mCornerRadius, r, b,
- 0, 90, false); // D
- mRestBackgroundOutline.lineTo(l + mCornerRadius, b); // E
- mRestBackgroundOutline.arcTo(l, b - 2 * mCornerRadius, l + 2 * mCornerRadius, b,
- 90, 90, false); // F
- mRestBackgroundOutline.lineTo(l, t); // A
- mRestBackgroundOutline.close();
- }
- } else {
- createThumbnailPath(0, 0, viewWidth, viewHeight, mThumbnailOutline);
- }
- }
-
- private void createThumbnailPath(int outerLeft, int outerTop, int outerRight, int outerBottom,
- Path outPath) {
- outPath.reset();
- outPath.moveTo(outerLeft, outerTop);
- outPath.lineTo(outerRight, outerTop);
- outPath.lineTo(outerRight, outerBottom - mCornerRadius);
- outPath.arcTo(outerRight - 2 * mCornerRadius, outerBottom - 2 * mCornerRadius, outerRight,
- outerBottom, 0, 90, false);
- outPath.lineTo(outerLeft + mCornerRadius, outerBottom);
- outPath.arcTo(outerLeft, outerBottom - 2 * mCornerRadius, outerLeft + 2 * mCornerRadius,
- outerBottom, 90, 90, false);
- outPath.lineTo(outerLeft, outerTop);
- outPath.close();
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- final int titleHeight = getResources().getDimensionPixelSize(
- R.dimen.recents_grid_task_view_header_height);
- final int viewWidth = mTaskViewRect.width();
- final int viewHeight = mTaskViewRect.height() - titleHeight;
- final int thumbnailWidth = Math.min(viewWidth,
- (int) (mThumbnailRect.width() * mThumbnailScale));
- final int thumbnailHeight = Math.min(viewHeight,
- (int) (mThumbnailRect.height() * mThumbnailScale));
-
- if (mUpdateThumbnailOutline) {
- updateThumbnailOutline();
- mUpdateThumbnailOutline = false;
- }
-
- if (mUserLocked) {
- canvas.drawPath(mThumbnailOutline, mLockedPaint);
- } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
- // Draw the background, there will be some small overdraw with the thumbnail
- if (thumbnailWidth < viewWidth) {
- // Portrait thumbnail on a landscape task view
- canvas.drawPath(mRestBackgroundOutline, mBgFillPaint);
- }
- if (thumbnailHeight < viewHeight) {
- // Landscape thumbnail on a portrait task view
- canvas.drawPath(mRestBackgroundOutline, mBgFillPaint);
- }
- canvas.drawPath(mThumbnailOutline, getDrawPaint());
- } else {
- canvas.drawPath(mThumbnailOutline, mBgFillPaint);
- }
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java
deleted file mode 100644
index 719eaa7..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.recents.views.grid;
-
-import static com.android.systemui.recents.views.TaskStackLayoutAlgorithm.*;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Point;
-import android.graphics.Rect;
-import android.view.WindowManager;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.events.ui.focus.NavigateTaskViewEvent.Direction;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.TaskStackLayoutAlgorithm;
-import com.android.systemui.recents.views.TaskViewTransform;
-
-import java.util.ArrayList;
-
-public class TaskGridLayoutAlgorithm {
-
- private final String TAG = "TaskGridLayoutAlgorithm";
- public static final int MAX_LAYOUT_TASK_COUNT = 8;
-
- /** The horizontal padding around the whole recents view. */
- private int mPaddingLeftRight;
- /** The vertical padding around the whole recents view. */
- private int mPaddingTopBottom;
- /** The padding between task views. */
- private int mPaddingTaskView;
-
- private Rect mWindowRect;
- private Point mScreenSize = new Point();
-
- private Rect mTaskGridRect;
-
- /** The height, in pixels, of each task view's title bar. */
- private int mTitleBarHeight;
-
- /** The aspect ratio of each task thumbnail, without the title bar. */
- private float mAppAspectRatio;
- private Rect mSystemInsets = new Rect();
-
- /** The thickness of the focused task view frame. */
- private int mFocusedFrameThickness;
-
- /**
- * When the amount of tasks is determined, the size and position of every task view can be
- * decided. Each instance of TaskGridRectInfo store the task view information for a certain
- * amount of tasks.
- */
- class TaskGridRectInfo {
- Rect size;
- int[] xOffsets;
- int[] yOffsets;
- int tasksPerLine;
- int lines;
-
- TaskGridRectInfo(int taskCount) {
- size = new Rect();
- xOffsets = new int[taskCount];
- yOffsets = new int[taskCount];
-
- int layoutTaskCount = Math.min(MAX_LAYOUT_TASK_COUNT, taskCount);
- tasksPerLine = getTasksPerLine(layoutTaskCount);
- lines = layoutTaskCount < 4 ? 1 : 2;
-
- // A couple of special cases.
- boolean landscapeWindow = mWindowRect.width() > mWindowRect.height();
- boolean landscapeTaskView = mAppAspectRatio > 1;
- // If we're in portrait but task views are landscape, show more lines of fewer tasks.
- if (!landscapeWindow && landscapeTaskView) {
- tasksPerLine = layoutTaskCount < 2 ? 1 : 2;
- lines = layoutTaskCount < 3 ? 1 : (
- layoutTaskCount < 5 ? 2 : (
- layoutTaskCount < 7 ? 3 : 4));
- }
- // If we're in landscape but task views are portrait, show fewer lines of more tasks.
- if (landscapeWindow && !landscapeTaskView) {
- tasksPerLine = layoutTaskCount < 7 ? layoutTaskCount : 6;
- lines = layoutTaskCount < 7 ? 1 : 2;
- }
-
- int taskWidth, taskHeight;
- int maxTaskWidth = (mWindowRect.width() - 2 * mPaddingLeftRight
- - (tasksPerLine - 1) * mPaddingTaskView) / tasksPerLine;
- int maxTaskHeight = (mWindowRect.height() - 2 * mPaddingTopBottom
- - (lines - 1) * mPaddingTaskView) / lines;
-
- if (maxTaskHeight >= maxTaskWidth / mAppAspectRatio + mTitleBarHeight) {
- // Width bound.
- taskWidth = maxTaskWidth;
- // Here we should round the height to the nearest integer.
- taskHeight = (int) (maxTaskWidth / mAppAspectRatio + mTitleBarHeight + 0.5);
- } else {
- // Height bound.
- taskHeight = maxTaskHeight;
- // Here we should round the width to the nearest integer.
- taskWidth = (int) ((taskHeight - mTitleBarHeight) * mAppAspectRatio + 0.5);
- }
- size.set(0, 0, taskWidth, taskHeight);
-
- int emptySpaceX = mWindowRect.width() - 2 * mPaddingLeftRight
- - (tasksPerLine * taskWidth) - (tasksPerLine - 1) * mPaddingTaskView;
- int emptySpaceY = mWindowRect.height() - 2 * mPaddingTopBottom
- - (lines * taskHeight) - (lines - 1) * mPaddingTaskView;
- for (int taskIndex = 0; taskIndex < taskCount; taskIndex++) {
- // We also need to invert the index in order to display the most recent tasks first.
- int taskLayoutIndex = taskCount - taskIndex - 1;
-
- int xIndex = taskLayoutIndex % tasksPerLine;
- int yIndex = taskLayoutIndex / tasksPerLine;
- xOffsets[taskIndex] = mWindowRect.left +
- emptySpaceX / 2 + mPaddingLeftRight + (taskWidth + mPaddingTaskView) * xIndex;
- yOffsets[taskIndex] = mWindowRect.top +
- emptySpaceY / 2 + mPaddingTopBottom + (taskHeight + mPaddingTaskView) * yIndex;
- }
- }
-
- private int getTasksPerLine(int taskCount) {
- switch(taskCount) {
- case 0:
- return 0;
- case 1:
- return 1;
- case 2:
- case 4:
- return 2;
- case 3:
- case 5:
- case 6:
- return 3;
- case 7:
- case 8:
- return 4;
- default:
- throw new IllegalArgumentException("Unsupported task count " + taskCount);
- }
- }
- }
-
- /**
- * We can find task view sizes and positions from mTaskGridRectInfoList[k - 1] when there
- * are k tasks.
- */
- private TaskGridRectInfo[] mTaskGridRectInfoList;
-
- public TaskGridLayoutAlgorithm(Context context) {
- reloadOnConfigurationChange(context);
- }
-
- public void reloadOnConfigurationChange(Context context) {
- Resources res = context.getResources();
- mPaddingTaskView = res.getDimensionPixelSize(R.dimen.recents_grid_padding_task_view);
- mFocusedFrameThickness = res.getDimensionPixelSize(
- R.dimen.recents_grid_task_view_focused_frame_thickness);
-
- mTaskGridRect = new Rect();
- mTitleBarHeight = res.getDimensionPixelSize(R.dimen.recents_grid_task_view_header_height);
-
- WindowManager windowManager = (WindowManager) context
- .getSystemService(Context.WINDOW_SERVICE);
- windowManager.getDefaultDisplay().getRealSize(mScreenSize);
-
- updateAppAspectRatio();
- }
-
- /**
- * Returns the proper task view transform of a certain task view, according to its index and the
- * amount of task views.
- * @param taskIndex The index of the task view whose transform we want. It's never greater
- * than {@link MAX_LAYOUT_TASK_COUNT}.
- * @param taskCount The current amount of task views.
- * @param transformOut The result transform that this method returns.
- * @param stackLayout The base stack layout algorithm.
- * @return The expected transform of the (taskIndex)th task view.
- */
- public TaskViewTransform getTransform(int taskIndex, int taskCount,
- TaskViewTransform transformOut, TaskStackLayoutAlgorithm stackLayout) {
- if (taskCount == 0) {
- transformOut.reset();
- return transformOut;
- }
-
- TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1];
- mTaskGridRect.set(gridInfo.size);
-
- int x = gridInfo.xOffsets[taskIndex];
- int y = gridInfo.yOffsets[taskIndex];
- float z = stackLayout.mMaxTranslationZ;
-
- // We always set the dim alpha to 0, since we don't want grid task views to dim.
- float dimAlpha = 0f;
- // We always set the alpha of the view outline to 1, to make sure the shadow is visible.
- float viewOutlineAlpha = 1f;
-
- // We also need to invert the index in order to display the most recent tasks first.
- int taskLayoutIndex = taskCount - taskIndex - 1;
- boolean isTaskViewVisible = taskLayoutIndex < MAX_LAYOUT_TASK_COUNT;
-
- // Fill out the transform
- transformOut.scale = 1f;
- transformOut.alpha = isTaskViewVisible ? 1f : 0f;
- transformOut.translationZ = z;
- transformOut.dimAlpha = dimAlpha;
- transformOut.viewOutlineAlpha = viewOutlineAlpha;
- transformOut.rect.set(mTaskGridRect);
- transformOut.rect.offset(x, y);
- Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
- // We only show the 8 most recent tasks.
- transformOut.visible = isTaskViewVisible;
- return transformOut;
- }
-
- /**
- * Return the proper task index to focus for arrow key navigation.
- * @param taskCount The amount of tasks.
- * @param currentFocusedIndex The index of the currently focused task.
- * @param direction The direction we're navigating.
- * @return The index of the task that should get the focus.
- */
- public int navigateFocus(int taskCount, int currentFocusedIndex, Direction direction) {
- if (taskCount < 1 || taskCount > MAX_LAYOUT_TASK_COUNT) {
- return -1;
- }
- if (currentFocusedIndex == -1) {
- return 0;
- }
- int newIndex = currentFocusedIndex;
- final TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1];
- final int currentLine = (taskCount - 1 - currentFocusedIndex) / gridInfo.tasksPerLine;
- switch (direction) {
- case UP:
- newIndex += gridInfo.tasksPerLine;
- newIndex = newIndex >= taskCount ? currentFocusedIndex : newIndex;
- break;
- case DOWN:
- newIndex -= gridInfo.tasksPerLine;
- newIndex = newIndex < 0 ? currentFocusedIndex : newIndex;
- break;
- case LEFT:
- newIndex++;
- final int leftMostIndex = (taskCount - 1) - currentLine * gridInfo.tasksPerLine;
- newIndex = newIndex > leftMostIndex ? currentFocusedIndex : newIndex;
- break;
- case RIGHT:
- newIndex--;
- int rightMostIndex =
- (taskCount - 1) - (currentLine + 1) * gridInfo.tasksPerLine + 1;
- rightMostIndex = rightMostIndex < 0 ? 0 : rightMostIndex;
- newIndex = newIndex < rightMostIndex ? currentFocusedIndex : newIndex;
- break;
- }
- return newIndex;
- }
-
- public void initialize(Rect windowRect) {
- mWindowRect = windowRect;
- // Define paddings in terms of percentage of the total area.
- mPaddingLeftRight = (int) (0.025f * Math.min(mWindowRect.width(), mWindowRect.height()));
- mPaddingTopBottom = (int) (0.1 * mWindowRect.height());
-
- // Pre-calculate the positions and offsets of task views so that we can reuse them directly
- // in the future.
- mTaskGridRectInfoList = new TaskGridRectInfo[MAX_LAYOUT_TASK_COUNT];
- for (int i = 0; i < MAX_LAYOUT_TASK_COUNT; i++) {
- mTaskGridRectInfoList[i] = new TaskGridRectInfo(i + 1);
- }
- }
-
- public void setSystemInsets(Rect systemInsets) {
- mSystemInsets = systemInsets;
- updateAppAspectRatio();
- }
-
- private void updateAppAspectRatio() {
- int usableWidth = mScreenSize.x - mSystemInsets.left - mSystemInsets.right;
- int usableHeight = mScreenSize.y - mSystemInsets.top - mSystemInsets.bottom;
- mAppAspectRatio = (float) usableWidth / (float) usableHeight;
- }
-
- public Rect getStackActionButtonRect() {
- Rect buttonRect = new Rect(mWindowRect);
- buttonRect.right -= mPaddingLeftRight;
- buttonRect.left += mPaddingLeftRight;
- buttonRect.bottom = buttonRect.top + mPaddingTopBottom;
- return buttonRect;
- }
-
- public void updateTaskGridRect(int taskCount) {
- if (taskCount > 0) {
- TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1];
- mTaskGridRect.set(gridInfo.size);
- }
- }
-
- public Rect getTaskGridRect() {
- return mTaskGridRect;
- }
-
- public int getFocusFrameThickness() {
- return mFocusedFrameThickness;
- }
-
- public VisibilityReport computeStackVisibilityReport(ArrayList<Task> tasks) {
- int visibleCount = Math.min(TaskGridLayoutAlgorithm.MAX_LAYOUT_TASK_COUNT, tasks.size());
- return new VisibilityReport(visibleCount, visibleCount);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskViewFocusFrame.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskViewFocusFrame.java
deleted file mode 100644
index 1655f6c..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/grid/TaskViewFocusFrame.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views.grid;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.View;
-
-import android.view.ViewTreeObserver.OnGlobalFocusChangeListener;
-import com.android.systemui.R;
-import com.android.systemui.recents.model.TaskStack;
-import com.android.systemui.recents.views.TaskStackView;
-
-public class TaskViewFocusFrame extends View implements OnGlobalFocusChangeListener {
-
- private TaskStackView mSv;
- private TaskGridLayoutAlgorithm mTaskGridLayoutAlgorithm;
- public TaskViewFocusFrame(Context context) {
- this(context, null);
- }
-
- public TaskViewFocusFrame(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public TaskViewFocusFrame(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public TaskViewFocusFrame(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setBackground(mContext.getDrawable(
- R.drawable.recents_grid_task_view_focus_frame_background));
- setFocusable(false);
- hide();
- }
-
- public TaskViewFocusFrame(Context context, TaskStackView stackView,
- TaskGridLayoutAlgorithm taskGridLayoutAlgorithm) {
- this(context);
- mSv = stackView;
- mTaskGridLayoutAlgorithm = taskGridLayoutAlgorithm;
- }
-
- /**
- * Measure the width and height of the focus frame according to the current grid task view size.
- */
- public void measure() {
- int thickness = mTaskGridLayoutAlgorithm.getFocusFrameThickness();
- Rect rect = mTaskGridLayoutAlgorithm.getTaskGridRect();
- measure(
- MeasureSpec.makeMeasureSpec(rect.width() + thickness * 2, MeasureSpec.EXACTLY),
- MeasureSpec.makeMeasureSpec(rect.height() + thickness * 2, MeasureSpec.EXACTLY));
- }
-
- /**
- * Layout the focus frame with its size.
- */
- public void layout() {
- layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
- }
-
- /**
- * Update the current size of grid task view and the focus frame.
- */
- public void resize() {
- if (mSv.useGridLayout()) {
- mTaskGridLayoutAlgorithm.updateTaskGridRect(mSv.getStack().getTaskCount());
- measure();
- requestLayout();
- }
- }
-
- /**
- * Move the task view focus frame to surround the newly focused view. If it's {@code null} or
- * it's not an instance of GridTaskView, we hide the focus frame.
- * @param newFocus The newly focused view.
- */
- public void moveGridTaskViewFocus(View newFocus) {
- if (mSv.useGridLayout()) {
- // The frame only shows up in the grid layout. It shouldn't show up in the stack
- // layout including when we're in the split screen.
- if (newFocus instanceof GridTaskView) {
- // If the focus goes to a GridTaskView, we show the frame and layout it.
- int[] location = new int[2];
- newFocus.getLocationInWindow(location);
- int thickness = mTaskGridLayoutAlgorithm.getFocusFrameThickness();
- setTranslationX(location[0] - thickness);
- setTranslationY(location[1] - thickness);
- show();
- } else {
- // If focus goes to other views, we hide the frame.
- hide();
- }
- }
- }
-
- @Override
- public void onGlobalFocusChanged(View oldFocus, View newFocus) {
- if (!mSv.useGridLayout()) {
- return;
- }
- if (newFocus == null) {
- // We're going to touch mode, unset the focus.
- moveGridTaskViewFocus(null);
- return;
- }
- if (oldFocus == null) {
- // We're returning from touch mode, set the focus to the previously focused task.
- final TaskStack stack = mSv.getStack();
- final int taskCount = stack.getTaskCount();
- final int k = stack.indexOfTask(mSv.getFocusedTask());
- final int taskIndexToFocus = k == -1 ? (taskCount - 1) : (k % taskCount);
- mSv.setFocusedTask(taskIndexToFocus, false, true);
- }
- }
-
- private void show() {
- setAlpha(1f);
- }
-
- private void hide() {
- setAlpha(0f);
- }
-}
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/lowram/TaskStackLowRamLayoutAlgorithm.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/lowram/TaskStackLowRamLayoutAlgorithm.java
deleted file mode 100644
index 15c7c87..0000000
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/views/lowram/TaskStackLowRamLayoutAlgorithm.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.systemui.recents.views.lowram;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.view.ViewConfiguration;
-
-import com.android.systemui.R;
-import com.android.systemui.recents.LegacyRecentsImpl;
-import com.android.systemui.recents.RecentsActivityLaunchState;
-import com.android.systemui.recents.utilities.Utilities;
-import com.android.systemui.shared.recents.model.Task;
-import com.android.systemui.recents.views.TaskStackLayoutAlgorithm;
-import com.android.systemui.recents.views.TaskViewTransform;
-
-import java.util.ArrayList;
-
-import static com.android.systemui.recents.views.TaskStackLayoutAlgorithm.VisibilityReport;
-
-public class TaskStackLowRamLayoutAlgorithm {
-
- private static final String TAG = "TaskStackLowRamLayoutAlgorithm";
- private static final float MAX_OVERSCROLL = 0.2f / 0.3f;
-
- public static final int MAX_LAYOUT_TASK_COUNT = 9;
- public static final int NUM_TASK_VISIBLE_LAUNCHED_FROM_HOME = 2;
- public static final int NUM_TASK_VISIBLE_LAUNCHED_FROM_APP =
- NUM_TASK_VISIBLE_LAUNCHED_FROM_HOME + 1;
- private Rect mWindowRect;
-
- private int mFlingThreshold;
- private int mPadding;
- private int mPaddingLeftRight;
- private int mTopOffset;
- private int mPaddingEndTopBottom;
- private Rect mTaskRect = new Rect();
- private Rect mSystemInsets = new Rect();
-
- public TaskStackLowRamLayoutAlgorithm(Context context) {
- reloadOnConfigurationChange(context);
- }
-
- public void reloadOnConfigurationChange(Context context) {
- mPadding = context.getResources()
- .getDimensionPixelSize(R.dimen.recents_layout_side_margin_phone);
- mFlingThreshold = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
- }
-
- public void initialize(Rect windowRect) {
- mWindowRect = windowRect;
- if (mWindowRect.height() > 0) {
- int windowHeight = mWindowRect.height() - mSystemInsets.bottom;
- int windowWidth = mWindowRect.width() - mSystemInsets.right - mSystemInsets.left;
- int width = Math.min(windowWidth, windowHeight) - mPadding * 2;
- boolean isLandscape = windowWidth > windowHeight;
- mTaskRect.set(0, 0, width, isLandscape ? width * 2 / 3 : width);
- mPaddingLeftRight = (windowWidth - mTaskRect.width()) / 2;
- mPaddingEndTopBottom = (windowHeight - mTaskRect.height()) / 2;
-
- // Compute the top offset to center tasks in the middle of the screen
- mTopOffset = (getTotalHeightOfTasks(MAX_LAYOUT_TASK_COUNT) - windowHeight) / 2;
- }
- }
-
- public void setSystemInsets(Rect systemInsets) {
- mSystemInsets = systemInsets;
- }
-
- public VisibilityReport computeStackVisibilityReport(ArrayList<Task> tasks) {
- RecentsActivityLaunchState launchState = LegacyRecentsImpl.getConfiguration().getLaunchState();
- int maxVisible = launchState.launchedFromHome || launchState.launchedFromPipApp
- || launchState.launchedWithNextPipApp
- ? NUM_TASK_VISIBLE_LAUNCHED_FROM_HOME
- : NUM_TASK_VISIBLE_LAUNCHED_FROM_APP;
- int visibleCount = Math.min(maxVisible, tasks.size());
- return new VisibilityReport(visibleCount, visibleCount);
- }
-
- public void getFrontOfStackTransform(TaskViewTransform transformOut,
- TaskStackLayoutAlgorithm stackLayout) {
- if (mWindowRect == null) {
- transformOut.reset();
- return;
- }
-
- // Calculate the static task y position 2 tasks after/below the middle/current task
- int windowHeight = mWindowRect.height() - mSystemInsets.bottom;
- int bottomOfCurrentTask = (windowHeight + mTaskRect.height()) / 2;
- int y = bottomOfCurrentTask + mTaskRect.height() + mPadding * 2;
- fillStackTransform(transformOut, y, stackLayout.mMaxTranslationZ, true);
- }
-
- public void getBackOfStackTransform(TaskViewTransform transformOut,
- TaskStackLayoutAlgorithm stackLayout) {
- if (mWindowRect == null) {
- transformOut.reset();
- return;
- }
-
- // Calculate the static task y position 2 tasks before/above the middle/current task
- int windowHeight = mWindowRect.height() - mSystemInsets.bottom;
- int topOfCurrentTask = (windowHeight - mTaskRect.height()) / 2;
- int y = topOfCurrentTask - (mTaskRect.height() + mPadding) * 2;
- fillStackTransform(transformOut, y, stackLayout.mMaxTranslationZ, true);
- }
-
- public TaskViewTransform getTransform(int taskIndex, float stackScroll,
- TaskViewTransform transformOut, int taskCount, TaskStackLayoutAlgorithm stackLayout) {
- if (taskCount == 0) {
- transformOut.reset();
- return transformOut;
- }
- boolean visible = true;
- int y;
- if (taskCount > 1) {
- y = getTaskTopFromIndex(taskIndex) - percentageToScroll(stackScroll);
-
- // Check visibility from the bottom of the task
- visible = y + mPadding + getTaskRect().height() > 0;
- } else {
- int windowHeight = mWindowRect.height() - mSystemInsets.bottom;
- y = (windowHeight - mTaskRect.height()) / 2 - percentageToScroll(stackScroll);
- }
- fillStackTransform(transformOut, y, stackLayout.mMaxTranslationZ, visible);
- return transformOut;
- }
-
- /**
- * Finds the closest task to the scroll percentage in the y axis and returns the percentage of
- * the task to scroll to.
- * @param scrollP percentage to find nearest to
- * @param numTasks number of tasks in recents stack
- * @param velocity speed of fling
- */
- public float getClosestTaskP(float scrollP, int numTasks, int velocity) {
- int y = percentageToScroll(scrollP);
-
- int lastY = getTaskTopFromIndex(0) - mPaddingEndTopBottom;
- for (int i = 1; i < numTasks; i++) {
- int taskY = getTaskTopFromIndex(i) - mPaddingEndTopBottom;
- int diff = taskY - y;
- if (diff > 0) {
- int diffPrev = Math.abs(y - lastY);
- boolean useNext = diff > diffPrev;
- if (Math.abs(velocity) > mFlingThreshold) {
- useNext = velocity > 0;
- }
- return useNext
- ? scrollToPercentage(lastY) : scrollToPercentage(taskY);
- }
- lastY = taskY;
- }
- return scrollToPercentage(lastY);
- }
-
- /**
- * Convert a scroll value to a percentage
- * @param scroll a scroll value
- * @return a percentage that represents the scroll from the total height of tasks
- */
- public float scrollToPercentage(int scroll) {
- return (float) scroll / (mTaskRect.height() + mPadding);
- }
-
- /**
- * Converts a percentage to the scroll value from the total height of tasks
- * @param p a percentage that represents the scroll value
- * @return a scroll value in pixels
- */
- public int percentageToScroll(float p) {
- return (int) (p * (mTaskRect.height() + mPadding));
- }
-
- /**
- * Get the min scroll progress for low ram layout. This computes the top position of the
- * first task and reduce by the end padding to center the first task
- * @return position of max scroll
- */
- public float getMinScrollP() {
- return getScrollPForTask(0);
- }
-
- /**
- * Get the max scroll progress for low ram layout. This computes the top position of the last
- * task and reduce by the end padding to center the last task
- * @param taskCount the amount of tasks in the recents stack
- * @return position of max scroll
- */
- public float getMaxScrollP(int taskCount) {
- return getScrollPForTask(taskCount - 1);
- }
-
- /**
- * Get the initial scroll value whether launched from home or from an app.
- * @param taskCount the amount of tasks currently in recents
- * @param fromHome if launching recents from home or not
- * @return from home it will return max value and from app it will return 2nd last task
- */
- public float getInitialScrollP(int taskCount, boolean fromHome) {
- if (fromHome) {
- return getMaxScrollP(taskCount);
- }
- if (taskCount < 2) {
- return 0;
- }
- return getScrollPForTask(taskCount - 2);
- }
-
- /**
- * Get the scroll progress for any task
- * @param taskIndex task index to get the scroll progress of
- * @return scroll progress of task
- */
- public float getScrollPForTask(int taskIndex) {
- return scrollToPercentage(getTaskTopFromIndex(taskIndex) - mPaddingEndTopBottom);
- }
-
- public Rect getTaskRect() {
- return mTaskRect;
- }
-
- public float getMaxOverscroll() {
- return MAX_OVERSCROLL;
- }
-
- private int getTaskTopFromIndex(int index) {
- return getTotalHeightOfTasks(index) - mTopOffset;
- }
-
- private int getTotalHeightOfTasks(int taskCount) {
- return taskCount * mTaskRect.height() + (taskCount + 1) * mPadding;
- }
-
- private void fillStackTransform(TaskViewTransform transformOut, int y, int translationZ,
- boolean visible) {
- transformOut.scale = 1f;
- transformOut.alpha = 1f;
- transformOut.translationZ = translationZ;
- transformOut.dimAlpha = 0f;
- transformOut.viewOutlineAlpha = 1f;
- transformOut.rect.set(getTaskRect());
- transformOut.rect.offset(mPaddingLeftRight + mSystemInsets.left, y);
- Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
- transformOut.visible = visible;
- }
-}
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 8ba4c9c..ba6b695 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -24,6 +24,21 @@
android:layout_width="match_parent"
android:background="@drawable/system_bar_background">
+ <com.android.systemui.CornerHandleView
+ android:id="@+id/assist_hint_left"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="left|bottom"
+ android:rotation="270"
+ android:visibility="gone"/>
+ <com.android.systemui.CornerHandleView
+ android:id="@+id/assist_hint_right"
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="right|bottom"
+ android:rotation="180"
+ android:visibility="gone"/>
+
<com.android.systemui.statusbar.phone.NavigationBarInflaterView
android:id="@+id/navigation_inflater"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/rounded_corners.xml b/packages/SystemUI/res/layout/rounded_corners.xml
index b409c8f..1849068 100644
--- a/packages/SystemUI/res/layout/rounded_corners.xml
+++ b/packages/SystemUI/res/layout/rounded_corners.xml
@@ -18,18 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <com.android.systemui.CornerHandleView
- android:id="@+id/assist_hint_left"
- android:layout_width="36dp"
- android:layout_height="36dp"
- android:layout_gravity="left|top"
- android:visibility="gone"/>
- <com.android.systemui.CornerHandleView
- android:id="@+id/assist_hint_right"
- android:layout_width="36dp"
- android:layout_height="36dp"
- android:layout_gravity="right|bottom"
- android:visibility="gone"/>
<ImageView
android:id="@+id/left"
android:layout_width="12dp"
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 35eb272..8d167e8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -49,7 +49,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.InjectionInflationController;
public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSecurityView {
@@ -94,7 +94,7 @@
private final SpringAnimation mSpringAnimation;
private final VelocityTracker mVelocityTracker = VelocityTracker.obtain();
private final KeyguardUpdateMonitor mUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private float mLastTouchY = -1;
@@ -134,8 +134,8 @@
mSpringAnimation = new SpringAnimation(this, DynamicAnimation.Y);
mInjectionInflationController = new InjectionInflationController(
SystemUIFactory.getInstance().getRootComponent());
- mUnlockMethodCache = UnlockMethodCache.getInstance(context);
mViewConfiguration = ViewConfiguration.get(context);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
}
public void setSecurityCallback(SecurityCallback callback) {
@@ -272,7 +272,7 @@
*/
private void updateBiometricRetry() {
SecurityMode securityMode = getSecurityMode();
- mSwipeUpToRetry = mUnlockMethodCache.isFaceAuthEnabled()
+ mSwipeUpToRetry = mKeyguardStateController.isFaceAuthEnabled()
&& securityMode != SecurityMode.SimPin
&& securityMode != SecurityMode.SimPuk
&& securityMode != SecurityMode.None;
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 7771f86..37bb54c 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -97,7 +97,7 @@
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.FlashlightController;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NextAlarmController;
@@ -221,7 +221,7 @@
@Inject Lazy<FlashlightController> mFlashlightController;
@Inject Lazy<UserSwitcherController> mUserSwitcherController;
@Inject Lazy<UserInfoController> mUserInfoController;
- @Inject Lazy<KeyguardMonitor> mKeyguardMonitor;
+ @Inject Lazy<KeyguardStateController> mKeyguardMonitor;
@Inject Lazy<KeyguardUpdateMonitor> mKeyguardUpdateMonitor;
@Inject Lazy<BatteryController> mBatteryController;
@Inject Lazy<NightDisplayListener> mNightDisplayListener;
@@ -355,7 +355,7 @@
mProviders.put(FlashlightController.class, mFlashlightController::get);
- mProviders.put(KeyguardMonitor.class, mKeyguardMonitor::get);
+ mProviders.put(KeyguardStateController.class, mKeyguardMonitor::get);
mProviders.put(KeyguardUpdateMonitor.class, mKeyguardUpdateMonitor::get);
diff --git a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java b/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
index 4df7f0d..818b5e1 100644
--- a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
@@ -48,8 +48,8 @@
import com.android.systemui.statusbar.policy.FlashlightControllerImpl;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.HotspotControllerImpl;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitorImpl;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateControllerImpl;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.LocationControllerImpl;
import com.android.systemui.statusbar.policy.NetworkController;
@@ -146,7 +146,8 @@
/**
*/
@Binds
- public abstract KeyguardMonitor provideKeyguardMonitor(KeyguardMonitorImpl controllerImpl);
+ public abstract KeyguardStateController provideKeyguardMonitor(
+ KeyguardStateControllerImpl controllerImpl);
/**
*/
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
index f38b4f2..3e068b0 100644
--- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
+++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java
@@ -25,9 +25,6 @@
import static com.android.systemui.tuner.TunablePadding.FLAG_END;
import static com.android.systemui.tuner.TunablePadding.FLAG_START;
-import android.animation.Animator;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.annotation.Dimension;
import android.app.ActivityManager;
import android.app.Fragment;
@@ -52,7 +49,6 @@
import android.provider.Settings.Secure;
import android.util.DisplayMetrics;
import android.util.Log;
-import android.util.MathUtils;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.Gravity;
@@ -64,9 +60,6 @@
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -78,10 +71,7 @@
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.qs.SecureSetting;
-import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.phone.CollapsedStatusBarFragment;
-import com.android.systemui.statusbar.phone.NavigationBarTransitions;
-import com.android.systemui.statusbar.phone.NavigationModeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.tuner.TunablePadding;
import com.android.systemui.tuner.TunerService;
@@ -95,8 +85,7 @@
* An overlay that draws screen decorations in software (e.g for rounded corners or display cutout)
* for antialiasing and emulation purposes.
*/
-public class ScreenDecorations extends SystemUI implements Tunable,
- NavigationBarTransitions.DarkIntensityListener {
+public class ScreenDecorations extends SystemUI implements Tunable {
private static final boolean DEBUG = false;
private static final String TAG = "ScreenDecorations";
@@ -120,15 +109,11 @@
private float mDensity;
private WindowManager mWindowManager;
private int mRotation;
- private boolean mAssistHintVisible;
private DisplayCutoutView mCutoutTop;
private DisplayCutoutView mCutoutBottom;
private SecureSetting mColorInversionSetting;
private boolean mPendingRotationChange;
private Handler mHandler;
- private boolean mAssistHintBlocked = false;
- private boolean mIsReceivingNavBarColor = false;
- private boolean mInGesturalMode;
/**
* Converts a set of {@link Rect}s into a {@link Region}
@@ -153,160 +138,6 @@
mHandler.post(this::startOnScreenDecorationsThread);
setupStatusBarPaddingIfNeeded();
putComponent(ScreenDecorations.class, this);
- mInGesturalMode = QuickStepContract.isGesturalMode(
- Dependency.get(NavigationModeController.class)
- .addListener(this::handleNavigationModeChange));
- }
-
- @VisibleForTesting
- void handleNavigationModeChange(int navigationMode) {
- if (!mHandler.getLooper().isCurrentThread()) {
- mHandler.post(() -> handleNavigationModeChange(navigationMode));
- return;
- }
- boolean inGesturalMode = QuickStepContract.isGesturalMode(navigationMode);
- if (mInGesturalMode != inGesturalMode) {
- mInGesturalMode = inGesturalMode;
-
- if (mInGesturalMode && mOverlay == null) {
- setupDecorations();
- if (mOverlay != null) {
- updateLayoutParams();
- }
- }
- }
- }
-
- /**
- * Returns an animator that animates the given view from start to end over durationMs. Start and
- * end represent total animation progress: 0 is the start, 1 is the end, 1.1 would be an
- * overshoot.
- */
- Animator getHandleAnimator(View view, float start, float end, boolean isLeft, long durationMs,
- Interpolator interpolator) {
- // Note that lerp does allow overshoot, in cases where start and end are outside of [0,1].
- float scaleStart = MathUtils.lerp(2f, 1f, start);
- float scaleEnd = MathUtils.lerp(2f, 1f, end);
- Animator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, scaleStart, scaleEnd);
- Animator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, scaleStart, scaleEnd);
- float translationStart = MathUtils.lerp(0.2f, 0f, start);
- float translationEnd = MathUtils.lerp(0.2f, 0f, end);
- int xDirection = isLeft ? -1 : 1;
- Animator translateX = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
- xDirection * translationStart * view.getWidth(),
- xDirection * translationEnd * view.getWidth());
- Animator translateY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
- translationStart * view.getHeight(), translationEnd * view.getHeight());
-
- AnimatorSet set = new AnimatorSet();
- set.play(scaleX).with(scaleY);
- set.play(scaleX).with(translateX);
- set.play(scaleX).with(translateY);
- set.setDuration(durationMs);
- set.setInterpolator(interpolator);
- return set;
- }
-
- private void fade(View view, boolean fadeIn, boolean isLeft) {
- if (fadeIn) {
- view.animate().cancel();
- view.setAlpha(1f);
- view.setVisibility(View.VISIBLE);
-
- // A piecewise spring-like interpolation.
- // End value in one animator call must match the start value in the next, otherwise
- // there will be a discontinuity.
- AnimatorSet anim = new AnimatorSet();
- Animator first = getHandleAnimator(view, 0, 1.1f, isLeft, 750,
- new PathInterpolator(0, 0.45f, .67f, 1f));
- Interpolator secondInterpolator = new PathInterpolator(0.33f, 0, 0.67f, 1f);
- Animator second = getHandleAnimator(view, 1.1f, 0.97f, isLeft, 400,
- secondInterpolator);
- Animator third = getHandleAnimator(view, 0.97f, 1.02f, isLeft, 400,
- secondInterpolator);
- Animator fourth = getHandleAnimator(view, 1.02f, 1f, isLeft, 400,
- secondInterpolator);
- anim.play(first).before(second);
- anim.play(second).before(third);
- anim.play(third).before(fourth);
- anim.start();
- } else {
- view.animate().cancel();
- view.animate()
- .setInterpolator(new AccelerateInterpolator(1.5f))
- .setDuration(250)
- .alpha(0f);
- }
-
- }
-
- /**
- * Controls the visibility of the assist gesture handles.
- *
- * @param visible whether the handles should be shown
- */
- public void setAssistHintVisible(boolean visible) {
- if (!mHandler.getLooper().isCurrentThread()) {
- mHandler.post(() -> setAssistHintVisible(visible));
- return;
- }
-
- if (mAssistHintBlocked && visible) {
- if (VERBOSE) {
- Log.v(TAG, "Assist hint blocked, cannot make it visible");
- }
- return;
- }
-
- if (mOverlay == null || mBottomOverlay == null) {
- return;
- }
-
- if (mAssistHintVisible != visible) {
- mAssistHintVisible = visible;
-
- CornerHandleView assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
- CornerHandleView assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
- CornerHandleView assistHintBottomLeft = mBottomOverlay.findViewById(
- R.id.assist_hint_left);
- CornerHandleView assistHintBottomRight = mBottomOverlay.findViewById(
- R.id.assist_hint_right);
-
- switch (mRotation) {
- case RotationUtils.ROTATION_NONE:
- fade(assistHintBottomLeft, mAssistHintVisible, /* isLeft = */ true);
- fade(assistHintBottomRight, mAssistHintVisible, /* isLeft = */ false);
- break;
- case RotationUtils.ROTATION_LANDSCAPE:
- fade(assistHintTopRight, mAssistHintVisible, /* isLeft = */ true);
- fade(assistHintBottomRight, mAssistHintVisible, /* isLeft = */ false);
- break;
- case RotationUtils.ROTATION_SEASCAPE:
- fade(assistHintTopLeft, mAssistHintVisible, /* isLeft = */ false);
- fade(assistHintBottomLeft, mAssistHintVisible, /* isLeft = */ true);
- break;
- case RotationUtils.ROTATION_UPSIDE_DOWN:
- fade(assistHintTopLeft, mAssistHintVisible, /* isLeft = */ false);
- fade(assistHintTopRight, mAssistHintVisible, /* isLeft = */ true);
- break;
- }
- }
- updateWindowVisibilities();
- }
-
- /**
- * Prevents the assist hint from becoming visible even if `mAssistHintVisible` is true.
- */
- public void setAssistHintBlocked(boolean blocked) {
- if (!mHandler.getLooper().isCurrentThread()) {
- mHandler.post(() -> setAssistHintBlocked(blocked));
- return;
- }
-
- mAssistHintBlocked = blocked;
- if (mAssistHintVisible && mAssistHintBlocked) {
- hideAssistHandles();
- }
}
@VisibleForTesting
@@ -316,15 +147,11 @@
return thread.getThreadHandler();
}
- private boolean shouldHostHandles() {
- return mInGesturalMode;
- }
-
private void startOnScreenDecorationsThread() {
mRotation = RotationUtils.getExactRotation(mContext);
mWindowManager = mContext.getSystemService(WindowManager.class);
updateRoundedCornerRadii();
- if (hasRoundedCorners() || shouldDrawCutout() || shouldHostHandles()) {
+ if (hasRoundedCorners() || shouldDrawCutout()) {
setupDecorations();
}
@@ -501,26 +328,10 @@
if (mOverlay != null) {
updateLayoutParams();
updateViews();
- if (mAssistHintVisible) {
- // If assist handles are visible, hide them without animation and then make them
- // show once again (with corrected rotation).
- hideAssistHandles();
- setAssistHintVisible(true);
- }
}
}
}
- private void hideAssistHandles() {
- if (mOverlay != null && mBottomOverlay != null) {
- mOverlay.findViewById(R.id.assist_hint_left).setVisibility(View.GONE);
- mOverlay.findViewById(R.id.assist_hint_right).setVisibility(View.GONE);
- mBottomOverlay.findViewById(R.id.assist_hint_left).setVisibility(View.GONE);
- mBottomOverlay.findViewById(R.id.assist_hint_right).setVisibility(View.GONE);
- mAssistHintVisible = false;
- }
- }
-
private void updateRoundedCornerRadii() {
final int newRoundedDefault = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.rounded_corner_radius);
@@ -569,52 +380,12 @@
updateView(bottomRight, Gravity.TOP | Gravity.LEFT, 0);
}
- updateAssistantHandleViews();
mCutoutTop.setRotation(mRotation);
mCutoutBottom.setRotation(mRotation);
updateWindowVisibilities();
}
- private void updateAssistantHandleViews() {
- View assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
- View assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
- View assistHintBottomLeft = mBottomOverlay.findViewById(R.id.assist_hint_left);
- View assistHintBottomRight = mBottomOverlay.findViewById(R.id.assist_hint_right);
-
- final int assistHintVisibility = mAssistHintVisible ? View.VISIBLE : View.INVISIBLE;
-
- if (mRotation == RotationUtils.ROTATION_NONE) {
- assistHintTopLeft.setVisibility(View.GONE);
- assistHintTopRight.setVisibility(View.GONE);
- assistHintBottomLeft.setVisibility(assistHintVisibility);
- assistHintBottomRight.setVisibility(assistHintVisibility);
- updateView(assistHintBottomLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
- updateView(assistHintBottomRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
- } else if (mRotation == RotationUtils.ROTATION_LANDSCAPE) {
- assistHintTopLeft.setVisibility(View.GONE);
- assistHintTopRight.setVisibility(assistHintVisibility);
- assistHintBottomLeft.setVisibility(View.GONE);
- assistHintBottomRight.setVisibility(assistHintVisibility);
- updateView(assistHintTopRight, Gravity.BOTTOM | Gravity.LEFT, 270);
- updateView(assistHintBottomRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
- } else if (mRotation == RotationUtils.ROTATION_UPSIDE_DOWN) {
- assistHintTopLeft.setVisibility(assistHintVisibility);
- assistHintTopRight.setVisibility(assistHintVisibility);
- assistHintBottomLeft.setVisibility(View.GONE);
- assistHintBottomRight.setVisibility(View.GONE);
- updateView(assistHintTopLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
- updateView(assistHintTopRight, Gravity.BOTTOM | Gravity.RIGHT, 180);
- } else if (mRotation == RotationUtils.ROTATION_SEASCAPE) {
- assistHintTopLeft.setVisibility(assistHintVisibility);
- assistHintTopRight.setVisibility(View.GONE);
- assistHintBottomLeft.setVisibility(assistHintVisibility);
- assistHintBottomRight.setVisibility(View.GONE);
- updateView(assistHintTopLeft, Gravity.BOTTOM | Gravity.RIGHT, 180);
- updateView(assistHintBottomLeft, Gravity.BOTTOM | Gravity.LEFT, 270);
- }
- }
-
private void updateView(View v, int gravity, int rotation) {
((FrameLayout.LayoutParams) v.getLayoutParams()).gravity = gravity;
v.setRotation(rotation);
@@ -629,10 +400,7 @@
boolean visibleForCutout = shouldDrawCutout()
&& overlay.findViewById(R.id.display_cutout).getVisibility() == View.VISIBLE;
boolean visibleForRoundedCorners = hasRoundedCorners();
- boolean visibleForHandles = overlay.findViewById(R.id.assist_hint_left).getVisibility()
- == View.VISIBLE || overlay.findViewById(R.id.assist_hint_right).getVisibility()
- == View.VISIBLE;
- overlay.setVisibility(visibleForCutout || visibleForRoundedCorners || visibleForHandles
+ overlay.setVisibility(visibleForCutout || visibleForRoundedCorners
? View.VISIBLE : View.GONE);
}
@@ -766,31 +534,6 @@
view.setLayoutParams(params);
}
- @Override
- public void onDarkIntensity(float darkIntensity) {
- if (!mHandler.getLooper().isCurrentThread()) {
- mHandler.post(() -> onDarkIntensity(darkIntensity));
- return;
- }
- if (mOverlay != null) {
- CornerHandleView assistHintTopLeft = mOverlay.findViewById(R.id.assist_hint_left);
- CornerHandleView assistHintTopRight = mOverlay.findViewById(R.id.assist_hint_right);
-
- assistHintTopLeft.updateDarkness(darkIntensity);
- assistHintTopRight.updateDarkness(darkIntensity);
- }
-
- if (mBottomOverlay != null) {
- CornerHandleView assistHintBottomLeft = mBottomOverlay.findViewById(
- R.id.assist_hint_left);
- CornerHandleView assistHintBottomRight = mBottomOverlay.findViewById(
- R.id.assist_hint_right);
-
- assistHintBottomLeft.updateDarkness(darkIntensity);
- assistHintBottomRight.updateDarkness(darkIntensity);
- }
- }
-
@VisibleForTesting
static class TunablePaddingTagListener implements FragmentListener {
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index 8e69318..530dcdc 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -47,8 +47,7 @@
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.volume.VolumeDialogComponent;
import java.util.function.Consumer;
@@ -136,10 +135,11 @@
LockPatternUtils lockPatternUtils, ViewGroup container,
DismissCallbackRegistry dismissCallbackRegistry,
KeyguardBouncer.BouncerExpansionCallback expansionCallback,
- FalsingManager falsingManager, KeyguardBypassController bypassController) {
+ KeyguardStateController keyguardStateController, FalsingManager falsingManager,
+ KeyguardBypassController bypassController) {
return new KeyguardBouncer(context, callback, lockPatternUtils, container,
dismissCallbackRegistry, falsingManager,
- expansionCallback, UnlockMethodCache.getInstance(context),
+ expansionCallback, keyguardStateController,
Dependency.get(KeyguardUpdateMonitor.class), bypassController,
new Handler(Looper.getMainLooper()));
}
@@ -149,9 +149,9 @@
LockscreenWallpaper lockscreenWallpaper,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
- scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
+ scrimVisibleListener, dozeParameters, alarmManager, keyguardStateController);
}
public NotificationIconAreaController createNotificationIconAreaController(Context context,
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
index 9bdfa03..a3b94fb1 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleBehaviorController.java
@@ -32,7 +32,6 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.DumpController;
import com.android.systemui.Dumpable;
-import com.android.systemui.ScreenDecorations;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.phone.NavigationModeController;
@@ -71,7 +70,7 @@
private final Handler mHandler;
private final Runnable mHideHandles = this::hideHandles;
private final Runnable mShowAndGo = this::showAndGoInternal;
- private final Provider<ScreenDecorations> mScreenDecorations;
+ private final Provider<AssistHandleViewController> mAssistHandleViewController;
private final PhenotypeHelper mPhenotypeHelper;
private final Map<AssistHandleBehavior, BehaviorController> mBehaviorMap;
@@ -90,7 +89,7 @@
Context context,
AssistUtils assistUtils,
@Named(ASSIST_HANDLE_THREAD_NAME) Handler handler,
- Provider<ScreenDecorations> screenDecorations,
+ Provider<AssistHandleViewController> assistHandleViewController,
PhenotypeHelper phenotypeHelper,
Map<AssistHandleBehavior, BehaviorController> behaviorMap,
NavigationModeController navigationModeController,
@@ -98,7 +97,7 @@
mContext = context;
mAssistUtils = assistUtils;
mHandler = handler;
- mScreenDecorations = screenDecorations;
+ mAssistHandleViewController = assistHandleViewController;
mPhenotypeHelper = phenotypeHelper;
mBehaviorMap = behaviorMap;
@@ -229,12 +228,13 @@
}
if (handlesUnblocked(ignoreThreshold)) {
- ScreenDecorations screenDecorations = mScreenDecorations.get();
- if (screenDecorations == null) {
- Log.w(TAG, "Couldn't show handles, ScreenDecorations unavailable");
+ mHandlesShowing = true;
+ AssistHandleViewController assistHandleViewController =
+ mAssistHandleViewController.get();
+ if (assistHandleViewController == null) {
+ Log.w(TAG, "Couldn't show handles, AssistHandleViewController unavailable");
} else {
- mHandlesShowing = true;
- screenDecorations.setAssistHintVisible(true);
+ assistHandleViewController.setAssistHintVisible(true);
}
}
}
@@ -244,13 +244,14 @@
return;
}
- ScreenDecorations screenDecorations = mScreenDecorations.get();
- if (screenDecorations == null) {
- Log.w(TAG, "Couldn't hide handles, ScreenDecorations unavailable");
+ mHandlesShowing = false;
+ mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
+ AssistHandleViewController assistHandleViewController =
+ mAssistHandleViewController.get();
+ if (assistHandleViewController == null) {
+ Log.w(TAG, "Couldn't show handles, AssistHandleViewController unavailable");
} else {
- mHandlesShowing = false;
- mHandlesLastHiddenAt = SystemClock.elapsedRealtime();
- screenDecorations.setAssistHintVisible(false);
+ assistHandleViewController.setAssistHintVisible(false);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleViewController.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleViewController.java
new file mode 100644
index 0000000..f9ffb80
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleViewController.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2019 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.systemui.assist;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.os.Handler;
+import android.util.Log;
+import android.util.MathUtils;
+import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.PathInterpolator;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.systemui.CornerHandleView;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.NavigationBarTransitions;
+
+/**
+ * A class for managing Assistant handle show, hide and animation.
+ */
+public class AssistHandleViewController implements NavigationBarTransitions.DarkIntensityListener {
+
+ private static final boolean DEBUG = false;
+ private static final String TAG = "AssistHandleViewController";
+
+ private Handler mHandler;
+ private CornerHandleView mAssistHintLeft;
+ private CornerHandleView mAssistHintRight;
+
+ @VisibleForTesting
+ boolean mAssistHintVisible;
+ @VisibleForTesting
+ boolean mAssistHintBlocked = false;
+
+ public AssistHandleViewController(Handler handler, View navBar) {
+ mHandler = handler;
+ mAssistHintLeft = navBar.findViewById(R.id.assist_hint_left);
+ mAssistHintRight = navBar.findViewById(R.id.assist_hint_right);
+ }
+
+ @Override
+ public void onDarkIntensity(float darkIntensity) {
+ mAssistHintLeft.updateDarkness(darkIntensity);
+ mAssistHintRight.updateDarkness(darkIntensity);
+ }
+
+ /**
+ * Controls the visibility of the assist gesture handles.
+ *
+ * @param visible whether the handles should be shown
+ */
+ public void setAssistHintVisible(boolean visible) {
+ if (!mHandler.getLooper().isCurrentThread()) {
+ mHandler.post(() -> setAssistHintVisible(visible));
+ return;
+ }
+
+ if (mAssistHintBlocked && visible) {
+ if (DEBUG) {
+ Log.v(TAG, "Assist hint blocked, cannot make it visible");
+ }
+ return;
+ }
+
+ if (mAssistHintVisible != visible) {
+ mAssistHintVisible = visible;
+ fade(mAssistHintLeft, mAssistHintVisible, /* isLeft = */ true);
+ fade(mAssistHintRight, mAssistHintVisible, /* isLeft = */ false);
+ }
+ }
+
+ /**
+ * Prevents the assist hint from becoming visible even if `mAssistHintVisible` is true.
+ */
+ public void setAssistHintBlocked(boolean blocked) {
+ if (!mHandler.getLooper().isCurrentThread()) {
+ mHandler.post(() -> setAssistHintBlocked(blocked));
+ return;
+ }
+
+ mAssistHintBlocked = blocked;
+ if (mAssistHintVisible && mAssistHintBlocked) {
+ hideAssistHandles();
+ }
+ }
+
+ private void hideAssistHandles() {
+ mAssistHintLeft.setVisibility(View.GONE);
+ mAssistHintRight.setVisibility(View.GONE);
+ mAssistHintVisible = false;
+ }
+
+ /**
+ * Returns an animator that animates the given view from start to end over durationMs. Start and
+ * end represent total animation progress: 0 is the start, 1 is the end, 1.1 would be an
+ * overshoot.
+ */
+ Animator getHandleAnimator(View view, float start, float end, boolean isLeft, long durationMs,
+ Interpolator interpolator) {
+ // Note that lerp does allow overshoot, in cases where start and end are outside of [0,1].
+ float scaleStart = MathUtils.lerp(2f, 1f, start);
+ float scaleEnd = MathUtils.lerp(2f, 1f, end);
+ Animator scaleX = ObjectAnimator.ofFloat(view, View.SCALE_X, scaleStart, scaleEnd);
+ Animator scaleY = ObjectAnimator.ofFloat(view, View.SCALE_Y, scaleStart, scaleEnd);
+ float translationStart = MathUtils.lerp(0.2f, 0f, start);
+ float translationEnd = MathUtils.lerp(0.2f, 0f, end);
+ int xDirection = isLeft ? -1 : 1;
+ Animator translateX = ObjectAnimator.ofFloat(view, View.TRANSLATION_X,
+ xDirection * translationStart * view.getWidth(),
+ xDirection * translationEnd * view.getWidth());
+ Animator translateY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
+ translationStart * view.getHeight(), translationEnd * view.getHeight());
+
+ AnimatorSet set = new AnimatorSet();
+ set.play(scaleX).with(scaleY);
+ set.play(scaleX).with(translateX);
+ set.play(scaleX).with(translateY);
+ set.setDuration(durationMs);
+ set.setInterpolator(interpolator);
+ return set;
+ }
+
+ private void fade(View view, boolean fadeIn, boolean isLeft) {
+ if (fadeIn) {
+ view.animate().cancel();
+ view.setAlpha(1f);
+ view.setVisibility(View.VISIBLE);
+
+ // A piecewise spring-like interpolation.
+ // End value in one animator call must match the start value in the next, otherwise
+ // there will be a discontinuity.
+ AnimatorSet anim = new AnimatorSet();
+ Animator first = getHandleAnimator(view, 0, 1.1f, isLeft, 750,
+ new PathInterpolator(0, 0.45f, .67f, 1f));
+ Interpolator secondInterpolator = new PathInterpolator(0.33f, 0, 0.67f, 1f);
+ Animator second = getHandleAnimator(view, 1.1f, 0.97f, isLeft, 400,
+ secondInterpolator);
+ Animator third = getHandleAnimator(view, 0.97f, 1.02f, isLeft, 400,
+ secondInterpolator);
+ Animator fourth = getHandleAnimator(view, 1.02f, 1f, isLeft, 400,
+ secondInterpolator);
+ anim.play(first).before(second);
+ anim.play(second).before(third);
+ anim.play(third).before(fourth);
+ anim.start();
+ } else {
+ view.animate().cancel();
+ view.animate()
+ .setInterpolator(new AccelerateInterpolator(1.5f))
+ .setDuration(250)
+ .alpha(0f);
+ }
+
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java b/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
index 2a82d21..739eade 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistModule.java
@@ -24,8 +24,7 @@
import androidx.slice.Clock;
import com.android.internal.app.AssistUtils;
-import com.android.systemui.ScreenDecorations;
-import com.android.systemui.SysUiServiceProvider;
+import com.android.systemui.statusbar.NavigationBarController;
import java.util.EnumMap;
import java.util.Map;
@@ -69,8 +68,9 @@
}
@Provides
- static ScreenDecorations provideScreenDecorations(Context context) {
- return SysUiServiceProvider.getComponent(context, ScreenDecorations.class);
+ static AssistHandleViewController provideAssistHandleViewController(
+ NavigationBarController navigationBarController) {
+ return navigationBarController.getAssistHandlerViewController();
}
@Provides
diff --git a/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java b/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java
index b346a6e..bf81e1d 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/ui/DefaultUiController.java
@@ -38,9 +38,9 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.ScreenDecorations;
-import com.android.systemui.SysUiServiceProvider;
+import com.android.systemui.assist.AssistHandleViewController;
import com.android.systemui.assist.AssistManager;
+import com.android.systemui.statusbar.NavigationBarController;
import java.util.Locale;
@@ -163,9 +163,11 @@
}
private void updateAssistHandleVisibility() {
- ScreenDecorations decorations = SysUiServiceProvider.getComponent(mRoot.getContext(),
- ScreenDecorations.class);
- decorations.setAssistHintBlocked(mInvocationInProgress);
+ AssistHandleViewController controller = Dependency.get(NavigationBarController.class)
+ .getAssistHandlerViewController();
+ if (controller != null) {
+ controller.setAssistHintBlocked(mInvocationInProgress);
+ }
}
private void attach() {
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 8eeb629..57a5ae635 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -96,8 +96,8 @@
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.EmergencyDialerConstants;
import com.android.systemui.util.leak.RotationUtils;
import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator;
@@ -213,14 +213,17 @@
Dependency.get(ConfigurationController.class).addCallback(this);
mActivityStarter = Dependency.get(ActivityStarter.class);
- UnlockMethodCache unlockMethodCache = UnlockMethodCache.getInstance(context);
- unlockMethodCache.addListener(
- () -> {
- if (mDialog != null && mDialog.mPanelController != null) {
- boolean locked = !unlockMethodCache.canSkipBouncer();
- mDialog.mPanelController.onDeviceLockStateChanged(locked);
- }
- });
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ keyguardStateController.addCallback(new KeyguardStateController.Callback() {
+ @Override
+ public void onUnlockedChanged() {
+ if (mDialog != null && mDialog.mPanelController != null) {
+ boolean locked = !keyguardStateController.canDismissLockScreen();
+ mDialog.mPanelController.onDeviceLockStateChanged(locked);
+ }
+ }
+ });
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index 6f8665a..b9fe827 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -40,14 +40,14 @@
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.ExtensionController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks {
private static final float SHUTDOWN_SCRIM_ALPHA = 0.95f;
private final Context mContext;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final DeviceProvisionedController mDeviceProvisionedController;
private final ExtensionController.Extension<GlobalActionsPanelPlugin> mPanelExtension;
private GlobalActionsDialog mGlobalActions;
@@ -55,7 +55,7 @@
public GlobalActionsImpl(Context context) {
mContext = context;
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallback(this);
mPanelExtension = Dependency.get(ExtensionController.class)
@@ -79,7 +79,7 @@
if (mGlobalActions == null) {
mGlobalActions = new GlobalActionsDialog(mContext, manager);
}
- mGlobalActions.showDialog(mKeyguardMonitor.isShowing(),
+ mGlobalActions.showDialog(mKeyguardStateController.isShowing(),
mDeviceProvisionedController.isDeviceProvisioned(),
mPanelExtension.get());
Dependency.get(KeyguardUpdateMonitor.class).requestFaceAuth();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
index 38153ec..7fb5207 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
@@ -46,8 +46,8 @@
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
import java.util.ArrayList;
import java.util.List;
@@ -68,7 +68,7 @@
private final QSDetailClipper mClipper;
private final LightBarController mLightBarController;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
private final ScreenLifecycle mScreenLifecycle;
private final TileQueryHelper mTileQueryHelper;
private final View mTransparentView;
@@ -89,7 +89,7 @@
@Inject
public QSCustomizer(Context context, AttributeSet attrs,
LightBarController lightBarController,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
ScreenLifecycle screenLifecycle) {
super(new ContextThemeWrapper(context, R.style.edit_theme), attrs);
@@ -124,7 +124,7 @@
animator.setMoveDuration(TileAdapter.MOVE_DURATION);
mRecyclerView.setItemAnimator(animator);
mLightBarController = lightBarController;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mScreenLifecycle = screenLifecycle;
updateNavBackDrop(getResources().getConfiguration());
}
@@ -187,7 +187,7 @@
queryTiles();
mNotifQsContainer.setCustomizerAnimating(true);
mNotifQsContainer.setCustomizerShowing(true);
- mKeyguardMonitor.addCallback(mKeyguardCallback);
+ mKeyguardStateController.addCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -203,7 +203,7 @@
queryTiles();
mNotifQsContainer.setCustomizerAnimating(false);
mNotifQsContainer.setCustomizerShowing(true);
- mKeyguardMonitor.addCallback(mKeyguardCallback);
+ mKeyguardStateController.addCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -227,7 +227,7 @@
}
mNotifQsContainer.setCustomizerAnimating(animate);
mNotifQsContainer.setCustomizerShowing(false);
- mKeyguardMonitor.removeCallback(mKeyguardCallback);
+ mKeyguardStateController.removeCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -283,7 +283,7 @@
public void saveInstanceState(Bundle outState) {
if (isShown) {
- mKeyguardMonitor.removeCallback(mKeyguardCallback);
+ mKeyguardStateController.removeCallback(mKeyguardCallback);
}
outState.putBoolean(EXTRA_QS_CUSTOMIZING, mCustomizing);
}
@@ -315,7 +315,7 @@
@Override
public void onKeyguardShowingChanged() {
if (!isAttachedToWindow()) return;
- if (mKeyguardMonitor.isShowing() && !mOpening) {
+ if (mKeyguardStateController.isShowing() && !mOpening) {
hide();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
index 23f36e9..13cfa78 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
@@ -39,7 +39,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.phone.StatusBarIconController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.util.ArrayList;
import java.util.Collections;
@@ -296,14 +296,16 @@
@Override
public boolean isLocked() {
- KeyguardMonitor keyguardMonitor = Dependency.get(KeyguardMonitor.class);
- return keyguardMonitor.isShowing();
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ return keyguardStateController.isShowing();
}
@Override
public boolean isSecure() {
- KeyguardMonitor keyguardMonitor = Dependency.get(KeyguardMonitor.class);
- return keyguardMonitor.isSecure() && keyguardMonitor.isShowing();
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ return keyguardStateController.isMethodSecure() && keyguardStateController.isShowing();
}
private CustomTile getTileForToken(IBinder token) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
index b1dfbb5..0e813d1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
@@ -45,7 +45,7 @@
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import java.util.ArrayList;
@@ -61,7 +61,7 @@
private final CastController mController;
private final CastDetailAdapter mDetailAdapter;
- private final KeyguardMonitor mKeyguard;
+ private final KeyguardStateController mKeyguard;
private final NetworkController mNetworkController;
private final Callback mCallback = new Callback();
private final ActivityStarter mActivityStarter;
@@ -69,12 +69,13 @@
private boolean mWifiConnected;
@Inject
- public CastTile(QSHost host, CastController castController, KeyguardMonitor keyguardMonitor,
- NetworkController networkController, ActivityStarter activityStarter) {
+ public CastTile(QSHost host, CastController castController,
+ KeyguardStateController keyguardStateController, NetworkController networkController,
+ ActivityStarter activityStarter) {
super(host);
mController = castController;
mDetailAdapter = new CastDetailAdapter();
- mKeyguard = keyguardMonitor;
+ mKeyguard = keyguardStateController;
mNetworkController = networkController;
mActivityStarter = activityStarter;
mController.observe(this, mCallback);
@@ -257,7 +258,8 @@
}
};
- private final class Callback implements CastController.Callback, KeyguardMonitor.Callback {
+ private final class Callback implements CastController.Callback,
+ KeyguardStateController.Callback {
@Override
public void onCastDevicesChanged() {
refreshState();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
index 837ea9f..fbdca3b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
@@ -28,7 +28,7 @@
import com.android.systemui.plugins.qs.QSTile.BooleanState;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.tileimpl.QSTileImpl;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.LocationController.LocationChangeCallback;
@@ -40,16 +40,16 @@
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_location);
private final LocationController mController;
- private final KeyguardMonitor mKeyguard;
+ private final KeyguardStateController mKeyguard;
private final ActivityStarter mActivityStarter;
private final Callback mCallback = new Callback();
@Inject
public LocationTile(QSHost host, LocationController locationController,
- KeyguardMonitor keyguardMonitor, ActivityStarter activityStarter) {
+ KeyguardStateController keyguardStateController, ActivityStarter activityStarter) {
super(host);
mController = locationController;
- mKeyguard = keyguardMonitor;
+ mKeyguard = keyguardStateController;
mActivityStarter = activityStarter;
mController.observe(this, mCallback);
mKeyguard.observe(this, mCallback);
@@ -71,7 +71,7 @@
@Override
protected void handleClick() {
- if (mKeyguard.isSecure() && mKeyguard.isShowing()) {
+ if (mKeyguard.isMethodSecure() && mKeyguard.isShowing()) {
mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
final boolean wasEnabled = mState.value;
mHost.openPanels();
@@ -97,7 +97,7 @@
// Work around for bug 15916487: don't show location tile on top of lock screen. After the
// bug is fixed, this should be reverted to only hiding it on secure lock screens:
- // state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing());
+ // state.visible = !(mKeyguard.isMethodSecure() && mKeyguard.isShowing());
state.value = locationEnabled;
checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_SHARE_LOCATION);
if (state.disabledByPolicy == false) {
@@ -133,7 +133,7 @@
}
private final class Callback implements LocationChangeCallback,
- KeyguardMonitor.Callback {
+ KeyguardStateController.Callback {
@Override
public void onLocationSettingsChanged(boolean enabled) {
refreshState();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 156e3c0..681f3ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -57,8 +57,8 @@
import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.util.wakelock.SettableWakeLock;
import com.android.systemui.util.wakelock.WakeLock;
@@ -72,7 +72,7 @@
* Controls the indications and error messages shown on the Keyguard
*/
public class KeyguardIndicationController implements StateListener,
- UnlockMethodCache.OnUnlockMethodChangedListener {
+ KeyguardStateController.Callback {
private static final String TAG = "KeyguardIndication";
private static final boolean DEBUG_CHARGING_SPEED = false;
@@ -86,7 +86,7 @@
private final Context mContext;
private final ShadeController mShadeController;
private final AccessibilityController mAccessibilityController;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarStateController mStatusBarStateController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private ViewGroup mIndicationArea;
@@ -137,7 +137,7 @@
WakeLock.createPartial(context, "Doze:KeyguardIndication"),
Dependency.get(ShadeController.class),
Dependency.get(AccessibilityController.class),
- UnlockMethodCache.getInstance(context),
+ Dependency.get(KeyguardStateController.class),
Dependency.get(StatusBarStateController.class),
Dependency.get(KeyguardUpdateMonitor.class));
}
@@ -148,14 +148,15 @@
@VisibleForTesting
KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
LockPatternUtils lockPatternUtils, WakeLock wakeLock, ShadeController shadeController,
- AccessibilityController accessibilityController, UnlockMethodCache unlockMethodCache,
+ AccessibilityController accessibilityController,
+ KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
mLockIcon = lockIcon;
mShadeController = shadeController;
mAccessibilityController = accessibilityController;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mStatusBarStateController = statusBarStateController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
// lock icon is not used on all form factors.
@@ -181,7 +182,7 @@
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
mStatusBarStateController.addCallback(this);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
}
public void setIndicationArea(ViewGroup indicationArea) {
@@ -583,7 +584,7 @@
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
updateIndication(!mDozing);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
index 7bcbd36..09f8045 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
@@ -37,6 +37,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.RegisterStatusBarResult;
import com.android.systemui.Dependency;
+import com.android.systemui.assist.AssistHandleViewController;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -233,4 +234,9 @@
public NavigationBarFragment getDefaultNavigationBarFragment() {
return mNavigationBars.get(DEFAULT_DISPLAY);
}
+
+ /** @return {@link AssistHandleViewController} (only on the default display). */
+ public AssistHandleViewController getAssistHandlerViewController() {
+ return getDefaultNavigationBarFragment().getAssistHandlerViewController();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
index f782fab..4ba1114 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
@@ -54,7 +54,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -76,7 +76,8 @@
private final DeviceProvisionedController mDeviceProvisionedController =
Dependency.get(DeviceProvisionedController.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
// Lazy
private NotificationEntryManager mEntryManager;
@@ -507,8 +508,8 @@
// asking if the keyguard is showing. We still need to check it though because showing the
// camera on the keyguard has a state of SHADE but the keyguard is still showing.
final boolean showingKeyguard = mState != StatusBarState.SHADE
- || mKeyguardMonitor.isShowing();
- final boolean devicePublic = showingKeyguard && isSecure(getCurrentUserId());
+ || mKeyguardStateController.isShowing();
+ final boolean devicePublic = showingKeyguard && mKeyguardStateController.isMethodSecure();
// Look for public mode users. Users are considered public in either case of:
@@ -523,7 +524,7 @@
boolean needsSeparateChallenge = whitelistIpcs(() ->
mLockPatternUtils.isSeparateProfileChallengeEnabled(userId));
if (!devicePublic && userId != getCurrentUserId()
- && needsSeparateChallenge && isSecure(userId)) {
+ && needsSeparateChallenge && mLockPatternUtils.isSecure(userId)) {
// Keyguard.isDeviceLocked is updated asynchronously, assume that all profiles
// with separate challenge are locked when keyguard is visible to avoid race.
isProfilePublic = showingKeyguard || mKeyguardManager.isDeviceLocked(userId);
@@ -545,7 +546,7 @@
// // asking if the keyguard is showing. We still need to check it though because showing the
// // camera on the keyguard has a state of SHADE but the keyguard is still showing.
// final boolean showingKeyguard = mState != StatusBarState.SHADE
-// || mKeyguardMonitor.isShowing();
+// || mKeyguardStateController.isShowing();
// final boolean devicePublic = showingKeyguard && isSecure(getCurrentUserId());
//
//
@@ -570,10 +571,6 @@
// }
// }
- private boolean isSecure(int userId) {
- return mKeyguardMonitor.isSecure() || mLockPatternUtils.isSecure(userId);
- }
-
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("NotificationLockscreenUserManager state:");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 00a12a9..c50fb3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -17,10 +17,6 @@
import static com.android.systemui.Dependency.MAIN_HANDLER;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController
- .MODE_WAKE_AND_UNLOCK_PULSING;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK;
import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER;
import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK;
@@ -67,7 +63,7 @@
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -94,7 +90,8 @@
private final StatusBarStateController mStatusBarStateController
= Dependency.get(StatusBarStateController.class);
private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final KeyguardBypassController mKeyguardBypassController;
private static final HashSet<Integer> PAUSED_MEDIA_STATES = new HashSet<>();
static {
@@ -461,7 +458,7 @@
boolean wakeAndUnlock = mBiometricUnlockController != null
&& mBiometricUnlockController.isWakeAndUnlock();
- if (mKeyguardMonitor.isLaunchTransitionFadingAway() || wakeAndUnlock) {
+ if (mKeyguardStateController.isLaunchTransitionFadingAway() || wakeAndUnlock) {
mBackdrop.setVisibility(View.INVISIBLE);
Trace.endSection();
return;
@@ -599,7 +596,7 @@
boolean cannotAnimateDoze = shadeController != null
&& shadeController.isDozing()
&& !ScrimState.AOD.getAnimateChange();
- boolean needsBypassFading = mKeyguardMonitor.isBypassFadingAnimation();
+ boolean needsBypassFading = mKeyguardStateController.isBypassFadingAnimation();
if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
|| cannotAnimateDoze) && !needsBypassFading)
@@ -626,10 +623,12 @@
mBackdropBack.setImageDrawable(null);
mHandler.post(mHideBackdropFront);
});
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
mBackdrop.animate()
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
+ .setDuration(
+ mKeyguardStateController.getShortenedFadingAwayDuration())
+ .setStartDelay(
+ mKeyguardStateController.getKeyguardFadingAwayDelay())
.setInterpolator(Interpolators.LINEAR)
.start();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
index e4bd4fa..a0b144b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
@@ -16,16 +16,13 @@
package com.android.systemui.statusbar.notification;
-import android.content.Context;
import android.util.ArraySet;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -34,12 +31,11 @@
* A controller which dynamically controls the visibility of Notification content
*/
@Singleton
-public class DynamicPrivacyController implements UnlockMethodCache.OnUnlockMethodChangedListener {
+public class DynamicPrivacyController implements KeyguardStateController.Callback {
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final StatusBarStateController mStateController;
- private final KeyguardMonitor mKeyguardMonitor;
private ArraySet<Listener> mListeners = new ArraySet<>();
private boolean mLastDynamicUnlocked;
@@ -47,30 +43,18 @@
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Inject
- DynamicPrivacyController(Context context,
- KeyguardMonitor keyguardMonitor,
- NotificationLockscreenUserManager notificationLockscreenUserManager,
- StatusBarStateController stateController) {
- this(notificationLockscreenUserManager, keyguardMonitor,
- UnlockMethodCache.getInstance(context),
- stateController);
- }
-
- @VisibleForTesting
DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager,
- KeyguardMonitor keyguardMonitor,
- UnlockMethodCache unlockMethodCache,
+ KeyguardStateController keyguardStateController,
StatusBarStateController stateController) {
mLockscreenUserManager = notificationLockscreenUserManager;
mStateController = stateController;
- mUnlockMethodCache = unlockMethodCache;
- mKeyguardMonitor = keyguardMonitor;
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController = keyguardStateController;
+ mKeyguardStateController.addCallback(this);
mLastDynamicUnlocked = isDynamicallyUnlocked();
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
if (isDynamicPrivacyEnabled()) {
// We only want to notify our listeners if dynamic privacy is actually active
boolean dynamicallyUnlocked = isDynamicallyUnlocked();
@@ -92,8 +76,9 @@
}
public boolean isDynamicallyUnlocked() {
- return (mUnlockMethodCache.canSkipBouncer() || mKeyguardMonitor.isKeyguardGoingAway()
- || mKeyguardMonitor.isKeyguardFadingAway())
+ return (mKeyguardStateController.canDismissLockScreen()
+ || mKeyguardStateController.isKeyguardGoingAway()
+ || mKeyguardStateController.isKeyguardFadingAway())
&& isDynamicPrivacyEnabled();
}
@@ -107,7 +92,7 @@
*/
public boolean isInLockedDownShade() {
if (!mStatusBarKeyguardViewManager.isShowing()
- || !mUnlockMethodCache.isMethodSecure()) {
+ || !mKeyguardStateController.isMethodSecure()) {
return false;
}
int state = mStateController.getState();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index f3201ec..a5b7fa7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -55,7 +55,7 @@
import com.android.systemui.SystemUI;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.NotificationChannels;
import java.util.List;
@@ -64,7 +64,7 @@
* splitted screen.
*/
public class InstantAppNotifier extends SystemUI
- implements CommandQueue.Callbacks, KeyguardMonitor.Callback {
+ implements CommandQueue.Callbacks, KeyguardStateController.Callback {
private static final String TAG = "InstantAppNotifier";
public static final int NUM_TASKS_FOR_INSTANT_APP_INFO = 5;
@@ -72,13 +72,13 @@
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
private final ArraySet<Pair<String, Integer>> mCurrentNotifs = new ArraySet<>();
private boolean mDockedStackExists;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
public InstantAppNotifier() {}
@Override
public void start() {
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
// listen for user / profile change.
try {
@@ -88,7 +88,7 @@
}
SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
- mKeyguardMonitor.addCallback(this);
+ mKeyguardStateController.addCallback(this);
DockedStackExistsListener.register(
exists -> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 2d012c9..7cbdfb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -38,6 +38,7 @@
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -127,7 +128,7 @@
private final KeyguardBypassController mKeyguardBypassController;
private PowerManager.WakeLock mWakeLock;
private final KeyguardUpdateMonitor mUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarWindowController mStatusBarWindowController;
private final Context mContext;
private final int mWakeUpDelay;
@@ -150,11 +151,11 @@
KeyguardViewMediator keyguardViewMediator,
ScrimController scrimController,
StatusBar statusBar,
- UnlockMethodCache unlockMethodCache, Handler handler,
+ KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardBypassController keyguardBypassController) {
this(context, dozeScrimController, keyguardViewMediator, scrimController, statusBar,
- unlockMethodCache, handler, keyguardUpdateMonitor,
+ keyguardStateController, handler, keyguardUpdateMonitor,
context.getResources()
.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze),
keyguardBypassController);
@@ -162,14 +163,11 @@
@VisibleForTesting
protected BiometricUnlockController(Context context,
- DozeScrimController dozeScrimController,
- KeyguardViewMediator keyguardViewMediator,
- ScrimController scrimController,
- StatusBar statusBar,
- UnlockMethodCache unlockMethodCache, Handler handler,
- KeyguardUpdateMonitor keyguardUpdateMonitor,
- int wakeUpDelay,
- KeyguardBypassController keyguardBypassController) {
+ DozeScrimController dozeScrimController, KeyguardViewMediator keyguardViewMediator,
+ ScrimController scrimController, StatusBar statusBar,
+ KeyguardStateController keyguardStateController, Handler handler,
+ KeyguardUpdateMonitor keyguardUpdateMonitor, int wakeUpDelay,
+ KeyguardBypassController keyguardBypassController) {
mContext = context;
mPowerManager = context.getSystemService(PowerManager.class);
mUpdateMonitor = keyguardUpdateMonitor;
@@ -182,7 +180,7 @@
mKeyguardViewMediator = keyguardViewMediator;
mScrimController = scrimController;
mStatusBar = statusBar;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mHandler = handler;
mWakeUpDelay = wakeUpDelay;
mKeyguardBypassController = keyguardBypassController;
@@ -416,7 +414,7 @@
return MODE_ONLY_WAKE;
} else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
return MODE_WAKE_AND_UNLOCK_PULSING;
- } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) {
+ } else if (unlockingAllowed || !mKeyguardStateController.isMethodSecure()) {
return MODE_WAKE_AND_UNLOCK;
} else {
return MODE_SHOW_BOUNCER;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
index d655b2f..e78b85e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
@@ -38,7 +38,7 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.StatusBarIconController.DarkIconManager;
import com.android.systemui.statusbar.policy.EncryptionHelper;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
@@ -57,7 +57,7 @@
public static final int FADE_IN_DELAY = 50;
private PhoneStatusBarView mStatusBar;
private StatusBarStateController mStatusBarStateController;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
private NetworkController mNetworkController;
private LinearLayout mSystemIconArea;
private View mClockView;
@@ -79,7 +79,7 @@
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mNetworkController = Dependency.get(NetworkController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mStatusBarComponent = SysUiServiceProvider.getComponent(getContext(), StatusBar.class);
@@ -207,8 +207,8 @@
state |= DISABLE_CLOCK;
}
- if (!mKeyguardMonitor.isLaunchTransitionFadingAway()
- && !mKeyguardMonitor.isKeyguardFadingAway()
+ if (!mKeyguardStateController.isLaunchTransitionFadingAway()
+ && !mKeyguardStateController.isKeyguardFadingAway()
&& shouldHideNotificationIcons()
&& !(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
&& headsUpVisible)) {
@@ -268,7 +268,7 @@
* don't set the clock GONE otherwise it'll mess up the animation.
*/
private int clockHiddenMode() {
- if (!mStatusBar.isClosed() && !mKeyguardMonitor.isShowing()
+ if (!mStatusBar.isClosed() && !mKeyguardStateController.isShowing()
&& !mStatusBarStateController.isDozing()) {
return View.INVISIBLE;
}
@@ -345,11 +345,11 @@
.withEndAction(null);
// Synchronize the motion with the Keyguard fading if necessary.
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
v.animate()
- .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration())
+ .setDuration(mKeyguardStateController.getKeyguardFadingAwayDuration())
.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN)
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
.start();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
index f53c4e8..da62d9b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
@@ -39,7 +39,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import java.util.function.BiConsumer;
@@ -89,7 +89,7 @@
};
private boolean mAnimationsEnabled = true;
Point mPoint;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
public HeadsUpAppearanceController(
@@ -160,7 +160,7 @@
mWakeUpCoordinator = wakeUpCoordinator;
wakeUpCoordinator.addListener(this);
mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
}
@@ -378,7 +378,7 @@
boolean canShow = !mIsExpanded && notificationsShown;
if (mBypassController.getBypassEnabled() &&
(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
- || mKeyguardMonitor.isKeyguardGoingAway())
+ || mKeyguardStateController.isKeyguardGoingAway())
&& notificationsShown) {
canShow = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 83ecb55..68eca8d6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -80,6 +80,7 @@
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.ExtensionController.Extension;
import com.android.systemui.statusbar.policy.FlashlightController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory;
import com.android.systemui.tuner.TunerService;
@@ -89,7 +90,7 @@
* text.
*/
public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickListener,
- UnlockMethodCache.OnUnlockMethodChangedListener,
+ KeyguardStateController.Callback,
AccessibilityController.AccessibilityStateChangedCallback {
final static String TAG = "StatusBar/KeyguardBottomAreaView";
@@ -116,7 +117,6 @@
private static final int DOZE_ANIMATION_STAGGER_DELAY = 48;
private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250;
- private final UnlockMethodCache mUnlockMethodCache;
private KeyguardAffordanceView mRightAffordanceView;
private KeyguardAffordanceView mLeftAffordanceView;
private ViewGroup mIndicationArea;
@@ -128,6 +128,7 @@
private View mCameraPreview;
private ActivityStarter mActivityStarter;
+ private KeyguardStateController mKeyguardStateController;
private LockPatternUtils mLockPatternUtils;
private FlashlightController mFlashlightController;
private PreviewInflater mPreviewInflater;
@@ -183,7 +184,6 @@
public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
}
private AccessibilityDelegate mAccessibilityDelegate = new AccessibilityDelegate() {
@@ -239,6 +239,8 @@
mBurnInYOffset = getResources().getDimensionPixelSize(
R.dimen.default_burn_in_prevention_offset);
updateCameraVisibility();
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
+ mKeyguardStateController.addCallback(this);
setClipChildren(false);
setClipToPadding(false);
inflateCameraPreview();
@@ -276,13 +278,13 @@
getContext().registerReceiverAsUser(mDevicePolicyReceiver,
UserHandle.ALL, filter, null, null);
Dependency.get(KeyguardUpdateMonitor.class).registerCallback(mUpdateMonitorCallback);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mUnlockMethodCache.removeListener(this);
+ mKeyguardStateController.removeCallback(this);
mAccessibilityController.removeStateChangedCallback(this);
mRightExtension.destroy();
mLeftExtension.destroy();
@@ -544,7 +546,7 @@
mAssistManager.launchVoiceAssistFromKeyguard();
}
};
- if (mStatusBar.isKeyguardCurrentlySecure()) {
+ if (!mKeyguardStateController.canDismissLockScreen()) {
AsyncTask.execute(runnable);
} else {
boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr)
@@ -609,7 +611,7 @@
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
updateCameraVisibility();
}
@@ -811,11 +813,9 @@
@Override
public Intent getIntent() {
- KeyguardUpdateMonitor updateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer(
- KeyguardUpdateMonitor.getCurrentUser());
- boolean secure = mUnlockMethodCache.isMethodSecure();
- return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
+ boolean canDismissLs = mKeyguardStateController.canDismissLockScreen();
+ boolean secure = mKeyguardStateController.isMethodSecure();
+ return (secure && !canDismissLs) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index d7f67ce..c3de843 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -46,6 +46,7 @@
import com.android.systemui.R;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
@@ -69,7 +70,7 @@
private final Handler mHandler;
private final BouncerExpansionCallback mExpansionCallback;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
new KeyguardUpdateMonitorCallback() {
@Override
@@ -97,7 +98,8 @@
public KeyguardBouncer(Context context, ViewMediatorCallback callback,
LockPatternUtils lockPatternUtils, ViewGroup container,
DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager,
- BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache,
+ BouncerExpansionCallback expansionCallback,
+ KeyguardStateController keyguardStateController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardBypassController keyguardBypassController, Handler handler) {
mContext = context;
@@ -109,7 +111,7 @@
mDismissCallbackRegistry = dismissCallbackRegistry;
mExpansionCallback = expansionCallback;
mHandler = handler;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
mKeyguardBypassController = keyguardBypassController;
}
@@ -173,7 +175,7 @@
// Split up the work over multiple frames.
DejankUtils.removeCallbacks(mResetRunnable);
- if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
+ if (mKeyguardStateController.isFaceAuthEnabled() && !needsFullscreenBouncer()
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()
&& !mKeyguardBypassController.getBypassEnabled()) {
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
index 832ea9e..aca7f44 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
@@ -23,6 +23,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.StatusBarState
+import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.tuner.TunerService
import java.io.PrintWriter
import javax.inject.Inject
@@ -31,7 +32,7 @@
@Singleton
class KeyguardBypassController {
- private val unlockMethodCache: UnlockMethodCache
+ private val mKeyguardStateController: KeyguardStateController
private val statusBarStateController: StatusBarStateController
private var hasFaceFeature: Boolean
@@ -47,7 +48,7 @@
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
*/
var bypassEnabled: Boolean = false
- get() = field && unlockMethodCache.isFaceAuthEnabled
+ get() = field && mKeyguardStateController.isFaceAuthEnabled
private set
var bouncerShowing: Boolean = false
@@ -66,9 +67,10 @@
context: Context,
tunerService: TunerService,
statusBarStateController: StatusBarStateController,
- lockscreenUserManager: NotificationLockscreenUserManager
+ lockscreenUserManager: NotificationLockscreenUserManager,
+ keyguardStateController: KeyguardStateController
) {
- unlockMethodCache = UnlockMethodCache.getInstance(context)
+ this.mKeyguardStateController = keyguardStateController
this.statusBarStateController = statusBarStateController
hasFaceFeature = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
index d709730..de660ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
@@ -31,7 +31,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -47,7 +47,7 @@
private final Handler mHandler;
private final DarkIntensityApplier mApplier;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarStateController mStatusBarStateController;
private boolean mTransitionDeferring;
@@ -73,7 +73,7 @@
public LightBarTransitionsController(Context context, DarkIntensityApplier applier) {
mApplier = applier;
mHandler = new Handler();
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
SysUiServiceProvider.getComponent(context, CommandQueue.class)
.addCallback(this);
@@ -101,7 +101,7 @@
@Override
public void appTransitionPending(int displayId, boolean forced) {
- if (mDisplayId != displayId || mKeyguardMonitor.isKeyguardGoingAway() && !forced) {
+ if (mDisplayId != displayId || mKeyguardStateController.isKeyguardGoingAway() && !forced) {
return;
}
mTransitionPending = true;
@@ -123,7 +123,7 @@
@Override
public void appTransitionStarting(int displayId, long startTime, long duration,
boolean forced) {
- if (mDisplayId != displayId || mKeyguardMonitor.isKeyguardGoingAway() && !forced) {
+ if (mDisplayId != displayId || mKeyguardStateController.isKeyguardGoingAway() && !forced) {
return;
}
if (mTransitionPending && mTintChangePending) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 6781073..4927ec8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -53,7 +53,7 @@
import com.android.systemui.statusbar.phone.ScrimController.ScrimVisibility;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
@@ -68,9 +68,8 @@
*/
public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener,
StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
- UnlockMethodCache.OnUnlockMethodChangedListener,
- NotificationWakeUpCoordinator.WakeUpListener, ViewTreeObserver.OnPreDrawListener,
- OnHeadsUpChangedListener {
+ KeyguardStateController.Callback, NotificationWakeUpCoordinator.WakeUpListener,
+ ViewTreeObserver.OnPreDrawListener, OnHeadsUpChangedListener {
private static final int STATE_LOCKED = 0;
private static final int STATE_LOCK_OPEN = 1;
@@ -78,11 +77,10 @@
private static final int STATE_BIOMETRICS_ERROR = 3;
private final ConfigurationController mConfigurationController;
private final StatusBarStateController mStatusBarStateController;
- private final UnlockMethodCache mUnlockMethodCache;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final AccessibilityController mAccessibilityController;
private final DockManager mDockManager;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardBypassController mBypassController;
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
private final HeadsUpManagerPhone mHeadsUpManager;
@@ -107,13 +105,13 @@
private boolean mUpdatePending;
private boolean mBouncerPreHideAnimation;
- private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
- new KeyguardMonitor.Callback() {
+ private final KeyguardStateController.Callback mKeyguardMonitorCallback =
+ new KeyguardStateController.Callback() {
@Override
public void onKeyguardShowingChanged() {
boolean force = false;
boolean wasShowing = mKeyguardShowing;
- mKeyguardShowing = mKeyguardMonitor.isShowing();
+ mKeyguardShowing = mKeyguardStateController.isShowing();
if (!wasShowing && mKeyguardShowing && mBlockUpdates) {
mBlockUpdates = false;
force = true;
@@ -126,7 +124,7 @@
@Override
public void onKeyguardFadingAwayChanged() {
- if (!mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (!mKeyguardStateController.isKeyguardFadingAway()) {
mBouncerPreHideAnimation = false;
if (mBlockUpdates) {
mBlockUpdates = false;
@@ -134,6 +132,11 @@
}
}
}
+
+ @Override
+ public void onUnlockedChanged() {
+ update();
+ }
};
private final DockManager.DockEventListener mDockEventListener =
new DockManager.DockEventListener() {
@@ -181,19 +184,18 @@
AccessibilityController accessibilityController,
KeyguardBypassController bypassController,
NotificationWakeUpCoordinator wakeUpCoordinator,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
@Nullable DockManager dockManager,
HeadsUpManagerPhone headsUpManager) {
super(context, attrs);
mContext = context;
- mUnlockMethodCache = UnlockMethodCache.getInstance(context);
mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mAccessibilityController = accessibilityController;
mConfigurationController = configurationController;
mStatusBarStateController = statusBarStateController;
mBypassController = bypassController;
mWakeUpCoordinator = wakeUpCoordinator;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mDockManager = dockManager;
mHeadsUpManager = headsUpManager;
}
@@ -203,9 +205,8 @@
super.onAttachedToWindow();
mStatusBarStateController.addCallback(this);
mConfigurationController.addCallback(this);
- mKeyguardMonitor.addCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.addCallback(mKeyguardMonitorCallback);
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
- mUnlockMethodCache.addListener(this);
mWakeUpCoordinator.addListener(this);
mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
if (mDockManager != null) {
@@ -221,9 +222,8 @@
mStatusBarStateController.removeCallback(this);
mConfigurationController.removeCallback(this);
mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
- mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.removeCallback(mKeyguardMonitorCallback);
mWakeUpCoordinator.removeListener(this);
- mUnlockMethodCache.removeListener(this);
if (mDockManager != null) {
mDockManager.removeListener(mDockEventListener);
}
@@ -370,15 +370,15 @@
}
private boolean canBlockUpdates() {
- return mKeyguardShowing || mKeyguardMonitor.isKeyguardFadingAway();
+ return mKeyguardShowing || mKeyguardStateController.isKeyguardFadingAway();
}
private void updateClickability() {
if (mAccessibilityController == null) {
return;
}
- boolean canLock = mUnlockMethodCache.isMethodSecure()
- && mUnlockMethodCache.canSkipBouncer();
+ boolean canLock = mKeyguardStateController.isMethodSecure()
+ && mKeyguardStateController.canDismissLockScreen();
boolean clickToUnlock = mAccessibilityController.isAccessibilityEnabled();
setClickable(clickToUnlock);
setLongClickable(canLock && !clickToUnlock);
@@ -523,8 +523,8 @@
private int getState() {
KeyguardUpdateMonitor updateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing || mBouncerPreHideAnimation
- || mKeyguardMonitor.isKeyguardGoingAway()) && !mSimLocked) {
+ if ((mKeyguardStateController.canDismissLockScreen() || !mKeyguardShowing
+ || mKeyguardStateController.isKeyguardGoingAway()) && !mSimLocked) {
return STATE_LOCK_OPEN;
} else if (mTransientBiometricsError) {
return STATE_BIOMETRICS_ERROR;
@@ -582,11 +582,6 @@
update(true /* force */);
}
- @Override
- public void onUnlockMethodStateChanged() {
- update();
- }
-
/**
* We need to hide the lock whenever there's a fingerprint unlock, otherwise you'll see the
* icon on top of the black front scrim.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 2b8c86b..b87140d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -86,8 +86,8 @@
import com.android.internal.util.LatencyTracker;
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.ScreenDecorations;
import com.android.systemui.SysUiServiceProvider;
+import com.android.systemui.assist.AssistHandleViewController;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
@@ -174,7 +174,10 @@
public int mDisplayId;
private boolean mIsOnDefaultDisplay;
public boolean mHomeBlockedThisTouch;
- private ScreenDecorations mScreenDecorations;
+
+ /** Only for default display */
+ @Nullable
+ private AssistHandleViewController mAssistHandlerViewController;
private Handler mHandler = Dependency.get(Dependency.MAIN_HANDLER);
@@ -357,17 +360,22 @@
mDisabledFlags2 |= StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS;
}
setDisabled2Flags(mDisabledFlags2);
-
- mScreenDecorations = SysUiServiceProvider.getComponent(getContext(),
- ScreenDecorations.class);
- getBarTransitions().addDarkIntensityListener(mScreenDecorations);
+ if (mIsOnDefaultDisplay) {
+ mAssistHandlerViewController =
+ new AssistHandleViewController(mHandler, mNavigationBarView);
+ getBarTransitions().addDarkIntensityListener(mAssistHandlerViewController);
+ }
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (mNavigationBarView != null) {
- mNavigationBarView.getBarTransitions().removeDarkIntensityListener(mScreenDecorations);
+ if (mIsOnDefaultDisplay) {
+ mNavigationBarView.getBarTransitions()
+ .removeDarkIntensityListener(mAssistHandlerViewController);
+ mAssistHandlerViewController = null;
+ }
mNavigationBarView.getBarTransitions().destroy();
mNavigationBarView.getLightTransitionsController().destroy(getContext());
}
@@ -1019,6 +1027,11 @@
delay + StackStateAnimator.ANIMATION_DURATION_GO_TO_FULL_SHADE);
}
+ @Nullable
+ public AssistHandleViewController getAssistHandlerViewController() {
+ return mAssistHandlerViewController;
+ }
+
/**
* Performs transitions on navigation bar.
*
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ea113df..86da10a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -102,7 +102,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -205,11 +205,11 @@
mDelayShowingKeyguardStatusBar = false;
}
};
- private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
- new KeyguardMonitor.Callback() {
+ private final KeyguardStateController.Callback mKeyguardMonitorCallback =
+ new KeyguardStateController.Callback() {
@Override
public void onKeyguardFadingAwayChanged() {
- if (!mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (!mKeyguardStateController.isKeyguardFadingAway()) {
mFirstBypassAttempt = false;
mDelayShowingKeyguardStatusBar = false;
}
@@ -482,7 +482,7 @@
mKeyguardBypassController = bypassController;
mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled();
- mKeyguardMonitor.addCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.addCallback(mKeyguardMonitorCallback);
dynamicPrivacyController.addListener(this);
mBottomAreaShadeAlphaAnimator = ValueAnimator.ofFloat(1f, 0);
@@ -1683,7 +1683,7 @@
@Override
public void onStateChanged(int statusBarState) {
boolean goingToFullShade = mStatusBarStateController.goingToFullShade();
- boolean keyguardFadingAway = mKeyguardMonitor.isKeyguardFadingAway();
+ boolean keyguardFadingAway = mKeyguardStateController.isKeyguardFadingAway();
int oldState = mBarState;
boolean keyguardShowing = statusBarState == StatusBarState.KEYGUARD;
setKeyguardStatusViewVisibility(statusBarState, keyguardFadingAway, goingToFullShade);
@@ -1701,7 +1701,7 @@
&& (goingToFullShade || statusBarState == StatusBarState.SHADE_LOCKED)) {
animateKeyguardStatusBarOut();
long delay = mBarState == StatusBarState.SHADE_LOCKED
- ? 0 : mKeyguardMonitor.calculateGoingToFullShadeDelay();
+ ? 0 : mKeyguardStateController.calculateGoingToFullShadeDelay();
mQs.animateHeaderSlidingIn(delay);
} else if (oldState == StatusBarState.SHADE_LOCKED
&& statusBarState == StatusBarState.KEYGUARD) {
@@ -1778,13 +1778,13 @@
private void animateKeyguardStatusBarOut() {
ValueAnimator anim = ValueAnimator.ofFloat(mKeyguardStatusBar.getAlpha(), 0f);
anim.addUpdateListener(mStatusBarAnimateAlphaListener);
- anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway()
- ? mKeyguardMonitor.getKeyguardFadingAwayDelay()
+ anim.setStartDelay(mKeyguardStateController.isKeyguardFadingAway()
+ ? mKeyguardStateController.getKeyguardFadingAwayDelay()
: 0);
long duration;
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
- duration = mKeyguardMonitor.getShortenedFadingAwayDuration();
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
+ duration = mKeyguardStateController.getShortenedFadingAwayDuration();
} else {
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
}
@@ -1831,8 +1831,8 @@
if (goingToFullShade) {
mKeyguardBottomArea.animate()
.alpha(0f)
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
+ .setDuration(mKeyguardStateController.getShortenedFadingAwayDuration())
.setInterpolator(Interpolators.ALPHA_OUT)
.withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable)
.start();
@@ -1860,8 +1860,8 @@
.withEndAction(mAnimateKeyguardStatusViewGoneEndRunnable);
if (keyguardFadingAway) {
mKeyguardStatusView.animate()
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
+ .setDuration(mKeyguardStateController.getShortenedFadingAwayDuration())
.start();
}
} else if (mBarState == StatusBarState.SHADE_LOCKED
@@ -2556,7 +2556,7 @@
@Override
protected void onTrackingStarted() {
- mFalsingManager.onTrackingStarted(mStatusBar.isKeyguardCurrentlySecure());
+ mFalsingManager.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen());
super.onTrackingStarted();
if (mQsFullyExpanded) {
mQsExpandImmediate = true;
@@ -2846,7 +2846,7 @@
@Override
protected boolean shouldUseDismissingAnimation() {
return mBarState != StatusBarState.SHADE
- && (!mStatusBar.isKeyguardCurrentlySecure() || !isTracking());
+ && (mKeyguardStateController.canDismissLockScreen() || !isTracking());
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 31600e3..ffaf3d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -49,7 +49,7 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -143,7 +143,8 @@
private boolean mGestureWaitForTouchSlop;
private boolean mIgnoreXTouchSlop;
private boolean mExpandLatencyTracking;
- protected final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ protected final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
protected final SysuiStatusBarStateController mStatusBarStateController =
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
@@ -495,7 +496,8 @@
mUpdateFlingVelocity = vel;
}
} else if (mPanelClosedOnDown && !mHeadsUpManager.hasPinnedHeadsUp() && !mTracking
- && !mStatusBar.isBouncerShowing() && !mKeyguardMonitor.isKeyguardFadingAway()) {
+ && !mStatusBar.isBouncerShowing()
+ && !mKeyguardStateController.isKeyguardFadingAway()) {
long timePassed = SystemClock.uptimeMillis() - mDownTime;
if (timePassed < ViewConfiguration.getLongPressTimeout()) {
// Lets show the user that he can actually expand the panel
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index ee43879..294111c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -57,7 +57,7 @@
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NextAlarmController;
import com.android.systemui.statusbar.policy.RotationLockController;
@@ -82,7 +82,7 @@
Listener,
ZenModeController.Callback,
DeviceProvisionedListener,
- KeyguardMonitor.Callback,
+ KeyguardStateController.Callback,
PrivacyItemController.Callback,
LocationController.LocationChangeCallback {
private static final String TAG = "PhoneStatusBarPolicy";
@@ -119,7 +119,7 @@
private final DataSaverController mDataSaver;
private final ZenModeController mZenController;
private final DeviceProvisionedController mProvisionedController;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final LocationController mLocationController;
private final PrivacyItemController mPrivacyItemController;
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
@@ -152,7 +152,7 @@
mDataSaver = Dependency.get(DataSaverController.class);
mZenController = Dependency.get(ZenModeController.class);
mProvisionedController = Dependency.get(DeviceProvisionedController.class);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mLocationController = Dependency.get(LocationController.class);
mPrivacyItemController = Dependency.get(PrivacyItemController.class);
mSensorPrivacyController = Dependency.get(SensorPrivacyController.class);
@@ -256,7 +256,7 @@
mHotspot.addCallback(mHotspotCallback);
mNextAlarmController.addCallback(mNextAlarmCallback);
mDataSaver.addCallback(this);
- mKeyguardMonitor.addCallback(this);
+ mKeyguardStateController.addCallback(this);
mPrivacyItemController.addCallback(this);
mSensorPrivacyController.addCallback(mSensorPrivacyListener);
mLocationController.addCallback(this);
@@ -472,8 +472,8 @@
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
mHandler.post(() -> {
final boolean showIcon;
- if (isManagedProfile &&
- (!mKeyguardMonitor.isShowing() || mKeyguardMonitor.isOccluded())) {
+ if (isManagedProfile && (!mKeyguardStateController.isShowing()
+ || mKeyguardStateController.isOccluded())) {
showIcon = true;
mIconController.setIcon(mSlotManagedProfile,
R.drawable.stat_sys_managed_profile_status,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 8c92779..bd9ce3a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -47,7 +47,7 @@
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.stack.ViewState;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.AlarmTimeout;
import com.android.systemui.util.wakelock.DelayedWakeLock;
import com.android.systemui.util.wakelock.WakeLock;
@@ -129,7 +129,7 @@
protected final ScrimView mScrimBehind;
protected final ScrimView mScrimForBubble;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final DozeParameters mDozeParameters;
private final AlarmTimeout mTimeTicker;
@@ -187,7 +187,7 @@
public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
mScrimBehind = scrimBehind;
mScrimInFront = scrimInFront;
mScrimForBubble = scrimForBubble;
@@ -196,8 +196,8 @@
mScrimVisibleListener = scrimVisibleListener;
mContext = scrimBehind.getContext();
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
- mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
+ mKeyguardStateController = keyguardStateController;
+ mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mKeyguardVisibilityCallback = new KeyguardVisibilityCallback();
mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
@@ -210,11 +210,11 @@
// to make sure that text on top of it is legible.
mScrimBehindAlpha = mScrimBehindAlphaResValue;
mDozeParameters = dozeParameters;
- keyguardMonitor.addCallback(new KeyguardMonitor.Callback() {
+ keyguardStateController.addCallback(new KeyguardStateController.Callback() {
@Override
public void onKeyguardFadingAwayChanged() {
- setKeyguardFadingAway(keyguardMonitor.isKeyguardFadingAway(),
- keyguardMonitor.getKeyguardFadingAwayDuration());
+ setKeyguardFadingAway(keyguardStateController.isKeyguardFadingAway(),
+ keyguardStateController.getKeyguardFadingAwayDuration());
}
});
@@ -367,7 +367,7 @@
public void onTrackingStarted() {
mTracking = true;
- mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
+ mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
}
public void onExpandingFinished() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 7bc849d..f06fbbd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -212,7 +212,6 @@
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
-import com.android.systemui.statusbar.phone.UnlockMethodCache.OnUnlockMethodChangedListener;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
@@ -222,7 +221,8 @@
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateControllerImpl;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
@@ -246,7 +246,7 @@
import dagger.Subcomponent;
public class StatusBar extends SystemUI implements DemoMode,
- ActivityStarter, OnUnlockMethodChangedListener,
+ ActivityStarter, KeyguardStateController.Callback,
OnHeadsUpChangedListener, CommandQueue.Callbacks, ZenModeController.Callback,
ColorExtractor.OnColorsChangedListener, ConfigurationListener,
StatusBarStateController.StateListener, ShadeController,
@@ -358,7 +358,6 @@
protected PhoneStatusBarView mStatusBarView;
private int mStatusBarWindowState = WINDOW_STATE_SHOWING;
protected StatusBarWindowController mStatusBarWindowController;
- protected UnlockMethodCache mUnlockMethodCache;
@VisibleForTesting
KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@VisibleForTesting
@@ -378,6 +377,8 @@
@Inject
KeyguardBypassController mKeyguardBypassController;
@Inject
+ KeyguardStateController mKeyguardStateController;
+ @Inject
protected HeadsUpManagerPhone mHeadsUpManager;
@Inject
DynamicPrivacyController mDynamicPrivacyController;
@@ -545,7 +546,7 @@
+ "mStatusBarKeyguardViewManager was null");
return;
}
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
}
}
@@ -559,7 +560,6 @@
private KeyguardUserSwitcher mKeyguardUserSwitcher;
protected UserSwitcherController mUserSwitcherController;
private NetworkController mNetworkController;
- private KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
private BatteryController mBatteryController;
protected boolean mPanelExpanded;
private UiModeManager mUiModeManager;
@@ -786,8 +786,7 @@
mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController);
mSignalPolicy = new StatusBarSignalPolicy(mContext, mIconController);
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
startKeyguard();
mKeyguardUpdateMonitor.registerCallback(mUpdateCallback);
@@ -959,7 +958,7 @@
}
}, DozeParameters.getInstance(mContext),
mContext.getSystemService(AlarmManager.class),
- mKeyguardMonitor);
+ mKeyguardStateController);
mNotificationPanel.initDependencies(this, mGroupManager, mNotificationShelf,
mHeadsUpManager, mNotificationIconAreaController, mScrimController);
mDozeScrimController = new DozeScrimController(DozeParameters.getInstance(context));
@@ -1116,7 +1115,7 @@
mHeadsUpManager, activityStarter, mActivityLaunchAnimator,
mBarService, mStatusBarStateController, mKeyguardManager, mDreamManager,
mRemoteInputManager, mStatusBarRemoteInputCallback, mGroupManager,
- mLockscreenUserManager, mShadeController, mKeyguardMonitor,
+ mLockscreenUserManager, mShadeController, mKeyguardStateController,
mNotificationInterruptionStateProvider, mMetricsLogger,
new LockPatternUtils(mContext), Dependency.get(MAIN_HANDLER),
Dependency.get(BG_HANDLER), mActivityIntentHelper, mBubbleController);
@@ -1257,8 +1256,8 @@
KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class);
mBiometricUnlockController = new BiometricUnlockController(mContext,
mDozeScrimController, keyguardViewMediator,
- mScrimController, this, UnlockMethodCache.getInstance(mContext),
- new Handler(), mKeyguardUpdateMonitor, mKeyguardBypassController);
+ mScrimController, this, mKeyguardStateController, new Handler(),
+ mKeyguardUpdateMonitor, mKeyguardBypassController);
putComponent(BiometricUnlockController.class, mBiometricUnlockController);
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
getBouncerContainer(), mNotificationPanel, mBiometricUnlockController,
@@ -1374,7 +1373,7 @@
* Asks {@link KeyguardUpdateMonitor} to run face auth.
*/
public void requestFaceAuth() {
- if (!mUnlockMethodCache.canSkipBouncer()) {
+ if (!mKeyguardStateController.canDismissLockScreen()) {
mKeyguardUpdateMonitor.requestFaceAuth();
}
}
@@ -1558,9 +1557,8 @@
logStateToEventlog();
}
- @Override // UnlockMethodCache.OnUnlockMethodChangedListener
- public void onUnlockMethodStateChanged() {
- // Unlock method state changed. Notify KeguardMonitor
+ @Override
+ public void onUnlockedChanged() {
updateKeyguardState();
logStateToEventlog();
}
@@ -1623,10 +1621,6 @@
}
}
- public boolean isKeyguardCurrentlySecure() {
- return !mUnlockMethodCache.canSkipBouncer();
- }
-
public void setPanelExpanded(boolean isExpanded) {
mPanelExpanded = isExpanded;
updateHideIconsForBouncer(false /* animate */);
@@ -1818,8 +1812,8 @@
@Override
public void handleSystemKey(int key) {
if (SPEW) Log.d(TAG, "handleNavigationKey: " + key);
- if (!mCommandQueue.panelsEnabled() || !mKeyguardMonitor.isDeviceInteractive()
- || mKeyguardMonitor.isShowing() && !mKeyguardMonitor.isOccluded()) {
+ if (!mCommandQueue.panelsEnabled() || !mKeyguardUpdateMonitor.isDeviceInteractive()
+ || mKeyguardStateController.isShowing() && !mKeyguardStateController.isOccluded()) {
return;
}
@@ -2428,10 +2422,6 @@
mLightBarController.dump(fd, pw, args);
}
- if (mUnlockMethodCache != null) {
- mUnlockMethodCache.dump(pw);
- }
-
if (mKeyguardBypassController != null) {
mKeyguardBypassController.dump(pw);
}
@@ -2684,7 +2674,7 @@
public void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
boolean afterKeyguardGone) {
if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP
- && mUnlockMethodCache.canSkipBouncer()
+ && mKeyguardStateController.canDismissLockScreen()
&& !mStatusBarStateController.leaveOpenOnKeyguardHide()
&& isPulsing()) {
// Reuse the biometric wake-and-unlock transition if we dismiss keyguard from a pulse.
@@ -2827,14 +2817,14 @@
boolean isShowing = mStatusBarKeyguardViewManager.isShowing();
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded();
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
- boolean isSecure = mUnlockMethodCache.isMethodSecure();
- boolean canSkipBouncer = mUnlockMethodCache.canSkipBouncer();
+ boolean isSecure = mKeyguardStateController.isMethodSecure();
+ boolean unlocked = mKeyguardStateController.canDismissLockScreen();
int stateFingerprint = getLoggingFingerprint(mState,
isShowing,
isOccluded,
isBouncerShowing,
isSecure,
- canSkipBouncer);
+ unlocked);
if (stateFingerprint != mLastLoggedStateFingerprint) {
if (mStatusBarStateLog == null) {
mStatusBarStateLog = new LogMaker(MetricsEvent.VIEW_UNKNOWN);
@@ -2848,7 +2838,7 @@
isOccluded ? 1 : 0,
isBouncerShowing ? 1 : 0,
isSecure ? 1 : 0,
- canSkipBouncer ? 1 : 0);
+ unlocked ? 1 : 0);
mLastLoggedStateFingerprint = stateFingerprint;
}
}
@@ -3048,7 +3038,7 @@
public void showKeyguardImpl() {
mIsKeyguard = true;
- if (mKeyguardMonitor.isLaunchTransitionFadingAway()) {
+ if (mKeyguardStateController.isLaunchTransitionFadingAway()) {
mNotificationPanel.animate().cancel();
onLaunchTransitionFadingEnded();
}
@@ -3080,7 +3070,7 @@
mNotificationPanel.onAffordanceLaunchEnded();
releaseGestureWakeLock();
runLaunchTransitionEndRunnable();
- mKeyguardMonitor.setLaunchTransitionFadingAway(false);
+ mKeyguardStateController.setLaunchTransitionFadingAway(false);
mPresenter.updateMediaMetaData(true /* metaDataChanged */, true);
}
@@ -3105,7 +3095,7 @@
mHandler.removeMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
mLaunchTransitionEndRunnable = endRunnable;
Runnable hideRunnable = () -> {
- mKeyguardMonitor.setLaunchTransitionFadingAway(true);
+ mKeyguardStateController.setLaunchTransitionFadingAway(true);
if (beforeFading != null) {
beforeFading.run();
}
@@ -3198,7 +3188,7 @@
if (!mStatusBarStateController.isKeyguardRequested()) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(false);
}
- long delay = mKeyguardMonitor.calculateGoingToFullShadeDelay();
+ long delay = mKeyguardStateController.calculateGoingToFullShadeDelay();
mNotificationPanel.animateToFullShade(delay);
if (mDraggedDownEntry != null) {
mDraggedDownEntry.setUserLocked(false);
@@ -3240,7 +3230,7 @@
public void keyguardGoingAway() {
// Treat Keyguard exit animation as an app transition to achieve nice transition for status
// bar.
- mKeyguardMonitor.notifyKeyguardGoingAway(true);
+ mKeyguardStateController.notifyKeyguardGoingAway(true);
mCommandQueue.appTransitionPending(mDisplayId, true /* forced */);
}
@@ -3260,14 +3250,14 @@
mCommandQueue.appTransitionStarting(mDisplayId,
startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
- mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
+ mKeyguardStateController.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
}
/**
* Notifies that the Keyguard fading away animation is done.
*/
public void finishKeyguardFadingAway() {
- mKeyguardMonitor.notifyKeyguardDoneFading();
+ mKeyguardStateController.notifyKeyguardDoneFading();
mScrimController.setExpansionAffectsAlpha(true);
}
@@ -3513,8 +3503,8 @@
}
private void updateKeyguardState() {
- mKeyguardMonitor.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
- mUnlockMethodCache.isMethodSecure(),
+ mKeyguardStateController.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
+ mKeyguardStateController.isMethodSecure(),
mStatusBarKeyguardViewManager.isOccluded());
}
@@ -3562,7 +3552,7 @@
public void onTrackingStopped(boolean expand) {
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
- if (!expand && !mUnlockMethodCache.canSkipBouncer()) {
+ if (!expand && !mKeyguardStateController.canDismissLockScreen()) {
showBouncer(false /* scrimmed */);
}
}
@@ -3786,7 +3776,7 @@
@Override
public void showScreenPinningRequest(int taskId) {
- if (mKeyguardMonitor.isShowing()) {
+ if (mKeyguardStateController.isShowing()) {
// Don't allow apps to trigger this from keyguard.
return;
}
@@ -3909,7 +3899,7 @@
// We don't want to end up in KEYGUARD state when we're unlocking with
// fingerprint from doze. We should cross fade directly from black.
boolean unlocking = mBiometricUnlockController.isWakeAndUnlock()
- || mKeyguardMonitor.isKeyguardFadingAway();
+ || mKeyguardStateController.isKeyguardFadingAway();
// Do not animate the scrim expansion when triggered by the fingerprint sensor.
mScrimController.setExpansionAffectsAlpha(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index bb8ba05..df23f8ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -56,8 +56,7 @@
import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitorImpl;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -165,8 +164,8 @@
// Dismiss action to be launched when we stop dozing or the keyguard is gone.
private DismissWithActionRequest mPendingWakeupAction;
- private final KeyguardMonitorImpl mKeyguardMonitor =
- (KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final NotificationMediaManager mMediaManager =
Dependency.get(NotificationMediaManager.class);
private final SysuiStatusBarStateController mStatusBarStateController =
@@ -221,7 +220,7 @@
mBiometricUnlockController = biometricUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
- mExpansionCallback, falsingManager, bypassController);
+ mExpansionCallback, mKeyguardStateController, falsingManager, bypassController);
mNotificationPanelView = notificationPanelView;
notificationPanelView.addExpansionListener(this);
mBypassController = bypassController;
@@ -245,7 +244,7 @@
mBouncer.setExpansion(expansion);
}
if (expansion != KeyguardBouncer.EXPANSION_HIDDEN && tracking
- && mStatusBar.isKeyguardCurrentlySecure()
+ && !mKeyguardStateController.canDismissLockScreen()
&& !mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
}
@@ -269,7 +268,7 @@
boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD
&& !mNotificationPanelView.isQsExpanded();
boolean lockVisible = (mBouncer.isShowing() || keyguardWithoutQs)
- && !mBouncer.isAnimatingAway() && !mKeyguardMonitor.isKeyguardFadingAway();
+ && !mBouncer.isAnimatingAway() && !mKeyguardStateController.isKeyguardFadingAway();
if (mLastLockVisible != lockVisible) {
mLastLockVisible = lockVisible;
@@ -299,8 +298,9 @@
public void show(Bundle options) {
mShowing = true;
mStatusBarWindowController.setKeyguardShowing(true);
- mKeyguardMonitor.notifyKeyguardState(
- mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded());
+ mKeyguardStateController.notifyKeyguardState(
+ mShowing, mKeyguardStateController.isMethodSecure(),
+ mKeyguardStateController.isOccluded());
reset(true /* hideBouncerWhenShowing */);
StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
@@ -530,8 +530,8 @@
*/
public void hide(long startTime, long fadeoutDuration) {
mShowing = false;
- mKeyguardMonitor.notifyKeyguardState(
- mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded());
+ mKeyguardStateController.notifyKeyguardState(mShowing,
+ mKeyguardStateController.isMethodSecure(), mKeyguardStateController.isOccluded());
launchPendingWakeupAction();
if (Dependency.get(KeyguardUpdateMonitor.class).needsSlowUnlockTransition()) {
@@ -739,8 +739,8 @@
}
private long getNavBarShowDelay() {
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
- return mKeyguardMonitor.getKeyguardFadingAwayDelay();
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
+ return mKeyguardStateController.getKeyguardFadingAwayDelay();
} else if (mBouncer.isShowing()) {
return NAV_BAR_SHOW_DELAY_BOUNCER;
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 320243b..dfec195 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -68,7 +68,7 @@
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.policy.HeadsUpUtil;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
/**
* Status bar implementation of {@link NotificationActivityStarter}.
@@ -84,7 +84,7 @@
private final NotificationRemoteInputManager mRemoteInputManager;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final ShadeController mShadeController;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final ActivityStarter mActivityStarter;
private final NotificationEntryManager mEntryManager;
private final StatusBarStateController mStatusBarStateController;
@@ -125,7 +125,7 @@
NotificationGroupManager groupManager,
NotificationLockscreenUserManager lockscreenUserManager,
ShadeController shadeController,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
MetricsLogger metricsLogger,
LockPatternUtils lockPatternUtils,
@@ -145,7 +145,7 @@
mRemoteInputManager = remoteInputManager;
mLockscreenUserManager = lockscreenUserManager;
mShadeController = shadeController;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mActivityStarter = activityStarter;
mEntryManager = entryManager;
mStatusBarStateController = statusBarStateController;
@@ -204,7 +204,7 @@
&& mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
final boolean wasOccluded = mShadeController.isOccluded();
- boolean showOverLockscreen = mKeyguardMonitor.isShowing() && intent != null
+ boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
&& mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
ActivityStarter.OnDismissAction postKeyguardAction =
@@ -258,7 +258,7 @@
if (showOverLockscreen) {
mShadeController.addPostCollapseAction(runnable);
mShadeController.collapsePanel(true /* animate */);
- } else if (mKeyguardMonitor.isShowing()
+ } else if (mKeyguardStateController.isShowing()
&& mShadeController.isOccluded()) {
mShadeController.addAfterKeyguardGoneRunnable(runnable);
mShadeController.collapsePanel();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 4732049..3e0c268 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -74,7 +74,7 @@
import com.android.systemui.statusbar.notification.row.NotificationInfo.CheckSaveListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.util.ArrayList;
@@ -89,7 +89,8 @@
private final ShadeController mShadeController = Dependency.get(ShadeController.class);
private final ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final NotificationViewHierarchyManager mViewHierarchyManager =
Dependency.get(NotificationViewHierarchyManager.class);
private final NotificationLockscreenUserManager mLockscreenUserManager =
@@ -123,7 +124,6 @@
private final DynamicPrivacyController mDynamicPrivacyController;
private boolean mReinflateNotificationsOnUserSwitched;
private boolean mDispatchUiModeChangeOnUserSwitched;
- private final UnlockMethodCache mUnlockMethodCache;
private TextView mNotificationPanelDebugText;
protected boolean mVrMode;
@@ -152,7 +152,6 @@
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
mDozeScrimController = dozeScrimController;
mScrimController = scrimController;
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
mKeyguardManager = context.getSystemService(KeyguardManager.class);
mMaxAllowedKeyguardNotifications = context.getResources().getInteger(
R.integer.keyguard_max_notification_count);
@@ -366,7 +365,7 @@
return false;
} else {
// we only allow head-up on the lockscreen if it doesn't have a fullscreen intent
- return !mKeyguardMonitor.isShowing()
+ return !mKeyguardStateController.isShowing()
|| mShadeController.isOccluded();
}
}
@@ -398,7 +397,7 @@
public void onBindRow(NotificationEntry entry, PackageManager pmUser,
StatusBarNotification sbn, ExpandableNotificationRow row) {
row.setAboveShelfChangedListener(mAboveShelfObserver);
- row.setSecureStateProvider(mUnlockMethodCache::canSkipBouncer);
+ row.setSecureStateProvider(mKeyguardStateController::canDismissLockScreen);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
index 13d4b8e..9a281ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
@@ -47,8 +47,7 @@
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.RemoteInputView;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -59,7 +58,8 @@
public class StatusBarRemoteInputCallback implements Callback, Callbacks,
StatusBarStateController.StateListener {
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final SysuiStatusBarStateController mStatusBarStateController =
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
private final NotificationLockscreenUserManager mLockscreenUserManager =
@@ -165,7 +165,7 @@
@Override
public void onMakeExpandedVisibleForRemoteInput(ExpandableNotificationRow row,
View clickedView) {
- if (mKeyguardMonitor.isShowing()) {
+ if (mKeyguardStateController.isShowing()) {
onLockedRemoteInput(row, clickedView);
} else {
if (row.isChildInGroup() && !row.areChildrenExpanded()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
index e61a67c..5bda34d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
@@ -28,7 +28,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
/**
@@ -100,7 +100,7 @@
}
public static void setWindowOnTop(Dialog dialog) {
- if (Dependency.get(KeyguardMonitor.class).isShowing()) {
+ if (Dependency.get(KeyguardStateController.class).isShowing()) {
dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_PANEL);
} else {
dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
deleted file mode 100644
index c76f93e..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.statusbar.phone;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.hardware.biometrics.BiometricSourceType;
-import android.os.Build;
-import android.os.Trace;
-
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.DejankUtils;
-import com.android.systemui.Dependency;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-/**
- * Caches whether the current unlock method is insecure, taking trust into account. This information
- * might be a little bit out of date and should not be used for actual security decisions; it should
- * be only used for visual indications.
- */
-public class UnlockMethodCache {
-
- private static UnlockMethodCache sInstance;
- private static final boolean DEBUG_AUTH_WITH_ADB = false;
- private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
-
- private final LockPatternUtils mLockPatternUtils;
- private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
- private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>();
- /** Whether the user configured a secure unlock method (PIN, password, etc.) */
- private boolean mSecure;
- /** Whether the unlock method is currently insecure (insecure method or trusted environment) */
- private boolean mCanSkipBouncer;
- private boolean mTrustManaged;
- private boolean mTrusted;
- private boolean mDebugUnlocked = false;
- private boolean mFaceAuthEnabled;
-
- private UnlockMethodCache(Context ctx) {
- mLockPatternUtils = new LockPatternUtils(ctx);
- mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- Dependency.get(KeyguardUpdateMonitor.class).registerCallback(mCallback);
- update(true /* updateAlways */);
- if (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB) {
- // Watch for interesting updates
- final IntentFilter filter = new IntentFilter();
- filter.addAction(AUTH_BROADCAST_KEY);
- ctx.registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (DEBUG_AUTH_WITH_ADB && AUTH_BROADCAST_KEY.equals(intent.getAction())) {
- mDebugUnlocked = !mDebugUnlocked;
- update(true /* updateAlways */);
- }
- }
- }, filter, null, null);
- }
- }
-
- public static UnlockMethodCache getInstance(Context context) {
- if (sInstance == null) {
- sInstance = new UnlockMethodCache(context);
- }
- return sInstance;
- }
-
- /**
- * @return whether the user configured a secure unlock method like PIN, password, etc.
- */
- public boolean isMethodSecure() {
- return mSecure;
- }
-
- public boolean isTrusted() {
- return mTrusted;
- }
-
- /**
- * @return whether the lockscreen is currently insecure, and the bouncer won't be shown
- */
- public boolean canSkipBouncer() {
- return mCanSkipBouncer;
- }
-
- public void addListener(OnUnlockMethodChangedListener listener) {
- mListeners.add(listener);
- }
-
- public void removeListener(OnUnlockMethodChangedListener listener) {
- mListeners.remove(listener);
- }
-
- /**
- * If there are faces enrolled and user enabled face auth on keyguard.
- */
- public boolean isFaceAuthEnabled() {
- return mFaceAuthEnabled;
- }
-
- private void update(boolean updateAlways) {
- Trace.beginSection("UnlockMethodCache#update");
- int user = KeyguardUpdateMonitor.getCurrentUser();
- boolean secure = mLockPatternUtils.isSecure(user);
- boolean canSkipBouncer = !secure || mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)
- || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
- boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
- boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
- boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user);
- boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer
- || trustManaged != mTrustManaged
- || mFaceAuthEnabled != faceAuthEnabled;
- if (changed || updateAlways) {
- mSecure = secure;
- mCanSkipBouncer = canSkipBouncer;
- mTrusted = trusted;
- mTrustManaged = trustManaged;
- mFaceAuthEnabled = faceAuthEnabled;
- Trace.endSection();
- notifyListeners();
- } else {
- Trace.endSection();
- }
- }
-
- private void notifyListeners() {
- String tag = "UnlockMethodCache#notifyListeners";
- DejankUtils.startDetectingBlockingIpcs(tag);
- for (OnUnlockMethodChangedListener listener : mListeners) {
- listener.onUnlockMethodStateChanged();
- }
- DejankUtils.stopDetectingBlockingIpcs(tag);
- }
-
- public void dump(PrintWriter pw) {
- pw.println("UnlockMethodCache");
- pw.println(" mSecure: " + mSecure);
- pw.println(" mCanSkipBouncer: " + mCanSkipBouncer);
- pw.println(" mTrustManaged: " + mTrustManaged);
- pw.println(" mTrusted: " + mTrusted);
- pw.println(" mDebugUnlocked: " + mDebugUnlocked);
- pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled);
- }
-
- private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
- @Override
- public void onUserSwitchComplete(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onTrustChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onTrustManagedChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onStartedWakingUp() {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
- Trace.beginSection("KeyguardUpdateMonitorCallback#onBiometricAuthenticated");
- if (!mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()) {
- Trace.endSection();
- return;
- }
- update(false /* updateAlways */);
- Trace.endSection();
- }
-
- @Override
- public void onFaceUnlockStateChanged(boolean running, int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onStrongAuthStateChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onScreenTurnedOff() {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onBiometricsCleared() {
- update(false /* alwaysUpdate */);
- }
- };
-
- public boolean isTrustManaged() {
- return mTrustManaged;
- }
-
- public static interface OnUnlockMethodChangedListener {
- void onUnlockMethodStateChanged();
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
deleted file mode 100644
index 6dc90b9..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.statusbar.policy;
-
-import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
-
-public interface KeyguardMonitor extends CallbackController<Callback> {
-
- boolean isSecure();
- boolean isShowing();
- boolean isOccluded();
- boolean isKeyguardFadingAway();
- boolean isKeyguardGoingAway();
- boolean isLaunchTransitionFadingAway();
- long getKeyguardFadingAwayDuration();
- long getKeyguardFadingAwayDelay();
- long calculateGoingToFullShadeDelay();
-
- /**
- * @return a shortened fading away duration similar to
- * {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
- * we're bypassing
- */
- default long getShortenedFadingAwayDuration() {
- if (isBypassFadingAnimation()) {
- return getKeyguardFadingAwayDuration();
- } else {
- return getKeyguardFadingAwayDuration() / 2;
- }
- }
-
- default boolean isDeviceInteractive() {
- return false;
- }
-
- default void setLaunchTransitionFadingAway(boolean b) {
- }
-
- default void notifyKeyguardGoingAway(boolean b) {
- }
-
- /**
- * @return {@code true} if the current fading away animation is the fast bypass fading.
- */
- default boolean isBypassFadingAnimation() {
- return false;
- }
-
- /**
- * Notifies that the Keyguard is fading away with the specified timings.
- * @param delay the precalculated animation delay in milliseconds
- * @param fadeoutDuration the duration of the exit animation, in milliseconds
- * @param isBypassFading is this a fading away animation while bypassing
- */
- default void notifyKeyguardFadingAway(long delay, long fadeoutDuration,
- boolean isBypassFading) {
- }
-
- default void notifyKeyguardDoneFading() {
- }
-
- default void notifyKeyguardState(boolean showing, boolean methodSecure, boolean occluded) {
- }
-
- interface Callback {
- default void onKeyguardShowingChanged() {}
- default void onKeyguardFadingAwayChanged() {}
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
deleted file mode 100644
index e8b0f9b..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2014 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.systemui.statusbar.policy;
-
-import android.annotation.NonNull;
-import android.content.Context;
-
-import com.android.internal.util.Preconditions;
-import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.Dependency;
-
-import java.util.ArrayList;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- */
-@Singleton
-public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
- implements KeyguardMonitor {
-
- private final ArrayList<Callback> mCallbacks = new ArrayList<>();
-
- private final Context mContext;
- private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
-
- private boolean mShowing;
- private boolean mSecure;
- private boolean mOccluded;
-
- private boolean mListening;
- private boolean mKeyguardFadingAway;
- private long mKeyguardFadingAwayDelay;
- private long mKeyguardFadingAwayDuration;
- private boolean mKeyguardGoingAway;
- private boolean mLaunchTransitionFadingAway;
- private boolean mBypassFadingAnimation;
-
- /**
- */
- @Inject
- public KeyguardMonitorImpl(Context context) {
- mContext = context;
- mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- }
-
- @Override
- public void addCallback(@NonNull Callback callback) {
- Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
- mCallbacks.add(callback);
- if (mCallbacks.size() != 0 && !mListening) {
- mListening = true;
- mKeyguardUpdateMonitor.registerCallback(this);
- }
- }
-
- @Override
- public void removeCallback(@NonNull Callback callback) {
- Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
- if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
- mListening = false;
- mKeyguardUpdateMonitor.removeCallback(this);
- }
- }
-
- @Override
- public boolean isShowing() {
- return mShowing;
- }
-
- @Override
- public boolean isSecure() {
- return mSecure;
- }
-
- @Override
- public boolean isOccluded() {
- return mOccluded;
- }
-
- public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
- if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
- mShowing = showing;
- mSecure = secure;
- mOccluded = occluded;
- notifyKeyguardChanged();
- }
-
- @Override
- public void onTrustChanged(int userId) {
- notifyKeyguardChanged();
- }
-
- public boolean isDeviceInteractive() {
- return mKeyguardUpdateMonitor.isDeviceInteractive();
- }
-
- private void notifyKeyguardChanged() {
- // Copy the list to allow removal during callback.
- new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
- }
-
- public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) {
- mKeyguardFadingAwayDelay = delay;
- mKeyguardFadingAwayDuration = fadeoutDuration;
- mBypassFadingAnimation = isBypassFading;
- setKeyguardFadingAway(true);
- }
-
- private void setKeyguardFadingAway(boolean keyguardFadingAway) {
- if (mKeyguardFadingAway != keyguardFadingAway) {
- mKeyguardFadingAway = keyguardFadingAway;
- ArrayList<Callback> callbacks = new ArrayList<>(mCallbacks);
- for (int i = 0; i < callbacks.size(); i++) {
- callbacks.get(i).onKeyguardFadingAwayChanged();
- }
- }
- }
-
- public void notifyKeyguardDoneFading() {
- mKeyguardGoingAway = false;
- setKeyguardFadingAway(false);
- }
-
- @Override
- public boolean isKeyguardFadingAway() {
- return mKeyguardFadingAway;
- }
-
- @Override
- public boolean isKeyguardGoingAway() {
- return mKeyguardGoingAway;
- }
-
- @Override
- public boolean isBypassFadingAnimation() {
- return mBypassFadingAnimation;
- }
-
- @Override
- public long getKeyguardFadingAwayDelay() {
- return mKeyguardFadingAwayDelay;
- }
-
- @Override
- public long getKeyguardFadingAwayDuration() {
- return mKeyguardFadingAwayDuration;
- }
-
- @Override
- public long calculateGoingToFullShadeDelay() {
- return mKeyguardFadingAwayDelay + mKeyguardFadingAwayDuration;
- }
-
- public void notifyKeyguardGoingAway(boolean keyguardGoingAway) {
- mKeyguardGoingAway = keyguardGoingAway;
- }
-
- public void setLaunchTransitionFadingAway(boolean fadingAway) {
- mLaunchTransitionFadingAway = fadingAway;
- }
-
- @Override
- public boolean isLaunchTransitionFadingAway() {
- return mLaunchTransitionFadingAway;
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
new file mode 100644
index 0000000..aefe201
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 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.systemui.statusbar.policy;
+
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
+
+/**
+ * Source of truth for keyguard state: If locked, occluded, has password, trusted etc.
+ */
+public interface KeyguardStateController extends CallbackController<Callback> {
+
+ /**
+ * If the device is locked or unlocked.
+ */
+ default boolean isUnlocked() {
+ return !isShowing() || canDismissLockScreen();
+ }
+
+ /**
+ * If the lock screen is visible.
+ * The keyguard is also visible when the device is asleep or in always on mode, except when
+ * the screen timed out and the user can unlock by quickly pressing power.
+ *
+ * This is unrelated to being locked or not.
+ *
+ * @see #isUnlocked()
+ * @see #canDismissLockScreen()
+ */
+ boolean isShowing();
+
+ /**
+ * If swiping up will unlock without asking for a password.
+ * @see #isUnlocked()
+ */
+ boolean canDismissLockScreen();
+
+ /**
+ * If the device has PIN/pattern/password or a lock screen at all.
+ */
+ boolean isMethodSecure();
+
+ /**
+ * When there's an {@link android.app.Activity} on top of the keyguard, where
+ * {@link android.app.Activity#setShowWhenLocked(boolean)} is true.
+ */
+ boolean isOccluded();
+
+ /**
+ * If a {@link android.service.trust.TrustAgentService} is keeping the device unlocked.
+ * {@link #canDismissLockScreen()} is better source of truth that also considers this state.
+ */
+ boolean isTrusted();
+
+ /**
+ * If the keyguard dismissal animation is running.
+ * @see #isKeyguardGoingAway()
+ */
+ boolean isKeyguardFadingAway();
+
+ /**
+ * When the keyguard challenge was successfully solved, and {@link android.app.ActivityManager}
+ * is launching the activity that will be revealed.
+ *
+ * This also includes the animation of the keyguard being dismissed, meaning that this will
+ * return {@code true} whenever {@link #isKeyguardFadingAway()} also returns {@code true}.
+ */
+ boolean isKeyguardGoingAway();
+
+ /**
+ * @return a shortened fading away duration similar to
+ * {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
+ * we're bypassing
+ */
+ default long getShortenedFadingAwayDuration() {
+ if (isBypassFadingAnimation()) {
+ return getKeyguardFadingAwayDuration();
+ } else {
+ return getKeyguardFadingAwayDuration() / 2;
+ }
+ }
+
+ /**
+ * @return {@code true} if the current fading away animation is the fast bypass fading.
+ */
+ default boolean isBypassFadingAnimation() {
+ return false;
+ }
+
+ /**
+ * Notifies that the Keyguard is fading away with the specified timings.
+ * @param delay the precalculated animation delay in milliseconds
+ * @param fadeoutDuration the duration of the exit animation, in milliseconds
+ * @param isBypassFading is this a fading away animation while bypassing
+ */
+ default void notifyKeyguardFadingAway(long delay, long fadeoutDuration,
+ boolean isBypassFading) {
+ }
+
+ /**
+ * If there are faces enrolled and user enabled face auth on keyguard.
+ */
+ default boolean isFaceAuthEnabled() {
+ return false;
+ }
+
+ /**
+ * If the animation that morphs a notification into an app window is playing.
+ */
+ boolean isLaunchTransitionFadingAway();
+
+ /**
+ * How long the keyguard dismissal animation should take when unlocking.
+ */
+ long getKeyguardFadingAwayDuration();
+
+ /**
+ * Delay for {@link #getKeyguardFadingAwayDuration()}.
+ */
+ long getKeyguardFadingAwayDelay();
+
+ /**
+ * Delay when going from {@link StatusBarState#KEYGUARD} to {@link StatusBarState#SHADE} or
+ * {@link StatusBarState#SHADE_LOCKED}.
+ */
+ long calculateGoingToFullShadeDelay();
+
+ /** **/
+ default void setLaunchTransitionFadingAway(boolean b) {}
+ /** **/
+ default void notifyKeyguardGoingAway(boolean b) {}
+ /** **/
+ default void notifyKeyguardDoneFading() {}
+ /** **/
+ default void notifyKeyguardState(boolean showing, boolean methodSecure, boolean occluded) {}
+
+ /**
+ * Callback for authentication events.
+ */
+ interface Callback {
+ /**
+ * Called when the locked state of the device changes. The lock screen might still be
+ * showing on some cases, like when a {@link android.service.trust.TrustAgentService} is
+ * active, or face auth was triggered but the user didn't swipe up to dismiss the lock
+ * screen yet.
+ */
+ default void onUnlockedChanged() {}
+
+ /**
+ * If the lock screen is active or not. This is different from being locked, since the lock
+ * screen can be visible but unlocked by {@link android.service.trust.TrustAgentService} or
+ * face unlock.
+ *
+ * @see #isShowing()
+ */
+ default void onKeyguardShowingChanged() {}
+
+ /**
+ * Triggered when the device was just unlocked and the lock screen is being dismissed.
+ */
+ default void onKeyguardFadingAwayChanged() {}
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
new file mode 100644
index 0000000..f8c7532
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2014 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.systemui.statusbar.policy;
+
+import android.annotation.NonNull;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.hardware.biometrics.BiometricSourceType;
+import android.os.Build;
+import android.os.Trace;
+
+import com.android.internal.util.Preconditions;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.systemui.Dependency;
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ */
+@Singleton
+public class KeyguardStateControllerImpl extends KeyguardUpdateMonitorCallback
+ implements KeyguardStateController, Dumpable {
+
+ private static final boolean DEBUG_AUTH_WITH_ADB = false;
+ private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
+
+ private final ArrayList<Callback> mCallbacks = new ArrayList<>();
+ private final Context mContext;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ private final LockPatternUtils mLockPatternUtils;
+ private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
+ new LockedStateInvalidator();
+
+ private boolean mCanDismissLockScreen;
+ private boolean mShowing;
+ private boolean mSecure;
+ private boolean mOccluded;
+
+ private boolean mListening;
+ private boolean mKeyguardFadingAway;
+ private long mKeyguardFadingAwayDelay;
+ private long mKeyguardFadingAwayDuration;
+ private boolean mKeyguardGoingAway;
+ private boolean mLaunchTransitionFadingAway;
+ private boolean mBypassFadingAnimation;
+ private boolean mTrustManaged;
+ private boolean mTrusted;
+ private boolean mDebugUnlocked = false;
+ private boolean mFaceAuthEnabled;
+
+ /**
+ */
+ @Inject
+ public KeyguardStateControllerImpl(Context context) {
+ mContext = context;
+ mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
+ mLockPatternUtils = new LockPatternUtils(context);
+ mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
+
+ update(true /* updateAlways */);
+ if (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB) {
+ // Watch for interesting updates
+ final IntentFilter filter = new IntentFilter();
+ filter.addAction(AUTH_BROADCAST_KEY);
+ context.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (DEBUG_AUTH_WITH_ADB && AUTH_BROADCAST_KEY.equals(intent.getAction())) {
+ mDebugUnlocked = !mDebugUnlocked;
+ update(true /* updateAlways */);
+ }
+ }
+ }, filter, null, null);
+ }
+ }
+
+ @Override
+ public void addCallback(@NonNull Callback callback) {
+ Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
+ mCallbacks.add(callback);
+ if (mCallbacks.size() != 0 && !mListening) {
+ mListening = true;
+ mKeyguardUpdateMonitor.registerCallback(this);
+ }
+ }
+
+ @Override
+ public void removeCallback(@NonNull Callback callback) {
+ Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
+ if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
+ mListening = false;
+ mKeyguardUpdateMonitor.removeCallback(this);
+ }
+ }
+
+ @Override
+ public boolean isShowing() {
+ return mShowing;
+ }
+
+ @Override
+ public boolean isMethodSecure() {
+ return mSecure;
+ }
+
+ @Override
+ public boolean isOccluded() {
+ return mOccluded;
+ }
+
+ @Override
+ public boolean isTrusted() {
+ return mTrusted;
+ }
+
+ @Override
+ public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
+ if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
+ mShowing = showing;
+ mSecure = secure;
+ mOccluded = occluded;
+ notifyKeyguardChanged();
+ }
+
+ @Override
+ public void onTrustChanged(int userId) {
+ notifyKeyguardChanged();
+ }
+
+ private void notifyKeyguardChanged() {
+ // Copy the list to allow removal during callback.
+ new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
+ }
+
+ private void notifyUnlockedChanged() {
+ // Copy the list to allow removal during callback.
+ new ArrayList<>(mCallbacks).forEach(Callback::onUnlockedChanged);
+ }
+
+ @Override
+ public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) {
+ mKeyguardFadingAwayDelay = delay;
+ mKeyguardFadingAwayDuration = fadeoutDuration;
+ mBypassFadingAnimation = isBypassFading;
+ setKeyguardFadingAway(true);
+ }
+
+ private void setKeyguardFadingAway(boolean keyguardFadingAway) {
+ if (mKeyguardFadingAway != keyguardFadingAway) {
+ mKeyguardFadingAway = keyguardFadingAway;
+ ArrayList<Callback> callbacks = new ArrayList<>(mCallbacks);
+ for (int i = 0; i < callbacks.size(); i++) {
+ callbacks.get(i).onKeyguardFadingAwayChanged();
+ }
+ }
+ }
+
+ @Override
+ public void notifyKeyguardDoneFading() {
+ mKeyguardGoingAway = false;
+ setKeyguardFadingAway(false);
+ }
+
+ private void update(boolean updateAlways) {
+ Trace.beginSection("KeyguardStateController#update");
+ int user = KeyguardUpdateMonitor.getCurrentUser();
+ boolean secure = mLockPatternUtils.isSecure(user);
+ boolean canDismissLockScreen = !secure || mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)
+ || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
+ boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
+ boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
+ boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user);
+ boolean changed = secure != mSecure || canDismissLockScreen != mCanDismissLockScreen
+ || trustManaged != mTrustManaged
+ || mFaceAuthEnabled != faceAuthEnabled;
+ if (changed || updateAlways) {
+ mSecure = secure;
+ mCanDismissLockScreen = canDismissLockScreen;
+ mTrusted = trusted;
+ mTrustManaged = trustManaged;
+ mFaceAuthEnabled = faceAuthEnabled;
+ notifyUnlockedChanged();
+ }
+ Trace.endSection();
+ }
+
+ @Override
+ public boolean canDismissLockScreen() {
+ return mCanDismissLockScreen;
+ }
+
+ @Override
+ public boolean isFaceAuthEnabled() {
+ return mFaceAuthEnabled;
+ }
+
+ @Override
+ public boolean isKeyguardFadingAway() {
+ return mKeyguardFadingAway;
+ }
+
+ @Override
+ public boolean isKeyguardGoingAway() {
+ return mKeyguardGoingAway;
+ }
+
+ @Override
+ public boolean isBypassFadingAnimation() {
+ return mBypassFadingAnimation;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDelay() {
+ return mKeyguardFadingAwayDelay;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDuration() {
+ return mKeyguardFadingAwayDuration;
+ }
+
+ @Override
+ public long calculateGoingToFullShadeDelay() {
+ return mKeyguardFadingAwayDelay + mKeyguardFadingAwayDuration;
+ }
+
+ @Override
+ public void notifyKeyguardGoingAway(boolean keyguardGoingAway) {
+ mKeyguardGoingAway = keyguardGoingAway;
+ }
+
+ @Override
+ public void setLaunchTransitionFadingAway(boolean fadingAway) {
+ mLaunchTransitionFadingAway = fadingAway;
+ }
+
+ @Override
+ public boolean isLaunchTransitionFadingAway() {
+ return mLaunchTransitionFadingAway;
+ }
+
+ /**
+ * Dumps internal state for debugging.
+ * @param pw Where to dump.
+ */
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("KeyguardStateController:");
+ pw.println(" mSecure: " + mSecure);
+ pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
+ pw.println(" mTrustManaged: " + mTrustManaged);
+ pw.println(" mTrusted: " + mTrusted);
+ pw.println(" mDebugUnlocked: " + mDebugUnlocked);
+ pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled);
+ }
+
+ private class LockedStateInvalidator extends KeyguardUpdateMonitorCallback {
+ @Override
+ public void onUserSwitchComplete(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onTrustChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onTrustManagedChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onStartedWakingUp() {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
+ Trace.beginSection("KeyguardUpdateMonitorCallback#onBiometricAuthenticated");
+ if (!mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()) {
+ Trace.endSection();
+ return;
+ }
+ update(false /* updateAlways */);
+ Trace.endSection();
+ }
+
+ @Override
+ public void onFaceUnlockStateChanged(boolean running, int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onStrongAuthStateChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onScreenTurnedOff() {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onKeyguardVisibilityChanged(boolean showing) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onBiometricsCleared() {
+ update(false /* alwaysUpdate */);
+ }
+ };
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 4fa4b6c..95ae23c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -62,7 +62,6 @@
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.qs.tiles.UserDetailView;
import com.android.systemui.statusbar.phone.SystemUIDialog;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -93,7 +92,7 @@
private final ArrayList<WeakReference<BaseUserAdapter>> mAdapters = new ArrayList<>();
private final GuestResumeSessionReceiver mGuestResumeSessionReceiver
= new GuestResumeSessionReceiver();
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
protected final Handler mHandler;
private final ActivityStarter mActivityStarter;
@@ -110,13 +109,13 @@
private SparseBooleanArray mForcePictureLoadForUserId = new SparseBooleanArray(2);
@Inject
- public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor,
+ public UserSwitcherController(Context context, KeyguardStateController keyguardStateController,
@Named(MAIN_HANDLER_NAME) Handler handler, ActivityStarter activityStarter) {
mContext = context;
if (!UserManager.isGuestUserEphemeral()) {
mGuestResumeSessionReceiver.register(context);
}
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mHandler = handler;
mActivityStarter = activityStarter;
mUserManager = UserManager.get(context);
@@ -149,7 +148,7 @@
// Fetch initial values.
mSettingsObserver.onChange(false);
- keyguardMonitor.addCallback(mCallback);
+ keyguardStateController.addCallback(mCallback);
listenForCallState();
refreshUsers(UserHandle.USER_NULL);
@@ -597,20 +596,18 @@
public static abstract class BaseUserAdapter extends BaseAdapter {
final UserSwitcherController mController;
- private final KeyguardMonitor mKeyguardMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
protected BaseUserAdapter(UserSwitcherController controller) {
mController = controller;
- mKeyguardMonitor = controller.mKeyguardMonitor;
- mUnlockMethodCache = UnlockMethodCache.getInstance(controller.mContext);
+ mKeyguardStateController = controller.mKeyguardStateController;
controller.addAdapter(new WeakReference<>(this));
}
public int getUserCount() {
- boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
- && mKeyguardMonitor.isSecure()
- && !mUnlockMethodCache.canSkipBouncer();
+ boolean secureKeyguardShowing = mKeyguardStateController.isShowing()
+ && mKeyguardStateController.isMethodSecure()
+ && !mKeyguardStateController.canDismissLockScreen();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
@@ -630,9 +627,9 @@
@Override
public int getCount() {
- boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
- && mKeyguardMonitor.isSecure()
- && !mUnlockMethodCache.canSkipBouncer();
+ boolean secureKeyguardShowing = mKeyguardStateController.isShowing()
+ && mKeyguardStateController.isMethodSecure()
+ && !mKeyguardStateController.canDismissLockScreen();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
@@ -819,19 +816,21 @@
}
};
- private final KeyguardMonitor.Callback mCallback = new KeyguardMonitor.Callback() {
- @Override
- public void onKeyguardShowingChanged() {
+ private final KeyguardStateController.Callback mCallback =
+ new KeyguardStateController.Callback() {
+ @Override
+ public void onKeyguardShowingChanged() {
- // When Keyguard is going away, we don't need to update our items immediately which
- // helps making the transition faster.
- if (!mKeyguardMonitor.isShowing()) {
- mHandler.post(UserSwitcherController.this::notifyAdapters);
- } else {
- notifyAdapters();
- }
- }
- };
+ // When Keyguard is going away, we don't need to update our items immediately
+ // which
+ // helps making the transition faster.
+ if (!mKeyguardStateController.isShowing()) {
+ mHandler.post(UserSwitcherController.this::notifyAdapters);
+ } else {
+ notifyAdapters();
+ }
+ }
+ };
private final class ExitGuestDialog extends SystemUIDialog implements
DialogInterface.OnClickListener {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
index 3b5e12c..64ab060 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java
@@ -45,7 +45,6 @@
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
-import android.view.WindowManagerPolicyConstants;
import androidx.test.filters.SmallTest;
@@ -53,7 +52,6 @@
import com.android.systemui.ScreenDecorations.TunablePaddingTagListener;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentService;
-import com.android.systemui.statusbar.phone.NavigationModeController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.tuner.TunablePadding;
@@ -80,7 +78,6 @@
private TunerService mTunerService;
private StatusBarWindowView mView;
private TunablePaddingService mTunablePaddingService;
- private NavigationModeController mNavigationModeController;
@Before
public void setup() {
@@ -90,8 +87,6 @@
mTunablePaddingService = mDependency.injectMockDependency(TunablePaddingService.class);
mTunerService = mDependency.injectMockDependency(TunerService.class);
mFragmentService = mDependency.injectMockDependency(FragmentService.class);
- mNavigationModeController = mDependency.injectMockDependency(
- NavigationModeController.class);
mStatusBar = mock(StatusBar.class);
mWindowManager = mock(WindowManager.class);
@@ -213,54 +208,6 @@
}
@Test
- public void testAssistHandles() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- when(mNavigationModeController.addListener(any())).thenReturn(
- WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL);
-
- mScreenDecorations.start();
-
- // Add 2 windows for rounded corners (top and bottom).
- verify(mWindowManager, times(2)).addView(any(), any());
- }
-
- @Test
- public void testDelayedAssistHandles() {
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_top, 0);
- mContext.getOrCreateTestableResources().addOverride(
- com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
- mContext.getOrCreateTestableResources()
- .addOverride(dimen.rounded_corner_content_padding, 0);
- when(mNavigationModeController.addListener(any())).thenReturn(
- WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON);
-
- mScreenDecorations.start();
-
- // No handles and no corners
- verify(mWindowManager, never()).addView(any(), any());
-
- mScreenDecorations.handleNavigationModeChange(
- WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL);
-
- // Add 2 windows for rounded corners (top and bottom).
- verify(mWindowManager, times(2)).addView(any(), any());
- }
-
- @Test
public void hasRoundedCornerOverlayFlagSet() {
assertThat(mScreenDecorations.getWindowLayoutParams().privateFlags
& PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java
index 9c920f52..fbb8e0c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleBehaviorControllerTest.java
@@ -38,7 +38,6 @@
import com.android.internal.app.AssistUtils;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.systemui.DumpController;
-import com.android.systemui.ScreenDecorations;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.OverviewProxyService;
@@ -64,7 +63,6 @@
private AssistHandleBehaviorController mAssistHandleBehaviorController;
- @Mock private ScreenDecorations mMockScreenDecorations;
@Mock private AssistUtils mMockAssistUtils;
@Mock private Handler mMockHandler;
@Mock private PhenotypeHelper mMockPhenotypeHelper;
@@ -74,6 +72,7 @@
@Mock private AssistHandleBehaviorController.BehaviorController mMockTestBehavior;
@Mock private NavigationModeController mMockNavigationModeController;
@Mock private DumpController mMockDumpController;
+ @Mock private AssistHandleViewController mMockAssistHandleViewController;
@Before
public void setup() {
@@ -97,7 +96,7 @@
mContext,
mMockAssistUtils,
mMockHandler,
- () -> mMockScreenDecorations,
+ () -> mMockAssistHandleViewController,
mMockPhenotypeHelper,
behaviorMap,
mMockNavigationModeController,
@@ -114,14 +113,14 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.showAndStay();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.hide();
// Assert
- verify(mMockScreenDecorations).setAssistHintVisible(false);
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verify(mMockAssistHandleViewController).setAssistHintVisible(false);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -129,13 +128,13 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.hide();
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -143,14 +142,14 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndStay();
// Assert
- verify(mMockScreenDecorations).setAssistHintVisible(true);
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verify(mMockAssistHandleViewController).setAssistHintVisible(true);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -158,13 +157,13 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.showAndStay();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndStay();
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -172,13 +171,13 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(null);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndStay();
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -186,15 +185,15 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGo();
// Assert
- InOrder inOrder = inOrder(mMockScreenDecorations);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(true);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(false);
+ InOrder inOrder = inOrder(mMockAssistHandleViewController);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(true);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(false);
inOrder.verifyNoMoreInteractions();
}
@@ -203,14 +202,14 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.showAndStay();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGo();
// Assert
- verify(mMockScreenDecorations).setAssistHintVisible(false);
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verify(mMockAssistHandleViewController).setAssistHintVisible(false);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -221,13 +220,13 @@
eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS),
anyLong())).thenReturn(10000L);
mAssistHandleBehaviorController.showAndGo();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGo();
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -235,13 +234,13 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(null);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGo();
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -249,15 +248,15 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGoDelayed(1000, false);
// Assert
- InOrder inOrder = inOrder(mMockScreenDecorations);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(true);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(false);
+ InOrder inOrder = inOrder(mMockAssistHandleViewController);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(true);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(false);
inOrder.verifyNoMoreInteractions();
}
@@ -266,14 +265,14 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.showAndStay();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGoDelayed(1000, false);
// Assert
- verify(mMockScreenDecorations).setAssistHintVisible(false);
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verify(mMockAssistHandleViewController).setAssistHintVisible(false);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -281,16 +280,16 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(COMPONENT_NAME);
mAssistHandleBehaviorController.showAndStay();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGoDelayed(1000, true);
// Assert
- InOrder inOrder = inOrder(mMockScreenDecorations);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(false);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(true);
- inOrder.verify(mMockScreenDecorations).setAssistHintVisible(false);
+ InOrder inOrder = inOrder(mMockAssistHandleViewController);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(false);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(true);
+ inOrder.verify(mMockAssistHandleViewController).setAssistHintVisible(false);
inOrder.verifyNoMoreInteractions();
}
@@ -302,13 +301,13 @@
eq(SystemUiDeviceConfigFlags.ASSIST_HANDLES_SHOWN_FREQUENCY_THRESHOLD_MS),
anyLong())).thenReturn(10000L);
mAssistHandleBehaviorController.showAndGo();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGoDelayed(1000, false);
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
@@ -316,13 +315,13 @@
// Arrange
when(mMockAssistUtils.getAssistComponentForUser(anyInt())).thenReturn(null);
mAssistHandleBehaviorController.hide();
- reset(mMockScreenDecorations);
+ reset(mMockAssistHandleViewController);
// Act
mAssistHandleBehaviorController.showAndGoDelayed(1000, false);
// Assert
- verifyNoMoreInteractions(mMockScreenDecorations);
+ verifyNoMoreInteractions(mMockAssistHandleViewController);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleViewControllerTest.java
new file mode 100644
index 0000000..6e21ae2
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/assist/AssistHandleViewControllerTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2019 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.systemui.assist;
+
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.when;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper.RunWithLooper;
+import android.view.View;
+import android.view.ViewPropertyAnimator;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.systemui.CornerHandleView;
+import com.android.systemui.SysuiTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+@RunWithLooper
+public class AssistHandleViewControllerTest extends SysuiTestCase {
+
+ private AssistHandleViewController mAssistHandleViewController;
+
+ @Mock private Handler mMockHandler;
+ @Mock private Looper mMockLooper;
+ @Mock private View mMockBarView;
+ @Mock private CornerHandleView mMockAssistHint;
+ @Mock private ViewPropertyAnimator mMockAnimator;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ when(mMockBarView.findViewById(anyInt())).thenReturn(mMockAssistHint);
+ when(mMockAssistHint.animate()).thenReturn(mMockAnimator);
+ when(mMockAnimator.setInterpolator(any())).thenReturn(mMockAnimator);
+ when(mMockAnimator.setDuration(anyLong())).thenReturn(mMockAnimator);
+ doNothing().when(mMockAnimator).cancel();
+ when(mMockHandler.getLooper()).thenReturn(mMockLooper);
+ when(mMockLooper.isCurrentThread()).thenReturn(true);
+
+ mAssistHandleViewController = new AssistHandleViewController(mMockHandler, mMockBarView);
+ }
+
+ @Test
+ public void testSetVisibleWithoutBlocked() {
+ // Act
+ mAssistHandleViewController.setAssistHintVisible(true);
+
+ // Assert
+ assertTrue(mAssistHandleViewController.mAssistHintVisible);
+ }
+
+ @Test
+ public void testSetInvisibleWithoutBlocked() {
+ // Arrange
+ mAssistHandleViewController.setAssistHintVisible(true);
+
+ // Act
+ mAssistHandleViewController.setAssistHintVisible(false);
+
+ // Assert
+ assertFalse(mAssistHandleViewController.mAssistHintVisible);
+ }
+
+ @Test
+ public void testSetVisibleWithBlocked() {
+ // Act
+ mAssistHandleViewController.setAssistHintBlocked(true);
+ mAssistHandleViewController.setAssistHintVisible(true);
+
+ // Assert
+ assertFalse(mAssistHandleViewController.mAssistHintVisible);
+ assertTrue(mAssistHandleViewController.mAssistHintBlocked);
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
index 818db87..853b2db 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
@@ -40,7 +40,7 @@
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import org.junit.Before;
@@ -64,7 +64,7 @@
@Mock
private ActivityStarter mActivityStarter;
@Mock
- private KeyguardMonitor mKeyguard;
+ private KeyguardStateController mKeyguard;
@Mock
private NetworkController mNetworkController;
@Mock
@@ -83,7 +83,7 @@
mDependency.injectTestDependency(Dependency.BG_LOOPER, mTestableLooper.getLooper());
mController = mDependency.injectMockDependency(CastController.class);
mActivityStarter = mDependency.injectMockDependency(ActivityStarter.class);
- mKeyguard = mDependency.injectMockDependency(KeyguardMonitor.class);
+ mKeyguard = mDependency.injectMockDependency(KeyguardStateController.class);
mNetworkController = mDependency.injectMockDependency(NetworkController.class);
when(mHost.getContext()).thenReturn(mContext);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index 0817ee9..cf6fd4a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -51,8 +51,8 @@
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.wakelock.WakeLockFake;
import org.junit.Before;
@@ -79,7 +79,7 @@
@Mock
private AccessibilityController mAccessibilityController;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private StatusBarStateController mStatusBarStateController;
@Mock
@@ -111,7 +111,7 @@
}
mController = new KeyguardIndicationController(mContext, mIndicationArea, mLockIcon,
mLockPatternUtils, mWakeLock, mShadeController, mAccessibilityController,
- mUnlockMethodCache, mStatusBarStateController, mKeyguardUpdateMonitor);
+ mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor);
}
@Test
@@ -187,7 +187,7 @@
}
@Test
- public void unlockMethodCache_listenerUpdatesIndication() {
+ public void updateMonitor_listenerUpdatesIndication() {
createController();
String restingIndication = "Resting indication";
@@ -203,14 +203,14 @@
reset(mKeyguardUpdateMonitor);
when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true);
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
- mController.onUnlockMethodStateChanged();
+ mController.onUnlockedChanged();
assertThat(mTextView.getText()).isEqualTo(restingIndication);
}
@Test
- public void unlockMethodCache_listener() {
+ public void updateMonitor_listener() {
createController();
- verify(mUnlockMethodCache).addListener(eq(mController));
+ verify(mKeyguardStateController).addCallback(eq(mController));
verify(mStatusBarStateController).addCallback(eq(mController));
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
index d804b6f..99dc895 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
@@ -26,22 +26,17 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
-import android.testing.TestableLooper.RunWithLooper;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
-import com.android.systemui.statusbar.NotificationViewHierarchyManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import dagger.Lazy;
-
@SmallTest
@org.junit.runner.RunWith(AndroidTestingRunner.class)
@@ -49,19 +44,17 @@
public class DynamicPrivacyControllerTest extends SysuiTestCase {
private DynamicPrivacyController mDynamicPrivacyController;
- private UnlockMethodCache mCache = mock(UnlockMethodCache.class);
private NotificationLockscreenUserManager mLockScreenUserManager
= mock(NotificationLockscreenUserManager.class);
private DynamicPrivacyController.Listener mListener
= mock(DynamicPrivacyController.Listener.class);
- private KeyguardMonitor mKeyguardMonitor = mock(KeyguardMonitor.class);
+ private KeyguardStateController mKeyguardStateController = mock(KeyguardStateController.class);
@Before
public void setUp() throws Exception {
- when(mCache.canSkipBouncer()).thenReturn(false);
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
mDynamicPrivacyController = new DynamicPrivacyController(
- mLockScreenUserManager, mKeyguardMonitor, mCache,
+ mLockScreenUserManager, mKeyguardStateController,
mock(StatusBarStateController.class));
mDynamicPrivacyController.setStatusBarKeyguardViewManager(
mock(StatusBarKeyguardViewManager.class));
@@ -71,7 +64,7 @@
@Test
public void testDynamicFalseWhenCannotSkipBouncer() {
enableDynamicPrivacy();
- when(mCache.canSkipBouncer()).thenReturn(false);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
Assert.assertFalse("can't skip bouncer but is dynamically unlocked",
mDynamicPrivacyController.isDynamicallyUnlocked());
}
@@ -79,16 +72,16 @@
@Test
public void testDynamicTrueWhenCanSkipBouncer() {
enableDynamicPrivacy();
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
Assert.assertTrue("Isn't dynamically unlocked even though we can skip bouncer",
mDynamicPrivacyController.isDynamicallyUnlocked());
}
@Test
public void testNotifiedWhenEnabled() {
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
enableDynamicPrivacy();
- mDynamicPrivacyController.onUnlockMethodStateChanged();
+ mDynamicPrivacyController.onUnlockedChanged();
verify(mListener).onDynamicPrivacyChanged();
}
@@ -99,10 +92,10 @@
@Test
public void testNotNotifiedWithoutNotifications() {
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
when(mLockScreenUserManager.shouldHideNotifications(anyInt())).thenReturn(
true);
- mDynamicPrivacyController.onUnlockMethodStateChanged();
+ mDynamicPrivacyController.onUnlockedChanged();
verifyNoMoreInteractions(mListener);
}
}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index fd67611..ff9aae7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -39,6 +39,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -70,7 +71,7 @@
@Mock
private StatusBar mStatusBar;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private Handler mHandler;
@Mock
@@ -82,7 +83,7 @@
MockitoAnnotations.initMocks(this);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
mContext.addMockSystemService(PowerManager.class, mPowerManager);
@@ -90,7 +91,7 @@
mDependency.injectTestDependency(StatusBarWindowController.class,
mStatusBarWindowController);
mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
- mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache,
+ mKeyguardViewMediator, mScrimController, mStatusBar, mKeyguardStateController,
mHandler, mUpdateMonitor, 0 /* wakeUpDelay */, mKeyguardBypassController);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index c51263f..3ba3e28 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -52,6 +52,7 @@
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Assert;
import org.junit.Before;
@@ -83,7 +84,7 @@
@Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private KeyguardBypassController mKeyguardBypassController;
@Mock
@@ -102,7 +103,7 @@
when(mKeyguardHostView.getHeight()).thenReturn(500);
mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback,
mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager,
- mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor,
+ mExpansionCallback, mKeyguardStateController, mKeyguardUpdateMonitor,
mKeyguardBypassController, mHandler) {
@Override
protected void inflateView() {
@@ -384,7 +385,7 @@
@Test
public void testShow_delaysIfFaceAuthIsRunning() {
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
mBouncer.show(true /* reset */);
ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class);
@@ -397,7 +398,7 @@
@Test
public void testShow_delaysIfFaceAuthIsRunning_unlessBypass() {
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
mBouncer.show(true /* reset */);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 5d3cdc8..f1aaf3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -48,7 +48,7 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.ScrimView;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.wakelock.WakeLock;
import com.android.systemui.utils.os.FakeHandler;
@@ -103,7 +103,7 @@
mScrimInFrontColor = scrimInFrontColor;
},
visible -> mScrimVisibility = visible, mDozeParamenters, mAlarmManager,
- mock(KeyguardMonitor.class));
+ mock(KeyguardStateController.class));
mScrimController.setHasBackdrop(false);
mScrimController.setWallpaperSupportsAmbientMode(false);
mScrimController.transitionTo(ScrimState.KEYGUARD);
@@ -801,9 +801,9 @@
ScrimView scrimForBubble,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
super(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
- scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
+ scrimVisibleListener, dozeParameters, alarmManager, keyguardStateController);
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 3c445c8..c3b25ce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -46,6 +46,7 @@
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -65,6 +66,8 @@
@Mock
private KeyguardBouncer mBouncer;
@Mock
+ private KeyguardStateController mKeyguardStateController;
+ @Mock
private StatusBar mStatusBar;
@Mock
private ViewGroup mContainer;
@@ -90,6 +93,7 @@
mDependency.injectMockDependency(StatusBarWindowController.class);
mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController);
+ mDependency.injectTestDependency(KeyguardStateController.class, mKeyguardStateController);
when(mLockIconContainer.getParent()).thenReturn(mock(ViewGroup.class));
when(mLockIconContainer.animate()).thenReturn(mock(ViewPropertyAnimator.class,
RETURNS_DEEP_STUBS));
@@ -169,7 +173,7 @@
@Test
public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
- when(mStatusBar.isKeyguardCurrentlySecure()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
true /* tracking */);
verify(mBouncer).show(eq(false), eq(false));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
index 5a6f27d..266abcf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
@@ -71,7 +71,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -104,7 +104,7 @@
@Mock
private ShadeController mShadeController;
@Mock
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private Handler mHandler;
@Mock
@@ -167,7 +167,8 @@
mock(StatusBarStateController.class), mock(KeyguardManager.class),
mock(IDreamManager.class), mRemoteInputManager,
mock(StatusBarRemoteInputCallback.class), mock(NotificationGroupManager.class),
- mock(NotificationLockscreenUserManager.class), mShadeController, mKeyguardMonitor,
+ mock(NotificationLockscreenUserManager.class), mShadeController,
+ mKeyguardStateController,
mock(NotificationInterruptionStateProvider.class), mock(MetricsLogger.class),
mock(LockPatternUtils.class), mHandler, mHandler, mActivityIntentHelper,
mBubbleController);
@@ -200,7 +201,7 @@
sbn.getNotification().contentIntent = mContentIntent;
sbn.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
@@ -263,7 +264,7 @@
// Given
sbn.getNotification().contentIntent = null;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
@@ -293,7 +294,7 @@
// Given
sbn.getNotification().contentIntent = mContentIntent;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 4eb9a31..3be71c0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -110,7 +110,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import org.junit.Before;
@@ -131,7 +131,7 @@
@RunWithLooper
public class StatusBarTest extends SysuiTestCase {
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- @Mock private UnlockMethodCache mUnlockMethodCache;
+ @Mock private KeyguardStateController mKeyguardStateController;
@Mock private KeyguardIndicationController mKeyguardIndicationController;
@Mock private NotificationStackScrollLayout mStackScroller;
@Mock private HeadsUpManagerPhone mHeadsUpManager;
@@ -191,7 +191,6 @@
mViewHierarchyManager);
mDependency.injectTestDependency(VisualStabilityManager.class, mVisualStabilityManager);
mDependency.injectTestDependency(NotificationListener.class, mNotificationListener);
- mDependency.injectTestDependency(KeyguardMonitor.class, mock(KeyguardMonitor.class));
mDependency.injectTestDependency(AppOpsController.class, mock(AppOpsController.class));
mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController);
mDependency.injectTestDependency(DeviceProvisionedController.class,
@@ -253,7 +252,7 @@
mHeadsUpManager, mHeadsUpSuppressor);
when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
- mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache,
+ mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager,
mKeyguardIndicationController, mStackScroller,
mPowerManager, mNotificationPanelView, mBarService, mNotificationListener,
mNotificationLogger, mVisualStabilityManager, mViewHierarchyManager,
@@ -270,6 +269,7 @@
SystemUIFactory.getInstance().getRootComponent()
.getStatusBarInjector()
.createStatusBar(mStatusBar);
+ mStatusBar.mKeyguardStateController = mKeyguardStateController;
mStatusBar.setHeadsUpManager(mHeadsUpManager);
mStatusBar.putComponent(StatusBar.class, mStatusBar);
Dependency.get(InitController.class).executePostInitTasks();
@@ -313,11 +313,11 @@
public void lockscreenStateMetrics_notShowing() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(false);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
mStatusBar.onKeyguardViewManagerStatesUpdated();
MetricsAsserts.assertHasLog("missing hidden insecure lockscreen log",
@@ -331,11 +331,11 @@
public void lockscreenStateMetrics_notShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -350,11 +350,11 @@
public void lockscreenStateMetrics_isShowing() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(false);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -369,11 +369,11 @@
public void lockscreenStateMetrics_isShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -388,11 +388,11 @@
public void lockscreenStateMetrics_isShowingBouncer() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -776,7 +776,7 @@
static class TestableStatusBar extends StatusBar {
public TestableStatusBar(StatusBarKeyguardViewManager man,
- UnlockMethodCache unlock, KeyguardIndicationController key,
+ KeyguardIndicationController key,
NotificationStackScrollLayout stack,
PowerManager pm, NotificationPanelView panelView,
IStatusBarService barService, NotificationListener notificationListener,
@@ -803,7 +803,6 @@
KeyguardUpdateMonitor keyguardUpdateMonitor,
StatusBarWindowView statusBarWindow) {
mStatusBarKeyguardViewManager = man;
- mUnlockMethodCache = unlock;
mKeyguardIndicationController = key;
mStackScroller = stack;
mPowerManager = pm;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
deleted file mode 100644
index 2fb0e0e..0000000
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.utils.leaks;
-
-import android.testing.LeakCheck;
-
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-
-public class FakeKeyguardMonitor implements KeyguardMonitor {
-
- private final BaseLeakChecker<Callback> mCallbackController;
-
- public FakeKeyguardMonitor(LeakCheck test) {
- mCallbackController = new BaseLeakChecker<Callback>(test, "keyguard");
- }
-
- @Override
- public void addCallback(Callback callback) {
- mCallbackController.addCallback(callback);
- }
-
- @Override
- public void removeCallback(Callback callback) {
- mCallbackController.removeCallback(callback);
- }
-
- @Override
- public boolean isSecure() {
- return false;
- }
-
- @Override
- public boolean isShowing() {
- return false;
- }
-
- @Override
- public boolean isOccluded() {
- return false;
- }
-
- @Override
- public boolean isKeyguardFadingAway() {
- return false;
- }
-
- @Override
- public boolean isKeyguardGoingAway() {
- return false;
- }
-
- @Override
- public boolean isLaunchTransitionFadingAway() {
- return false;
- }
-
- @Override
- public long getKeyguardFadingAwayDuration() {
- return 0;
- }
-
- @Override
- public long getKeyguardFadingAwayDelay() {
- return 0;
- }
-
- @Override
- public long calculateGoingToFullShadeDelay() {
- return 0;
- }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java
new file mode 100644
index 0000000..26cac29
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2016 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.systemui.utils.leaks;
+
+import android.testing.LeakCheck;
+
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+
+public class FakeKeyguardStateController implements KeyguardStateController {
+
+ private final BaseLeakChecker<Callback> mCallbackController;
+
+ public FakeKeyguardStateController(LeakCheck test) {
+ mCallbackController = new BaseLeakChecker<Callback>(test, "keyguard");
+ }
+
+ @Override
+ public void addCallback(Callback callback) {
+ mCallbackController.addCallback(callback);
+ }
+
+ @Override
+ public void removeCallback(Callback callback) {
+ mCallbackController.removeCallback(callback);
+ }
+
+ @Override
+ public boolean isMethodSecure() {
+ return false;
+ }
+
+ @Override
+ public boolean isShowing() {
+ return false;
+ }
+
+ @Override
+ public boolean canDismissLockScreen() {
+ return false;
+ }
+
+ @Override
+ public boolean isOccluded() {
+ return false;
+ }
+
+ @Override
+ public boolean isTrusted() {
+ return false;
+ }
+
+ @Override
+ public boolean isKeyguardFadingAway() {
+ return false;
+ }
+
+ @Override
+ public boolean isKeyguardGoingAway() {
+ return false;
+ }
+
+ @Override
+ public boolean isLaunchTransitionFadingAway() {
+ return false;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDuration() {
+ return 0;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDelay() {
+ return 0;
+ }
+
+ @Override
+ public long calculateGoingToFullShadeDelay() {
+ return 0;
+ }
+}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
index f479126..fedc08d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
@@ -14,8 +14,6 @@
package com.android.systemui.utils.leaks;
-import static org.mockito.Matchers.any;
-
import android.testing.LeakCheck;
import android.util.ArrayMap;
@@ -29,7 +27,7 @@
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.FlashlightController;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NextAlarmController;
@@ -60,7 +58,7 @@
HotspotController.class,
FlashlightController.class,
UserInfoController.class,
- KeyguardMonitor.class,
+ KeyguardStateController.class,
BatteryController.class,
SecurityController.class,
ManagedProfileController.class,
@@ -118,8 +116,8 @@
obj = new FakeFlashlightController(this);
} else if (cls == UserInfoController.class) {
obj = new FakeUserInfoController(this);
- } else if (cls == KeyguardMonitor.class) {
- obj = new FakeKeyguardMonitor(this);
+ } else if (cls == KeyguardStateController.class) {
+ obj = new FakeKeyguardStateController(this);
} else if (cls == BatteryController.class) {
obj = new FakeBatteryController(this);
} else if (cls == SecurityController.class) {
diff --git a/services/backup/backuplib/java/com/android/server/backup/transport/DelegatingTransport.java b/services/backup/backuplib/java/com/android/server/backup/transport/DelegatingTransport.java
new file mode 100644
index 0000000..ab87080
--- /dev/null
+++ b/services/backup/backuplib/java/com/android/server/backup/transport/DelegatingTransport.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (C) 2019 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.server.backup.transport;
+
+import android.app.backup.BackupAgent;
+import android.app.backup.BackupTransport;
+import android.app.backup.RestoreDescription;
+import android.app.backup.RestoreSet;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
+
+import com.android.internal.backup.IBackupTransport;
+
+/**
+ * Delegates all transport methods to the delegate() implemented in the derived class.
+ */
+public abstract class DelegatingTransport extends IBackupTransport.Stub {
+ protected abstract IBackupTransport getDelegate() throws RemoteException;
+
+ /**
+ * Ask the transport for the name under which it should be registered. This will
+ * typically be its host service's component name, but need not be.
+ */
+ @Override
+ public String name() throws RemoteException {
+ return getDelegate().name();
+ }
+
+ /**
+ * Ask the transport for an Intent that can be used to launch any internal
+ * configuration Activity that it wishes to present. For example, the transport
+ * may offer a UI for allowing the user to supply login credentials for the
+ * transport's off-device backend.
+ *
+ * If the transport does not supply any user-facing configuration UI, it should
+ * return null from this method.
+ *
+ * @return An Intent that can be passed to Context.startActivity() in order to
+ * launch the transport's configuration UI. This method will return null
+ * if the transport does not offer any user-facing configuration UI.
+ */
+ @Override
+ public Intent configurationIntent() throws RemoteException {
+ return getDelegate().configurationIntent();
+ }
+
+ /**
+ * On demand, supply a one-line string that can be shown to the user that
+ * describes the current backend destination. For example, a transport that
+ * can potentially associate backup data with arbitrary user accounts should
+ * include the name of the currently-active account here.
+ *
+ * @return A string describing the destination to which the transport is currently
+ * sending data. This method should not return null.
+ */
+ @Override
+ public String currentDestinationString() throws RemoteException {
+ return getDelegate().currentDestinationString();
+ }
+
+ /**
+ * Ask the transport for an Intent that can be used to launch a more detailed
+ * secondary data management activity. For example, the configuration intent might
+ * be one for allowing the user to select which account they wish to associate
+ * their backups with, and the management intent might be one which presents a
+ * UI for managing the data on the backend.
+ *
+ * <p>In the Settings UI, the configuration intent will typically be invoked
+ * when the user taps on the preferences item labeled with the current
+ * destination string, and the management intent will be placed in an overflow
+ * menu labelled with the management label string.
+ *
+ * <p>If the transport does not supply any user-facing data management
+ * UI, then it should return {@code null} from this method.
+ *
+ * @return An intent that can be passed to Context.startActivity() in order to
+ * launch the transport's data-management UI. This method will return
+ * {@code null} if the transport does not offer any user-facing data
+ * management UI.
+ */
+ @Override
+ public Intent dataManagementIntent() throws RemoteException {
+ return getDelegate().dataManagementIntent();
+ }
+
+ /**
+ * On demand, supply a short {@link CharSequence} that can be shown to the user as the
+ * label on
+ * an overflow menu item used to invoke the data management UI.
+ *
+ * @return A {@link CharSequence} to be used as the label for the transport's data management
+ * affordance. If the transport supplies a data management intent, this
+ * method must not return {@code null}.
+ */
+ @Override
+ public CharSequence dataManagementIntentLabel() throws RemoteException {
+ return getDelegate().dataManagementIntentLabel();
+ }
+
+ /**
+ * Ask the transport where, on local device storage, to keep backup state blobs.
+ * This is per-transport so that mock transports used for testing can coexist with
+ * "live" backup services without interfering with the live bookkeeping. The
+ * returned string should be a name that is expected to be unambiguous among all
+ * available backup transports; the name of the class implementing the transport
+ * is a good choice. This MUST be constant.
+ *
+ * @return A unique name, suitable for use as a file or directory name, that the
+ * Backup Manager could use to disambiguate state files associated with
+ * different backup transports.
+ */
+ @Override
+ public String transportDirName() throws RemoteException {
+ return getDelegate().transportDirName();
+ }
+
+ /**
+ * Verify that this is a suitable time for a backup pass. This should return zero
+ * if a backup is reasonable right now, some positive value otherwise. This method
+ * will be called outside of the {@link #startSession}/{@link #endSession} pair.
+ *
+ * <p>If this is not a suitable time for a backup, the transport should return a
+ * backoff delay, in milliseconds, after which the Backup Manager should try again.
+ *
+ * @return Zero if this is a suitable time for a backup pass, or a positive time delay
+ * in milliseconds to suggest deferring the backup pass for a while.
+ */
+ @Override
+ public long requestBackupTime() throws RemoteException {
+ return getDelegate().requestBackupTime();
+ }
+
+ /**
+ * Initialize the server side storage for this device, erasing all stored data.
+ * The transport may send the request immediately, or may buffer it. After
+ * this is called, {@link #finishBackup} must be called to ensure the request
+ * is sent and received successfully.
+ *
+ * @return One of {@link BackupConstants#TRANSPORT_OK} (OK so far) or
+ * {@link BackupConstants#TRANSPORT_ERROR} (on network error or other failure).
+ */
+ @Override
+ public int initializeDevice() throws RemoteException {
+ return getDelegate().initializeDevice();
+ }
+
+ /**
+ * Send one application's data to the backup destination. The transport may send
+ * the data immediately, or may buffer it. After this is called, {@link #finishBackup}
+ * must be called to ensure the data is sent and recorded successfully.
+ *
+ * @param packageInfo The identity of the application whose data is being backed up.
+ * This specifically includes the signature list for the package.
+ * @param inFd Descriptor of file with data that resulted from invoking the application's
+ * BackupService.doBackup() method. This may be a pipe rather than a file on
+ * persistent media, so it may not be seekable.
+ * @param flags Some of {@link BackupTransport#FLAG_USER_INITIATED}.
+ * @return one of {@link BackupConstants#TRANSPORT_OK} (OK so far),
+ * {@link BackupConstants#TRANSPORT_ERROR} (on network error or other failure), or
+ * {@link BackupConstants#TRANSPORT_NOT_INITIALIZED} (if the backend dataset has
+ * become lost due to inactive expiry or some other reason and needs re-initializing)
+ */
+ @Override
+ public int performBackup(PackageInfo packageInfo,
+ ParcelFileDescriptor inFd, int flags) throws RemoteException {
+ return getDelegate().performBackup(packageInfo, inFd, flags);
+ }
+
+ /**
+ * Erase the give application's data from the backup destination. This clears
+ * out the given package's data from the current backup set, making it as though
+ * the app had never yet been backed up. After this is called, {@link finishBackup}
+ * must be called to ensure that the operation is recorded successfully.
+ *
+ * @return the same error codes as {@link #performBackup}.
+ * @param packageInfo
+ */
+ @Override
+ public int clearBackupData(PackageInfo packageInfo) throws RemoteException {
+ return getDelegate().clearBackupData(packageInfo);
+ }
+
+ /**
+ * Finish sending application data to the backup destination. This must be
+ * called after {@link #performBackup} or {@link clearBackupData} to ensure that
+ * all data is sent. Only when this method returns true can a backup be assumed
+ * to have succeeded.
+ *
+ * @return the same error codes as {@link #performBackup}.
+ */
+ @Override
+ public int finishBackup() throws RemoteException {
+ return getDelegate().finishBackup();
+ }
+
+ /**
+ * Get the set of all backups currently available over this transport.
+ *
+ * @return Descriptions of the set of restore images available for this device,
+ * or null if an error occurred (the attempt should be rescheduled).
+ **/
+ @Override
+ public RestoreSet[] getAvailableRestoreSets() throws RemoteException {
+ return getDelegate().getAvailableRestoreSets();
+ }
+
+ /**
+ * Get the identifying token of the backup set currently being stored from
+ * this device. This is used in the case of applications wishing to restore
+ * their last-known-good data.
+ *
+ * @return A token that can be passed to {@link #startRestore}, or 0 if there
+ * is no backup set available corresponding to the current device state.
+ */
+ @Override
+ public long getCurrentRestoreSet() throws RemoteException {
+ return getDelegate().getCurrentRestoreSet();
+ }
+
+ /**
+ * Start restoring application data from backup. After calling this function,
+ * alternate calls to {@link #nextRestorePackage} and {@link #nextRestoreData}
+ * to walk through the actual application data.
+ *
+ * @param token A backup token as returned by {@link #getAvailableRestoreSets}
+ * or {@link #getCurrentRestoreSet}.
+ * @param packages List of applications to restore (if data is available).
+ * Application data will be restored in the order given.
+ * @return One of {@link BackupConstants#TRANSPORT_OK} (OK so far, call
+ * {@link #nextRestorePackage}) or {@link BackupConstants#TRANSPORT_ERROR}
+ * (an error occurred, the restore should be aborted and rescheduled).
+ */
+ @Override
+ public int startRestore(long token, PackageInfo[] packages) throws RemoteException {
+ return getDelegate().startRestore(token, packages);
+ }
+
+ /**
+ * Get the package name of the next application with data in the backup store, plus
+ * a description of the structure of the restored archive: either TYPE_KEY_VALUE for
+ * an original-API key/value dataset, or TYPE_FULL_STREAM for a tarball-type archive stream.
+ *
+ * <p>If the package name in the returned RestoreDescription object is the singleton
+ * {@link RestoreDescription#NO_MORE_PACKAGES}, it indicates that no further data is available
+ * in the current restore session: all packages described in startRestore() have been
+ * processed.
+ *
+ * <p>If this method returns {@code null}, it means that a transport-level error has
+ * occurred and the entire restore operation should be abandoned.
+ *
+ * @return A RestoreDescription object containing the name of one of the packages
+ * supplied to {@link #startRestore} plus an indicator of the data type of that
+ * restore data; or {@link RestoreDescription#NO_MORE_PACKAGES} to indicate that
+ * no more packages can be restored in this session; or {@code null} to indicate
+ * a transport-level error.
+ */
+ @Override
+ public RestoreDescription nextRestorePackage() throws RemoteException {
+ return getDelegate().nextRestorePackage();
+ }
+
+ /**
+ * Get the data for the application returned by {@link #nextRestorePackage}.
+ *
+ * @param outFd An open, writable file into which the backup data should be stored.
+ * @return the same error codes as {@link #startRestore}.
+ */
+ @Override
+ public int getRestoreData(ParcelFileDescriptor outFd) throws RemoteException {
+ return getDelegate().getRestoreData(outFd);
+ }
+
+ /**
+ * End a restore session (aborting any in-process data transfer as necessary),
+ * freeing any resources and connections used during the restore process.
+ */
+ @Override
+ public void finishRestore() throws RemoteException {
+ getDelegate().finishRestore();
+ }
+
+ @Override
+ public long requestFullBackupTime() throws RemoteException {
+ return getDelegate().requestFullBackupTime();
+ }
+
+ @Override
+ public int performFullBackup(PackageInfo targetPackage,
+ ParcelFileDescriptor socket, int flags) throws RemoteException {
+ return getDelegate().performFullBackup(targetPackage, socket, flags);
+ }
+
+ @Override
+ public int checkFullBackupSize(long size) throws RemoteException {
+ return getDelegate().checkFullBackupSize(size);
+ }
+
+ @Override
+ public int sendBackupData(int numBytes) throws RemoteException {
+ return getDelegate().sendBackupData(numBytes);
+ }
+
+ @Override
+ public void cancelFullBackup() throws RemoteException {
+ getDelegate().cancelFullBackup();
+ }
+
+ /**
+ * Ask the transport whether this app is eligible for backup.
+ *
+ * @param targetPackage The identity of the application.
+ * @param isFullBackup If set, transport should check if app is eligible for full data backup,
+ * otherwise to check if eligible for key-value backup.
+ * @return Whether this app is eligible for backup.
+ */
+ @Override
+ public boolean isAppEligibleForBackup(PackageInfo targetPackage,
+ boolean isFullBackup) throws RemoteException {
+ return getDelegate().isAppEligibleForBackup(targetPackage, isFullBackup);
+ }
+
+ /**
+ * Ask the transport about current quota for backup size of the package.
+ *
+ * @param packageName ID of package to provide the quota.
+ * @param isFullBackup If set, transport should return limit for full data backup, otherwise
+ * for key-value backup.
+ * @return Current limit on full data backup size in bytes.
+ */
+ @Override
+ public long getBackupQuota(String packageName, boolean isFullBackup) throws RemoteException {
+ return getDelegate().getBackupQuota(packageName, isFullBackup);
+ }
+
+ /**
+ * Ask the transport to provide data for the "current" package being restored. This
+ * is the package that was just reported by {@link #nextRestorePackage()} as having
+ * {@link RestoreDescription#TYPE_FULL_STREAM} data.
+ *
+ * The transport writes some data to the socket supplied to this call, and returns
+ * the number of bytes written. The system will then read that many bytes and
+ * stream them to the application's agent for restore, then will call this method again
+ * to receive the next chunk of the archive. This sequence will be repeated until the
+ * transport returns zero indicating that all of the package's data has been delivered
+ * (or returns a negative value indicating some sort of hard error condition at the
+ * transport level).
+ *
+ * <p>After this method returns zero, the system will then call
+ * {@link #getNextFullRestorePackage()} to begin the restore process for the next
+ * application, and the sequence begins again.
+ *
+ * <p>The transport should always close this socket when returning from this method.
+ * Do not cache this socket across multiple calls or you may leak file descriptors.
+ *
+ * @param socket The file descriptor that the transport will use for delivering the
+ * streamed archive. The transport must close this socket in all cases when returning
+ * from this method.
+ * @return 0 when no more data for the current package is available. A positive value
+ * indicates the presence of that many bytes to be delivered to the app. Any negative
+ * return value is treated as equivalent to {@link BackupTransport#TRANSPORT_ERROR},
+ * indicating a fatal error condition that precludes further restore operations
+ * on the current dataset.
+ */
+ @Override
+ public int getNextFullRestoreDataChunk(ParcelFileDescriptor socket) throws RemoteException {
+ return getDelegate().getNextFullRestoreDataChunk(socket);
+ }
+
+ /**
+ * If the OS encounters an error while processing {@link RestoreDescription#TYPE_FULL_STREAM}
+ * data for restore, it will invoke this method to tell the transport that it should
+ * abandon the data download for the current package. The OS will then either call
+ * {@link #nextRestorePackage()} again to move on to restoring the next package in the
+ * set being iterated over, or will call {@link #finishRestore()} to shut down the restore
+ * operation.
+ *
+ * @return {@link #TRANSPORT_OK} if the transport was successful in shutting down the
+ * current stream cleanly, or {@link #TRANSPORT_ERROR} to indicate a serious
+ * transport-level failure. If the transport reports an error here, the entire restore
+ * operation will immediately be finished with no further attempts to restore app data.
+ */
+ @Override
+ public int abortFullRestore() throws RemoteException {
+ return getDelegate().abortFullRestore();
+ }
+
+ /**
+ * Returns flags with additional information about the transport, which is accessible to the
+ * {@link BackupAgent}. This allows the agent to decide what to backup or
+ * restore based on properties of the transport.
+ *
+ * <p>For supported flags see {@link BackupAgent}.
+ */
+ @Override
+ public int getTransportFlags() throws RemoteException {
+ return getDelegate().getTransportFlags();
+ }
+}
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 1643221..80bc1af 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -1,3 +1,60 @@
+java_library {
+ name: "protolog-common",
+ srcs: [
+ "java/com/android/server/protolog/common/**/*.java",
+ ],
+ host_supported: true,
+}
+
+java_library {
+ name: "services.core.wm.protologgroups",
+ srcs: [
+ "java/com/android/server/wm/ProtoLogGroup.java",
+ ],
+ static_libs: ["protolog-common"],
+}
+
+genrule {
+ name: "services.core.protologsrc",
+ srcs: [":services.core.wm.protologgroups", "java/**/*.java"],
+ tools: ["protologtool"],
+ cmd: "$(location protologtool) transform-protolog-calls " +
+ "--protolog-class com.android.server.protolog.common.ProtoLog " +
+ "--protolog-impl-class com.android.server.protolog.ProtoLogImpl " +
+ "--loggroups-class com.android.server.wm.ProtoLogGroup " +
+ "--loggroups-jar $(location :services.core.wm.protologgroups) " +
+ "--output-srcjar $(out) " +
+ "$(locations java/**/*.java)",
+ out: ["services.core.protolog.srcjar"],
+}
+
+genrule {
+ name: "generate-protolog.json",
+ srcs: [":services.core.wm.protologgroups", "java/**/*.java"],
+ tools: ["protologtool"],
+ cmd: "$(location protologtool) generate-viewer-config " +
+ "--protolog-class com.android.server.protolog.common.ProtoLog " +
+ "--loggroups-class com.android.server.wm.ProtoLogGroup " +
+ "--loggroups-jar $(location :services.core.wm.protologgroups) " +
+ "--viewer-conf $(out) " +
+ "$(locations java/**/*.java)",
+ out: ["services.core.protolog.json"],
+}
+
+genrule {
+ name: "checked-protolog.json",
+ srcs: [
+ ":generate-protolog.json",
+ ":services.core.protolog.json",
+ ],
+ cmd: "cp $(location :generate-protolog.json) $(out) && " +
+ "{ diff $(out) $(location :services.core.protolog.json) >/dev/null 2>&1 || " +
+ "{ echo -e '##### ProtoLog viewer config is stale. ### \nRun: \n " +
+ "cp $(location :generate-protolog.json) " +
+ "$(location :services.core.protolog.json)\n' >&2 && false; } }",
+ out: ["services.core.protolog.json"],
+}
+
java_library_static {
name: "services.core.unboosted",
@@ -12,7 +69,7 @@
],
},
srcs: [
- "java/**/*.java",
+ ":services.core.protologsrc",
":dumpstate_aidl",
":idmap2_aidl",
":installd_aidl",
@@ -34,6 +91,7 @@
required: [
"gps_debug.conf",
+ "protolog.conf.json.gz",
],
static_libs: [
@@ -81,3 +139,15 @@
name: "gps_debug.conf",
src: "java/com/android/server/location/gps_debug.conf",
}
+
+genrule {
+ name: "services.core.json.gz",
+ srcs: [":checked-protolog.json"],
+ out: ["services.core.protolog.json.gz"],
+ cmd: "gzip < $(in) > $(out)",
+}
+
+prebuilt_etc {
+ name: "protolog.conf.json.gz",
+ src: ":services.core.json.gz",
+}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index eb2723a..caa4f63 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -947,13 +947,13 @@
}
}
- public void notifyCallState(int state, String phoneNumber) {
+ public void notifyCallStateForAllSubs(int state, String phoneNumber) {
if (!checkNotifyPermission("notifyCallState()")) {
return;
}
if (VDBG) {
- log("notifyCallState: state=" + state + " phoneNumber=" + phoneNumber);
+ log("notifyCallStateForAllSubs: state=" + state + " phoneNumber=" + phoneNumber);
}
synchronized (mRecords) {
@@ -980,13 +980,12 @@
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
}
- public void notifyCallStateForPhoneId(int phoneId, int subId, int state,
- String incomingNumber) {
+ public void notifyCallState(int phoneId, int subId, int state, String incomingNumber) {
if (!checkNotifyPermission("notifyCallState()")) {
return;
}
if (VDBG) {
- log("notifyCallStateForPhoneId: subId=" + subId
+ log("notifyCallState: subId=" + subId
+ " state=" + state + " incomingNumber=" + incomingNumber);
}
synchronized (mRecords) {
@@ -1080,10 +1079,10 @@
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
switch (activationType) {
- case PhoneConstants.SIM_ACTIVATION_TYPE_VOICE:
+ case TelephonyManager.SIM_ACTIVATION_TYPE_VOICE:
mVoiceActivationState[phoneId] = activationState;
break;
- case PhoneConstants.SIM_ACTIVATION_TYPE_DATA:
+ case TelephonyManager.SIM_ACTIVATION_TYPE_DATA:
mDataActivationState[phoneId] = activationState;
break;
default:
@@ -1096,7 +1095,7 @@
+ " state=" + activationState);
}
try {
- if ((activationType == PhoneConstants.SIM_ACTIVATION_TYPE_VOICE) &&
+ if ((activationType == TelephonyManager.SIM_ACTIVATION_TYPE_VOICE) &&
r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_VOICE_ACTIVATION_STATE) &&
idMatch(r.subId, subId, phoneId)) {
@@ -1107,7 +1106,7 @@
}
r.callback.onVoiceActivationStateChanged(activationState);
}
- if ((activationType == PhoneConstants.SIM_ACTIVATION_TYPE_DATA) &&
+ if ((activationType == TelephonyManager.SIM_ACTIVATION_TYPE_DATA) &&
r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DATA_ACTIVATION_STATE) &&
idMatch(r.subId, subId, phoneId)) {
@@ -1227,7 +1226,7 @@
}
public void notifyCellInfoForSubscriber(int subId, List<CellInfo> cellInfo) {
- if (!checkNotifyPermission("notifyCellInfo()")) {
+ if (!checkNotifyPermission("notifyCellInfoForSubscriber()")) {
return;
}
if (VDBG) {
@@ -1244,7 +1243,8 @@
checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
try {
if (DBG_LOC) {
- log("notifyCellInfo: mCellInfo=" + cellInfo + " r=" + r);
+ log("notifyCellInfoForSubscriber: mCellInfo=" + cellInfo
+ + " r=" + r);
}
r.callback.onCellInfoChanged(cellInfo);
} catch (RemoteException ex) {
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index e7569be..08f75e6 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -1749,7 +1749,7 @@
// Once the apps have become associated, if one of them is caller is ephemeral
// the target app should now be able to see the calling app
mAm.grantImplicitAccess(callerApp.userId, service,
- UserHandle.getAppId(callerApp.uid), UserHandle.getAppId(s.appInfo.uid));
+ callerApp.uid, UserHandle.getAppId(s.appInfo.uid));
AppBindRecord b = s.retrieveAppBindingLocked(service, callerApp);
ConnectionRecord c = new ConnectionRecord(b, activity,
@@ -2802,7 +2802,7 @@
mAm.mUgmInternal.grantUriPermissionUncheckedFromIntent(si.neededGrants,
si.getUriPermissionsLocked());
}
- mAm.grantImplicitAccess(r.userId, si.intent, UserHandle.getAppId(si.callingId),
+ mAm.grantImplicitAccess(r.userId, si.intent, si.callingId,
UserHandle.getAppId(r.appInfo.uid)
);
bumpServiceExecutingLocked(r, execInFg, "start");
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 3c7cb88..c07f67b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -6118,9 +6118,9 @@
}
@VisibleForTesting
- public void grantImplicitAccess(int userId, Intent intent, int callingAppId, int targetAppId) {
+ public void grantImplicitAccess(int userId, Intent intent, int callingUid, int targetAppId) {
getPackageManagerInternalLocked().
- grantImplicitAccess(userId, intent, callingAppId, targetAppId);
+ grantImplicitAccess(userId, intent, callingUid, targetAppId);
}
/**
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 2a85c89..123e65e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -8187,15 +8187,20 @@
@Override
public boolean isInstantApp(String packageName, int userId) {
- mPermissionManager.enforceCrossUserPermission(Binder.getCallingUid(), userId,
+ final int callingUid = Binder.getCallingUid();
+ mPermissionManager.enforceCrossUserPermission(callingUid, userId,
true /* requireFullPermission */, false /* checkShell */,
"isInstantApp");
+
+ return isInstantAppInternal(packageName, userId, callingUid);
+ }
+
+ private boolean isInstantAppInternal(String packageName, @UserIdInt int userId,
+ int callingUid) {
if (HIDE_EPHEMERAL_APIS) {
return false;
}
-
synchronized (mLock) {
- int callingUid = Binder.getCallingUid();
if (Process.isIsolated(callingUid)) {
callingUid = mIsolatedOwners.get(callingUid);
}
@@ -23129,19 +23134,20 @@
@Override
public void grantImplicitAccess(int userId, Intent intent,
- int callingAppId, int targetAppId) {
+ int callingUid, int targetAppId) {
synchronized (mLock) {
- final PackageParser.Package callingPackage = getPackage(
- UserHandle.getUid(userId, callingAppId));
- final PackageParser.Package targetPackage = getPackage(
- UserHandle.getUid(userId, targetAppId));
+ final PackageParser.Package callingPackage = getPackage(callingUid);
+ final PackageParser.Package targetPackage =
+ getPackage(UserHandle.getUid(userId, targetAppId));
if (callingPackage == null || targetPackage == null) {
return;
}
- if (isInstantApp(callingPackage.packageName, userId)) {
+ final boolean instantApp = isInstantAppInternal(callingPackage.packageName, userId,
+ callingUid);
+ if (instantApp) {
mInstantAppRegistry.grantInstantAccessLPw(userId, intent,
- callingAppId, targetAppId);
+ UserHandle.getAppId(callingUid), targetAppId);
} else {
mAppsFilter.grantImplicitAccess(
callingPackage.packageName, targetPackage.packageName, userId);
diff --git a/services/core/java/com/android/server/protolog/ProtoLogImpl.java b/services/core/java/com/android/server/protolog/ProtoLogImpl.java
new file mode 100644
index 0000000..239a425
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/ProtoLogImpl.java
@@ -0,0 +1,446 @@
+/*
+ * Copyright (C) 2019 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.server.protolog;
+
+import static com.android.server.protolog.ProtoLogFileProto.LOG;
+import static com.android.server.protolog.ProtoLogFileProto.MAGIC_NUMBER;
+import static com.android.server.protolog.ProtoLogFileProto.MAGIC_NUMBER_H;
+import static com.android.server.protolog.ProtoLogFileProto.MAGIC_NUMBER_L;
+import static com.android.server.protolog.ProtoLogFileProto.REAL_TIME_TO_ELAPSED_TIME_OFFSET_MILLIS;
+import static com.android.server.protolog.ProtoLogFileProto.VERSION;
+import static com.android.server.protolog.ProtoLogMessage.BOOLEAN_PARAMS;
+import static com.android.server.protolog.ProtoLogMessage.DOUBLE_PARAMS;
+import static com.android.server.protolog.ProtoLogMessage.ELAPSED_REALTIME_NANOS;
+import static com.android.server.protolog.ProtoLogMessage.MESSAGE_HASH;
+import static com.android.server.protolog.ProtoLogMessage.SINT64_PARAMS;
+import static com.android.server.protolog.ProtoLogMessage.STR_PARAMS;
+
+import android.annotation.Nullable;
+import android.os.ShellCommand;
+import android.os.SystemClock;
+import android.util.Slog;
+import android.util.proto.ProtoOutputStream;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.protolog.common.IProtoLogGroup;
+import com.android.server.protolog.common.LogDataType;
+import com.android.server.utils.TraceBuffer;
+import com.android.server.wm.ProtoLogGroup;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.IllegalFormatConversionException;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
+
+
+/**
+ * A service for the ProtoLog logging system.
+ */
+public class ProtoLogImpl {
+ private static final TreeMap<String, IProtoLogGroup> LOG_GROUPS = new TreeMap<>();
+
+ private static void addLogGroupEnum(IProtoLogGroup[] config) {
+ Arrays.stream(config).forEach(group -> LOG_GROUPS.put(group.name(), group));
+ }
+
+ static {
+ addLogGroupEnum(ProtoLogGroup.values());
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void d(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance()
+ .log(LogLevel.DEBUG, group, messageHash, paramsMask, messageString, args);
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void v(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance().log(LogLevel.VERBOSE, group, messageHash, paramsMask, messageString,
+ args);
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void i(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance().log(LogLevel.INFO, group, messageHash, paramsMask, messageString, args);
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void w(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance().log(LogLevel.WARN, group, messageHash, paramsMask, messageString, args);
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void e(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance()
+ .log(LogLevel.ERROR, group, messageHash, paramsMask, messageString, args);
+ }
+
+ /** Used by the ProtoLogTool, do not call directly - use {@code ProtoLog} class instead. */
+ public static void wtf(IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString,
+ Object... args) {
+ getSingleInstance().log(LogLevel.WTF, group, messageHash, paramsMask, messageString, args);
+ }
+
+ private static final int BUFFER_CAPACITY = 1024 * 1024;
+ private static final String LOG_FILENAME = "/data/misc/wmtrace/wm_log.pb";
+ private static final String VIEWER_CONFIG_FILENAME = "/system/etc/protolog.conf.json.gz";
+ private static final String TAG = "ProtoLog";
+ private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L;
+ static final String PROTOLOG_VERSION = "1.0.0";
+
+ private final File mLogFile;
+ private final TraceBuffer mBuffer;
+ private final ProtoLogViewerConfigReader mViewerConfig;
+
+ private boolean mProtoLogEnabled;
+ private boolean mProtoLogEnabledLockFree;
+ private final Object mProtoLogEnabledLock = new Object();
+
+ private static ProtoLogImpl sServiceInstance = null;
+
+ /**
+ * Returns the single instance of the ProtoLogImpl singleton class.
+ */
+ public static synchronized ProtoLogImpl getSingleInstance() {
+ if (sServiceInstance == null) {
+ sServiceInstance = new ProtoLogImpl(new File(LOG_FILENAME), BUFFER_CAPACITY,
+ new ProtoLogViewerConfigReader());
+ }
+ return sServiceInstance;
+ }
+
+ @VisibleForTesting
+ public static synchronized void setSingleInstance(@Nullable ProtoLogImpl instance) {
+ sServiceInstance = instance;
+ }
+
+ @VisibleForTesting
+ public enum LogLevel {
+ DEBUG, VERBOSE, INFO, WARN, ERROR, WTF
+ }
+
+ /**
+ * Main log method, do not call directly.
+ */
+ @VisibleForTesting
+ public void log(LogLevel level, IProtoLogGroup group, int messageHash, int paramsMask,
+ @Nullable String messageString, Object[] args) {
+ if (group.isLogToProto()) {
+ logToProto(messageHash, paramsMask, args);
+ }
+ if (group.isLogToLogcat()) {
+ logToLogcat(group.getTag(), level, messageHash, messageString, args);
+ }
+ }
+
+ private void logToLogcat(String tag, LogLevel level, int messageHash,
+ @Nullable String messageString, Object[] args) {
+ String message = null;
+ if (messageString == null) {
+ messageString = mViewerConfig.getViewerString(messageHash);
+ }
+ if (messageString != null) {
+ try {
+ message = String.format(messageString, args);
+ } catch (IllegalFormatConversionException ex) {
+ Slog.w(TAG, "Invalid ProtoLog format string.", ex);
+ }
+ }
+ if (message == null) {
+ StringBuilder builder = new StringBuilder("UNKNOWN MESSAGE (" + messageHash + ")");
+ for (Object o : args) {
+ builder.append(" ").append(o);
+ }
+ message = builder.toString();
+ }
+ passToLogcat(tag, level, message);
+ }
+
+ /**
+ * SLog wrapper.
+ */
+ @VisibleForTesting
+ public void passToLogcat(String tag, LogLevel level, String message) {
+ switch (level) {
+ case DEBUG:
+ Slog.d(tag, message);
+ break;
+ case VERBOSE:
+ Slog.v(tag, message);
+ break;
+ case INFO:
+ Slog.i(tag, message);
+ break;
+ case WARN:
+ Slog.w(tag, message);
+ break;
+ case ERROR:
+ Slog.e(tag, message);
+ break;
+ case WTF:
+ Slog.wtf(tag, message);
+ break;
+ }
+ }
+
+ private void logToProto(int messageHash, int paramsMask, Object[] args) {
+ if (!isProtoEnabled()) {
+ return;
+ }
+ try {
+ ProtoOutputStream os = new ProtoOutputStream();
+ long token = os.start(LOG);
+ os.write(MESSAGE_HASH, messageHash);
+ os.write(ELAPSED_REALTIME_NANOS, SystemClock.elapsedRealtimeNanos());
+
+ int argIndex = 0;
+ ArrayList<Long> longParams = new ArrayList<>();
+ ArrayList<Double> doubleParams = new ArrayList<>();
+ ArrayList<Boolean> booleanParams = new ArrayList<>();
+ for (Object o : args) {
+ int type = LogDataType.bitmaskToLogDataType(paramsMask, argIndex);
+ try {
+ switch (type) {
+ case LogDataType.STRING:
+ os.write(STR_PARAMS, o.toString());
+ break;
+ case LogDataType.LONG:
+ longParams.add(((Number) o).longValue());
+ break;
+ case LogDataType.DOUBLE:
+ doubleParams.add(((Number) o).doubleValue());
+ break;
+ case LogDataType.BOOLEAN:
+ booleanParams.add((boolean) o);
+ break;
+ }
+ } catch (ClassCastException ex) {
+ // Should not happen unless there is an error in the ProtoLogTool.
+ os.write(STR_PARAMS, "(INVALID PARAMS_MASK) " + o.toString());
+ Slog.e(TAG, "Invalid ProtoLog paramsMask", ex);
+ }
+ argIndex++;
+ }
+ if (longParams.size() > 0) {
+ os.writePackedSInt64(SINT64_PARAMS,
+ longParams.stream().mapToLong(i -> i).toArray());
+ }
+ if (doubleParams.size() > 0) {
+ os.writePackedDouble(DOUBLE_PARAMS,
+ doubleParams.stream().mapToDouble(i -> i).toArray());
+ }
+ if (booleanParams.size() > 0) {
+ boolean[] arr = new boolean[booleanParams.size()];
+ for (int i = 0; i < booleanParams.size(); i++) {
+ arr[i] = booleanParams.get(i);
+ }
+ os.writePackedBool(BOOLEAN_PARAMS, arr);
+ }
+ os.end(token);
+ mBuffer.add(os);
+ } catch (Exception e) {
+ Slog.e(TAG, "Exception while logging to proto", e);
+ }
+ }
+
+
+ @VisibleForTesting
+ ProtoLogImpl(File file, int bufferCapacity, ProtoLogViewerConfigReader viewerConfig) {
+ mLogFile = file;
+ mBuffer = new TraceBuffer(bufferCapacity);
+ mViewerConfig = viewerConfig;
+ }
+
+ /**
+ * Starts the logging a circular proto buffer.
+ *
+ * @param pw Print writer
+ */
+ public void startProtoLog(@Nullable PrintWriter pw) {
+ if (isProtoEnabled()) {
+ return;
+ }
+ synchronized (mProtoLogEnabledLock) {
+ logAndPrintln(pw, "Start logging to " + mLogFile + ".");
+ mBuffer.resetBuffer();
+ mProtoLogEnabled = true;
+ mProtoLogEnabledLockFree = true;
+ }
+ }
+
+ /**
+ * Stops logging to proto.
+ *
+ * @param pw Print writer
+ * @param writeToFile If the current buffer should be written to disk or not
+ */
+ public void stopProtoLog(@Nullable PrintWriter pw, boolean writeToFile) {
+ if (!isProtoEnabled()) {
+ return;
+ }
+ synchronized (mProtoLogEnabledLock) {
+ logAndPrintln(pw, "Stop logging to " + mLogFile + ". Waiting for log to flush.");
+ mProtoLogEnabled = mProtoLogEnabledLockFree = false;
+ if (writeToFile) {
+ writeProtoLogToFileLocked();
+ logAndPrintln(pw, "Log written to " + mLogFile + ".");
+ }
+ if (mProtoLogEnabled) {
+ logAndPrintln(pw, "ERROR: logging was re-enabled while waiting for flush.");
+ throw new IllegalStateException("logging enabled while waiting for flush.");
+ }
+ }
+ }
+
+ /**
+ * Returns {@code true} iff logging to proto is enabled.
+ */
+ public boolean isProtoEnabled() {
+ return mProtoLogEnabledLockFree;
+ }
+
+ private int setLogging(ShellCommand shell, boolean setTextLogging, boolean value) {
+ String group;
+ while ((group = shell.getNextArg()) != null) {
+ IProtoLogGroup g = LOG_GROUPS.get(group);
+ if (g != null) {
+ if (setTextLogging) {
+ g.setLogToLogcat(value);
+ } else {
+ g.setLogToProto(value);
+ }
+ } else {
+ logAndPrintln(shell.getOutPrintWriter(), "No IProtoLogGroup named " + group);
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ private int unknownCommand(PrintWriter pw) {
+ pw.println("Unknown command");
+ pw.println("Window manager logging options:");
+ pw.println(" start: Start proto logging");
+ pw.println(" stop: Stop proto logging");
+ pw.println(" enable [group...]: Enable proto logging for given groups");
+ pw.println(" disable [group...]: Disable proto logging for given groups");
+ pw.println(" enable-text [group...]: Enable logcat logging for given groups");
+ pw.println(" disable-text [group...]: Disable logcat logging for given groups");
+ return -1;
+ }
+
+ /**
+ * Responds to a shell command.
+ */
+ public int onShellCommand(ShellCommand shell) {
+ PrintWriter pw = shell.getOutPrintWriter();
+ String cmd = shell.getNextArg();
+ if (cmd == null) {
+ return unknownCommand(pw);
+ }
+ switch (cmd) {
+ case "start":
+ startProtoLog(pw);
+ return 0;
+ case "stop":
+ stopProtoLog(pw, true);
+ return 0;
+ case "status":
+ logAndPrintln(pw, getStatus());
+ return 0;
+ case "enable":
+ return setLogging(shell, false, true);
+ case "enable-text":
+ mViewerConfig.loadViewerConfig(pw, VIEWER_CONFIG_FILENAME);
+ return setLogging(shell, true, true);
+ case "disable":
+ return setLogging(shell, false, false);
+ case "disable-text":
+ return setLogging(shell, true, false);
+ default:
+ return unknownCommand(pw);
+ }
+ }
+
+ /**
+ * Returns a human-readable ProtoLog status text.
+ */
+ public String getStatus() {
+ return "ProtoLog status: "
+ + ((isProtoEnabled()) ? "Enabled" : "Disabled")
+ + "\nEnabled log groups: \n Proto: "
+ + LOG_GROUPS.values().stream().filter(
+ it -> it.isEnabled() && it.isLogToProto())
+ .map(IProtoLogGroup::name).collect(Collectors.joining(" "))
+ + "\n Logcat: "
+ + LOG_GROUPS.values().stream().filter(
+ it -> it.isEnabled() && it.isLogToLogcat())
+ .map(IProtoLogGroup::name).collect(Collectors.joining(" "))
+ + "\nLogging definitions loaded: " + mViewerConfig.knownViewerStringsNumber();
+ }
+
+ /**
+ * Writes the log buffer to a new file for the bugreport.
+ *
+ * This method is synchronized with {@code #startProtoLog(PrintWriter)} and
+ * {@link #stopProtoLog(PrintWriter, boolean)}.
+ */
+ public void writeProtoLogToFile() {
+ synchronized (mProtoLogEnabledLock) {
+ writeProtoLogToFileLocked();
+ }
+ }
+
+ private void writeProtoLogToFileLocked() {
+ try {
+ long offset =
+ (System.currentTimeMillis() - (SystemClock.elapsedRealtimeNanos() / 1000000));
+ ProtoOutputStream proto = new ProtoOutputStream();
+ proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
+ proto.write(VERSION, PROTOLOG_VERSION);
+ proto.write(REAL_TIME_TO_ELAPSED_TIME_OFFSET_MILLIS, offset);
+ mBuffer.writeTraceToFile(mLogFile, proto);
+ } catch (IOException e) {
+ Slog.e(TAG, "Unable to write buffer to file", e);
+ }
+ }
+
+
+ static void logAndPrintln(@Nullable PrintWriter pw, String msg) {
+ Slog.i(TAG, msg);
+ if (pw != null) {
+ pw.println(msg);
+ pw.flush();
+ }
+ }
+}
+
diff --git a/services/core/java/com/android/server/protolog/ProtoLogViewerConfigReader.java b/services/core/java/com/android/server/protolog/ProtoLogViewerConfigReader.java
new file mode 100644
index 0000000..4944217
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/ProtoLogViewerConfigReader.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2019 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.server.protolog;
+
+import static com.android.server.protolog.ProtoLogImpl.logAndPrintln;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.zip.GZIPInputStream;
+
+/**
+ * Handles loading and parsing of ProtoLog viewer configuration.
+ */
+public class ProtoLogViewerConfigReader {
+ private Map<Integer, String> mLogMessageMap = null;
+
+ /** Returns message format string for its hash or null if unavailable. */
+ public synchronized String getViewerString(int messageHash) {
+ if (mLogMessageMap != null) {
+ return mLogMessageMap.get(messageHash);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads the specified viewer configuration file. Does nothing if the config is already loaded.
+ */
+ public synchronized void loadViewerConfig(PrintWriter pw, String viewerConfigFilename) {
+ if (mLogMessageMap != null) {
+ return;
+ }
+ try {
+ InputStreamReader config = new InputStreamReader(
+ new GZIPInputStream(new FileInputStream(viewerConfigFilename)));
+ BufferedReader reader = new BufferedReader(config);
+ StringBuilder builder = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line).append('\n');
+ }
+ reader.close();
+ JSONObject json = new JSONObject(builder.toString());
+ JSONObject messages = json.getJSONObject("messages");
+
+ mLogMessageMap = new TreeMap<>();
+ Iterator it = messages.keys();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ try {
+ int hash = Integer.parseInt(key);
+ JSONObject val = messages.getJSONObject(key);
+ String msg = val.getString("message");
+ mLogMessageMap.put(hash, msg);
+ } catch (NumberFormatException expected) {
+ // Not a messageHash - skip it
+ }
+ }
+ logAndPrintln(pw, "Loaded " + mLogMessageMap.size() + " log definitions from "
+ + viewerConfigFilename);
+ } catch (FileNotFoundException e) {
+ logAndPrintln(pw, "Unable to load log definitions: File "
+ + viewerConfigFilename + " not found." + e);
+ } catch (IOException e) {
+ logAndPrintln(pw, "Unable to load log definitions: IOException while reading "
+ + viewerConfigFilename + ". " + e);
+ } catch (JSONException e) {
+ logAndPrintln(pw,
+ "Unable to load log definitions: JSON parsing exception while reading "
+ + viewerConfigFilename + ". " + e);
+ }
+ }
+
+ /**
+ * Returns the number of loaded log definitions kept in memory.
+ */
+ public synchronized int knownViewerStringsNumber() {
+ if (mLogMessageMap != null) {
+ return mLogMessageMap.size();
+ }
+ return 0;
+ }
+}
diff --git a/services/core/java/com/android/server/protolog/common/BitmaskConversionException.java b/services/core/java/com/android/server/protolog/common/BitmaskConversionException.java
new file mode 100644
index 0000000..7bb27b2
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/common/BitmaskConversionException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+/**
+ * Error while converting a bitmask representing a list of LogDataTypes.
+ */
+public class BitmaskConversionException extends RuntimeException {
+ BitmaskConversionException(String msg) {
+ super(msg);
+ }
+}
diff --git a/services/core/java/com/android/server/protolog/common/IProtoLogGroup.java b/services/core/java/com/android/server/protolog/common/IProtoLogGroup.java
new file mode 100644
index 0000000..2c65341
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/common/IProtoLogGroup.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+/**
+ * Defines a log group configuration object for ProtoLog. Should be implemented as en enum.
+ */
+public interface IProtoLogGroup {
+ /**
+ * if false all log statements for this group are excluded from compilation,
+ */
+ boolean isEnabled();
+
+ /**
+ * is binary logging enabled for the group.
+ */
+ boolean isLogToProto();
+
+ /**
+ * is text logging enabled for the group.
+ */
+ boolean isLogToLogcat();
+
+ /**
+ * returns true is any logging is enabled for this group.
+ */
+ default boolean isLogToAny() {
+ return isLogToLogcat() || isLogToProto();
+ }
+
+ /**
+ * returns the name of the source of the logged message
+ */
+ String getTag();
+
+ /**
+ * set binary logging for this group.
+ */
+ void setLogToProto(boolean logToProto);
+
+ /**
+ * set text logging for this group.
+ */
+ void setLogToLogcat(boolean logToLogcat);
+
+ /**
+ * returns name of the logging group.
+ */
+ String name();
+}
diff --git a/services/core/java/com/android/server/protolog/common/InvalidFormatStringException.java b/services/core/java/com/android/server/protolog/common/InvalidFormatStringException.java
new file mode 100644
index 0000000..947bf98
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/common/InvalidFormatStringException.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+/**
+ * Unsupported/invalid message format string error.
+ */
+public class InvalidFormatStringException extends RuntimeException {
+ public InvalidFormatStringException(String message) {
+ super(message);
+ }
+
+ public InvalidFormatStringException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/services/core/java/com/android/server/protolog/common/LogDataType.java b/services/core/java/com/android/server/protolog/common/LogDataType.java
new file mode 100644
index 0000000..e73b41a
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/common/LogDataType.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a type of logged data encoded in the proto.
+ */
+public class LogDataType {
+ // When updating this list make sure to update bitmask conversion methods accordingly.
+ // STR type should be the first in the enum in order to be the default type.
+ public static final int STRING = 0b00;
+ public static final int LONG = 0b01;
+ public static final int DOUBLE = 0b10;
+ public static final int BOOLEAN = 0b11;
+
+ private static final int TYPE_WIDTH = 2;
+ private static final int TYPE_MASK = 0b11;
+
+ /**
+ * Creates a bitmask representing a list of data types.
+ */
+ public static int logDataTypesToBitMask(List<Integer> types) {
+ if (types.size() > 16) {
+ throw new BitmaskConversionException("Too many log call parameters "
+ + "- max 16 parameters supported");
+ }
+ int mask = 0;
+ for (int i = 0; i < types.size(); i++) {
+ int x = types.get(i);
+ mask = mask | (x << (i * TYPE_WIDTH));
+ }
+ return mask;
+ }
+
+ /**
+ * Decodes a bitmask to a list of LogDataTypes of provided length.
+ */
+ public static int bitmaskToLogDataType(int bitmask, int index) {
+ if (index > 16) {
+ throw new BitmaskConversionException("Max 16 parameters allowed");
+ }
+ return (bitmask >> (index * TYPE_WIDTH)) & TYPE_MASK;
+ }
+
+ /**
+ * Creates a list of LogDataTypes from a message format string.
+ */
+ public static List<Integer> parseFormatString(String messageString) {
+ ArrayList<Integer> types = new ArrayList<>();
+ for (int i = 0; i < messageString.length(); ) {
+ if (messageString.charAt(i) == '%') {
+ if (i + 1 >= messageString.length()) {
+ throw new InvalidFormatStringException("Invalid format string in config");
+ }
+ switch (messageString.charAt(i + 1)) {
+ case 'b':
+ types.add(LogDataType.BOOLEAN);
+ break;
+ case 'd':
+ case 'o':
+ case 'x':
+ types.add(LogDataType.LONG);
+ break;
+ case 'f':
+ case 'e':
+ case 'g':
+ types.add(LogDataType.DOUBLE);
+ break;
+ case 's':
+ types.add(LogDataType.STRING);
+ break;
+ case '%':
+ break;
+ default:
+ throw new InvalidFormatStringException("Invalid format string field"
+ + " %${messageString[i + 1]}");
+ }
+ i += 2;
+ } else {
+ i += 1;
+ }
+ }
+ return types;
+ }
+}
diff --git a/services/core/java/com/android/server/protolog/common/ProtoLog.java b/services/core/java/com/android/server/protolog/common/ProtoLog.java
new file mode 100644
index 0000000..b631bcb
--- /dev/null
+++ b/services/core/java/com/android/server/protolog/common/ProtoLog.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+/**
+ * ProtoLog API - exposes static logging methods. Usage of this API is similar
+ * to {@code android.utils.Log} class. Instead of plain text log messages each call consists of
+ * a messageString, which is a format string for the log message (has to be a string literal or
+ * a concatenation of string literals) and a vararg array of parameters for the formatter.
+ *
+ * The syntax for the message string is a subset of {@code java.util.Formatter} syntax.
+ * Supported conversions:
+ * %b - boolean
+ * %d, %o and %x - integral type (Short, Integer or Long)
+ * %f, %e and %g - floating point type (Float or Double)
+ * %s - string
+ * %% - a literal percent character
+ * The width and precision modifiers are supported, argument_index and flags are not.
+ *
+ * Methods in this class are stubs, that are replaced by optimised versions by the ProtoLogTool
+ * during build.
+ */
+public class ProtoLog {
+ /**
+ * DEBUG level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void d(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+
+ /**
+ * VERBOSE level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void v(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+
+ /**
+ * INFO level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void i(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+
+ /**
+ * WARNING level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void w(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+
+ /**
+ * ERROR level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void e(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+
+ /**
+ * WHAT A TERRIBLE FAILURE level log.
+ *
+ * @param group {@code IProtoLogGroup} controlling this log call.
+ * @param messageString constant format string for the logged message.
+ * @param args parameters to be used with the format string.
+ */
+ public static void wtf(IProtoLogGroup group, String messageString, Object... args) {
+ // Stub, replaced by the ProtoLogTool.
+ throw new UnsupportedOperationException(
+ "ProtoLog calls MUST be processed with ProtoLogTool");
+ }
+}
diff --git a/services/core/java/com/android/server/utils/TraceBuffer.java b/services/core/java/com/android/server/utils/TraceBuffer.java
new file mode 100644
index 0000000..0567960
--- /dev/null
+++ b/services/core/java/com/android/server/utils/TraceBuffer.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2019 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.server.utils;
+
+import android.util.proto.ProtoOutputStream;
+
+import com.android.internal.annotations.VisibleForTesting;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Queue;
+
+/**
+ * Buffer used for tracing and logging.
+ */
+public class TraceBuffer {
+ private final Object mBufferLock = new Object();
+
+ private final Queue<ProtoOutputStream> mBuffer = new ArrayDeque<>();
+ private int mBufferUsedSize;
+ private int mBufferCapacity;
+
+ public TraceBuffer(int bufferCapacity) {
+ mBufferCapacity = bufferCapacity;
+ resetBuffer();
+ }
+
+ public int getAvailableSpace() {
+ return mBufferCapacity - mBufferUsedSize;
+ }
+
+ /**
+ * Returns buffer size.
+ */
+ public int size() {
+ return mBuffer.size();
+ }
+
+ public void setCapacity(int capacity) {
+ mBufferCapacity = capacity;
+ }
+
+ /**
+ * Inserts the specified element into this buffer.
+ *
+ * @param proto the element to add
+ * @throws IllegalStateException if the element cannot be added because it is larger
+ * than the buffer size.
+ */
+ public void add(ProtoOutputStream proto) {
+ int protoLength = proto.getRawSize();
+ if (protoLength > mBufferCapacity) {
+ throw new IllegalStateException("Trace object too large for the buffer. Buffer size:"
+ + mBufferCapacity + " Object size: " + protoLength);
+ }
+ synchronized (mBufferLock) {
+ discardOldest(protoLength);
+ mBuffer.add(proto);
+ mBufferUsedSize += protoLength;
+ mBufferLock.notify();
+ }
+ }
+
+ boolean contains(byte[] other) {
+ return mBuffer.stream()
+ .anyMatch(p -> Arrays.equals(p.getBytes(), other));
+ }
+
+ /**
+ * Writes the trace buffer to disk inside the encapsulatingProto..
+ */
+ public void writeTraceToFile(File traceFile, ProtoOutputStream encapsulatingProto)
+ throws IOException {
+ synchronized (mBufferLock) {
+ traceFile.delete();
+ try (OutputStream os = new FileOutputStream(traceFile)) {
+ traceFile.setReadable(true /* readable */, false /* ownerOnly */);
+ os.write(encapsulatingProto.getBytes());
+ for (ProtoOutputStream protoOutputStream : mBuffer) {
+ encapsulatingProto = protoOutputStream;
+ byte[] protoBytes = encapsulatingProto.getBytes();
+ os.write(protoBytes);
+ }
+ os.flush();
+ }
+ }
+ }
+
+ /**
+ * Checks if the element can be added to the buffer. The element is already certain to be
+ * smaller than the overall buffer size.
+ *
+ * @param protoLength byte array representation of the Proto object to add
+ */
+ private void discardOldest(int protoLength) {
+ long availableSpace = getAvailableSpace();
+
+ while (availableSpace < protoLength) {
+
+ ProtoOutputStream item = mBuffer.poll();
+ if (item == null) {
+ throw new IllegalStateException("No element to discard from buffer");
+ }
+ mBufferUsedSize -= item.getRawSize();
+ availableSpace = getAvailableSpace();
+ }
+ }
+
+ /**
+ * Removes all elements form the buffer
+ */
+ public void resetBuffer() {
+ synchronized (mBufferLock) {
+ mBuffer.clear();
+ mBufferUsedSize = 0;
+ }
+ }
+
+ @VisibleForTesting
+ int getBufferSize() {
+ return mBufferUsedSize;
+ }
+
+ /**
+ * Returns the buffer status in human-readable form.
+ */
+ public String getStatus() {
+ synchronized (mBufferLock) {
+ return "Buffer size: "
+ + mBufferCapacity
+ + " bytes"
+ + "\n"
+ + "Buffer usage: "
+ + mBufferUsedSize
+ + " bytes"
+ + "\n"
+ + "Elements in the buffer: "
+ + mBuffer.size();
+ }
+ }
+}
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 47be792..dbf06a5 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1552,7 +1552,7 @@
mIntent, mStartActivity.getUriPermissionsLocked(), mStartActivity.mUserId);
mService.getPackageManagerInternalLocked().grantImplicitAccess(
mStartActivity.mUserId, mIntent,
- UserHandle.getAppId(mCallingUid),
+ mCallingUid,
UserHandle.getAppId(mStartActivity.info.applicationInfo.uid)
);
if (newTask) {
diff --git a/services/core/java/com/android/server/wm/ProtoLogGroup.java b/services/core/java/com/android/server/wm/ProtoLogGroup.java
new file mode 100644
index 0000000..313cceb
--- /dev/null
+++ b/services/core/java/com/android/server/wm/ProtoLogGroup.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2019 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.server.wm;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.protolog.common.IProtoLogGroup;
+import com.android.server.protolog.common.ProtoLog;
+
+/**
+ * Defines logging groups for ProtoLog.
+ *
+ * This file is used by the ProtoLogTool to generate optimized logging code. All of its dependencies
+ * must be included in services.core.wm.protologgroups build target.
+ */
+public enum ProtoLogGroup implements IProtoLogGroup {
+ GENERIC_WM(true, true, false, "WindowManager"),
+
+ TEST_GROUP(true, true, false, "WindowManagetProtoLogTest");
+
+ private final boolean mEnabled;
+ private volatile boolean mLogToProto;
+ private volatile boolean mLogToLogcat;
+ private final String mTag;
+
+ /**
+ * @param enabled set to false to exclude all log statements for this group from
+ * compilation,
+ * they will not be available in runtime.
+ * @param logToProto enable binary logging for the group
+ * @param logToLogcat enable text logging for the group
+ * @param tag name of the source of the logged message
+ */
+ ProtoLogGroup(boolean enabled, boolean logToProto, boolean logToLogcat, String tag) {
+ this.mEnabled = enabled;
+ this.mLogToProto = logToProto;
+ this.mLogToLogcat = logToLogcat;
+ this.mTag = tag;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mEnabled;
+ }
+
+ @Override
+ public boolean isLogToProto() {
+ return mLogToProto;
+ }
+
+ @Override
+ public boolean isLogToLogcat() {
+ return mLogToLogcat;
+ }
+
+ @Override
+ public boolean isLogToAny() {
+ return mLogToLogcat || mLogToProto;
+ }
+
+ @Override
+ public String getTag() {
+ return mTag;
+ }
+
+ @Override
+ public void setLogToProto(boolean logToProto) {
+ this.mLogToProto = logToProto;
+ }
+
+ @Override
+ public void setLogToLogcat(boolean logToLogcat) {
+ this.mLogToLogcat = logToLogcat;
+ }
+
+ /**
+ * Test function for automated integration tests. Can be also called manually from adb shell.
+ */
+ @VisibleForTesting
+ public static void testProtoLog() {
+ ProtoLog.e(ProtoLogGroup.TEST_GROUP,
+ "Test completed successfully: %b %d %o %x %e %g %f %% %s.",
+ true, 1, 2, 3, 0.4, 0.5, 0.6, "ok");
+ }
+}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index d2d6902..8b227a6 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -266,6 +266,7 @@
import com.android.server.policy.WindowManagerPolicy;
import com.android.server.policy.WindowManagerPolicy.ScreenOffListener;
import com.android.server.power.ShutdownThread;
+import com.android.server.protolog.ProtoLogImpl;
import com.android.server.utils.PriorityDump;
import java.io.BufferedWriter;
@@ -5822,6 +5823,11 @@
pw.print(mWindowTracing.getStatus() + "\n");
}
+ private void dumpLogStatus(PrintWriter pw) {
+ pw.println("WINDOW MANAGER LOGGING (dumpsys window logging)");
+ pw.println(ProtoLogImpl.getSingleInstance().getStatus());
+ }
+
private void dumpSessionsLocked(PrintWriter pw, boolean dumpAll) {
pw.println("WINDOW MANAGER SESSIONS (dumpsys window sessions)");
for (int i=0; i<mSessions.size(); i++) {
@@ -6217,6 +6223,9 @@
} else if ("trace".equals(cmd)) {
dumpTraceStatus(pw);
return;
+ } else if ("logging".equals(cmd)) {
+ dumpLogStatus(pw);
+ return;
} else if ("refresh".equals(cmd)) {
dumpHighRefreshRateBlacklist(pw);
return;
@@ -6278,6 +6287,10 @@
if (dumpAll) {
pw.println(separator);
}
+ dumpLogStatus(pw);
+ if (dumpAll) {
+ pw.println(separator);
+ }
dumpHighRefreshRateBlacklist(pw);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
index 7384bb7..e01cbf2 100644
--- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
+++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
@@ -28,6 +28,8 @@
import android.view.IWindowManager;
import android.view.Surface;
+import com.android.server.protolog.ProtoLogImpl;
+
import java.io.PrintWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -75,6 +77,8 @@
// the output trace file, so the shell gets the correct semantics for where
// trace files can be written.
return mInternal.mWindowTracing.onShellCommand(this);
+ case "logging":
+ return ProtoLogImpl.getSingleInstance().onShellCommand(this);
case "set-user-rotation":
return runSetDisplayUserRotation(pw);
case "set-fix-to-user-rotation":
@@ -389,6 +393,8 @@
if (!IS_USER) {
pw.println(" tracing (start | stop)");
pw.println(" Start or stop window tracing.");
+ pw.println(" logging (start | stop | enable | disable | enable-text | disable-text)");
+ pw.println(" Logging settings.");
}
}
}
diff --git a/services/core/java/com/android/server/wm/WindowTraceBuffer.java b/services/core/java/com/android/server/wm/WindowTraceBuffer.java
deleted file mode 100644
index 8c65884..0000000
--- a/services/core/java/com/android/server/wm/WindowTraceBuffer.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2019 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.server.wm;
-
-import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER;
-import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER_H;
-import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER_L;
-
-import android.util.proto.ProtoOutputStream;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.Queue;
-
-/**
- * Buffer used for window tracing.
- */
-class WindowTraceBuffer {
- private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L;
-
- private final Object mBufferLock = new Object();
-
- private final Queue<ProtoOutputStream> mBuffer = new ArrayDeque<>();
- private int mBufferUsedSize;
- private int mBufferCapacity;
-
- WindowTraceBuffer(int bufferCapacity) {
- mBufferCapacity = bufferCapacity;
- resetBuffer();
- }
-
- int getAvailableSpace() {
- return mBufferCapacity - mBufferUsedSize;
- }
-
- int size() {
- return mBuffer.size();
- }
-
- void setCapacity(int capacity) {
- mBufferCapacity = capacity;
- }
-
- /**
- * Inserts the specified element into this buffer.
- *
- * @param proto the element to add
- * @throws IllegalStateException if the element cannot be added because it is larger
- * than the buffer size.
- */
- void add(ProtoOutputStream proto) {
- int protoLength = proto.getRawSize();
- if (protoLength > mBufferCapacity) {
- throw new IllegalStateException("Trace object too large for the buffer. Buffer size:"
- + mBufferCapacity + " Object size: " + protoLength);
- }
- synchronized (mBufferLock) {
- discardOldest(protoLength);
- mBuffer.add(proto);
- mBufferUsedSize += protoLength;
- mBufferLock.notify();
- }
- }
-
- boolean contains(byte[] other) {
- return mBuffer.stream()
- .anyMatch(p -> Arrays.equals(p.getBytes(), other));
- }
-
- /**
- * Writes the trace buffer to disk.
- */
- void writeTraceToFile(File traceFile) throws IOException {
- synchronized (mBufferLock) {
- traceFile.delete();
- try (OutputStream os = new FileOutputStream(traceFile)) {
- traceFile.setReadable(true /* readable */, false /* ownerOnly */);
- ProtoOutputStream proto = new ProtoOutputStream();
- proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
- os.write(proto.getBytes());
- for (ProtoOutputStream protoOutputStream : mBuffer) {
- proto = protoOutputStream;
- byte[] protoBytes = proto.getBytes();
- os.write(protoBytes);
- }
- os.flush();
- }
- }
- }
-
- /**
- * Checks if the element can be added to the buffer. The element is already certain to be
- * smaller than the overall buffer size.
- *
- * @param protoLength byte array representation of the Proto object to add
- */
- private void discardOldest(int protoLength) {
- long availableSpace = getAvailableSpace();
-
- while (availableSpace < protoLength) {
-
- ProtoOutputStream item = mBuffer.poll();
- if (item == null) {
- throw new IllegalStateException("No element to discard from buffer");
- }
- mBufferUsedSize -= item.getRawSize();
- availableSpace = getAvailableSpace();
- }
- }
-
- /**
- * Removes all elements form the buffer
- */
- void resetBuffer() {
- synchronized (mBufferLock) {
- mBuffer.clear();
- mBufferUsedSize = 0;
- }
- }
-
- @VisibleForTesting
- int getBufferSize() {
- return mBufferUsedSize;
- }
-
- String getStatus() {
- synchronized (mBufferLock) {
- return "Buffer size: "
- + mBufferCapacity
- + " bytes"
- + "\n"
- + "Buffer usage: "
- + mBufferUsedSize
- + " bytes"
- + "\n"
- + "Elements in the buffer: "
- + mBuffer.size();
- }
- }
-}
diff --git a/services/core/java/com/android/server/wm/WindowTracing.java b/services/core/java/com/android/server/wm/WindowTracing.java
index 765e347..bb66530 100644
--- a/services/core/java/com/android/server/wm/WindowTracing.java
+++ b/services/core/java/com/android/server/wm/WindowTracing.java
@@ -19,6 +19,9 @@
import static android.os.Build.IS_USER;
import static com.android.server.wm.WindowManagerTraceFileProto.ENTRY;
+import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER;
+import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER_H;
+import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER_L;
import static com.android.server.wm.WindowManagerTraceProto.ELAPSED_REALTIME_NANOS;
import static com.android.server.wm.WindowManagerTraceProto.WHERE;
import static com.android.server.wm.WindowManagerTraceProto.WINDOW_MANAGER_SERVICE;
@@ -31,6 +34,9 @@
import android.util.proto.ProtoOutputStream;
import android.view.Choreographer;
+import com.android.server.protolog.ProtoLogImpl;
+import com.android.server.utils.TraceBuffer;
+
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
@@ -50,6 +56,7 @@
private static final int BUFFER_CAPACITY_ALL = 4096 * 1024;
private static final String TRACE_FILENAME = "/data/misc/wmtrace/wm_trace.pb";
private static final String TAG = "WindowTracing";
+ private static final long MAGIC_NUMBER_VALUE = ((long) MAGIC_NUMBER_H << 32) | MAGIC_NUMBER_L;
private final WindowManagerService mService;
private final Choreographer mChoreographer;
@@ -57,7 +64,7 @@
private final Object mEnabledLock = new Object();
private final File mTraceFile;
- private final WindowTraceBuffer mBuffer;
+ private final com.android.server.utils.TraceBuffer mBuffer;
private final Choreographer.FrameCallback mFrameCallback = (frameTimeNanos) ->
log("onFrame" /* where */);
@@ -84,7 +91,7 @@
mService = service;
mGlobalLock = globalLock;
mTraceFile = file;
- mBuffer = new WindowTraceBuffer(bufferCapacity);
+ mBuffer = new TraceBuffer(bufferCapacity);
setLogLevel(WindowTraceLogLevel.TRIM, null /* pw */);
}
@@ -94,6 +101,7 @@
return;
}
synchronized (mEnabledLock) {
+ ProtoLogImpl.getSingleInstance().startProtoLog(pw);
logAndPrintln(pw, "Start tracing to " + mTraceFile + ".");
mBuffer.resetBuffer();
mEnabled = mEnabledLockFree = true;
@@ -132,6 +140,7 @@
logAndPrintln(pw, "Trace written to " + mTraceFile + ".");
}
}
+ ProtoLogImpl.getSingleInstance().stopProtoLog(pw, writeToFile);
}
private void setLogLevel(@WindowTraceLogLevel int logLevel, PrintWriter pw) {
@@ -317,6 +326,7 @@
synchronized (mEnabledLock) {
writeTraceToFileLocked();
}
+ ProtoLogImpl.getSingleInstance().writeProtoLogToFile();
}
private void logAndPrintln(@Nullable PrintWriter pw, String msg) {
@@ -334,11 +344,13 @@
private void writeTraceToFileLocked() {
try {
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "writeTraceToFileLocked");
- mBuffer.writeTraceToFile(mTraceFile);
+ ProtoOutputStream proto = new ProtoOutputStream();
+ proto.write(MAGIC_NUMBER, MAGIC_NUMBER_VALUE);
+ mBuffer.writeTraceToFile(mTraceFile, proto);
} catch (IOException e) {
Log.e(TAG, "Unable to write buffer to file", e);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
}
}
-}
\ No newline at end of file
+}
diff --git a/services/net/Android.bp b/services/net/Android.bp
index 8f8f9f9..1ca96ed 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -1,87 +1,10 @@
-// AIDL interfaces between the core system and the networking mainline module.
-aidl_interface {
- name: "ipmemorystore-aidl-interfaces",
- local_include_dir: "java",
- srcs: [
- "java/android/net/IIpMemoryStore.aidl",
- "java/android/net/IIpMemoryStoreCallbacks.aidl",
- "java/android/net/ipmemorystore/**/*.aidl",
- ],
- backend: {
- ndk: {
- enabled: false,
- },
- cpp: {
- enabled: false,
- },
- },
- api_dir: "aidl/ipmemorystore",
- versions: [
- "1",
- "2",
- "3",
- ],
-}
-
-aidl_interface {
- name: "networkstack-aidl-interfaces",
- local_include_dir: "java",
- include_dirs: ["frameworks/base/core/java"], // For framework parcelables.
- srcs: [
- "java/android/net/DhcpResultsParcelable.aidl",
- "java/android/net/INetworkMonitor.aidl",
- "java/android/net/INetworkMonitorCallbacks.aidl",
- "java/android/net/INetworkStackConnector.aidl",
- "java/android/net/INetworkStackStatusCallback.aidl",
- "java/android/net/InitialConfigurationParcelable.aidl",
- "java/android/net/NattKeepalivePacketDataParcelable.aidl",
- "java/android/net/PrivateDnsConfigParcel.aidl",
- "java/android/net/ProvisioningConfigurationParcelable.aidl",
- "java/android/net/TcpKeepalivePacketDataParcelable.aidl",
- "java/android/net/dhcp/DhcpServingParamsParcel.aidl",
- "java/android/net/dhcp/IDhcpServer.aidl",
- "java/android/net/dhcp/IDhcpServerCallbacks.aidl",
- "java/android/net/ip/IIpClient.aidl",
- "java/android/net/ip/IIpClientCallbacks.aidl",
- ],
- backend: {
- ndk: {
- enabled: false,
- },
- cpp: {
- enabled: false,
- },
- },
- api_dir: "aidl/networkstack",
- imports: ["ipmemorystore-aidl-interfaces"],
- versions: [
- "1",
- "2",
- "3",
- ],
-}
-
java_library_static {
name: "services.net",
srcs: ["java/**/*.java"],
static_libs: [
"dnsresolver_aidl_interface-V2-java",
- "ipmemorystore-client",
"netd_aidl_interface-java",
- "networkstack-aidl-interfaces-V3-java",
- ],
-}
-
-java_library_static {
- name: "ipmemorystore-client",
- sdk_version: "system_current",
- srcs: [
- ":framework-annotations",
- "java/android/net/IpMemoryStoreClient.java",
- "java/android/net/ipmemorystore/**/*.java",
- ],
- static_libs: [
- "ipmemorystore-aidl-interfaces-V3-java",
+ "networkstack-client",
],
}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl
deleted file mode 100644
index a8cbab2..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStore.aidl
+++ /dev/null
@@ -1,9 +0,0 @@
-package android.net;
-interface IIpMemoryStore {
- oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener);
- oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener);
- oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener);
- oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl
deleted file mode 100644
index cf02c26..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/IIpMemoryStoreCallbacks.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net;
-interface IIpMemoryStoreCallbacks {
- oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl
deleted file mode 100644
index 291dbef..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/Blob.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-parcelable Blob {
- byte[] data;
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
deleted file mode 100644
index 52f40d4..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnBlobRetrievedListener {
- oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
deleted file mode 100644
index 7853514..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnL2KeyResponseListener {
- oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
deleted file mode 100644
index 3dd2ae6..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnNetworkAttributesRetrievedListener {
- oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
deleted file mode 100644
index 46d4ecb..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnSameL3NetworkResponseListener {
- oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl
deleted file mode 100644
index 54e654b..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/IOnStatusListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnStatusListener {
- oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
deleted file mode 100644
index 9531ea3..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.net.ipmemorystore;
-parcelable NetworkAttributesParcelable {
- byte[] assignedV4Address;
- long assignedV4AddressExpiry;
- String groupHint;
- android.net.ipmemorystore.Blob[] dnsAddresses;
- int mtu;
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
deleted file mode 100644
index 414272b..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package android.net.ipmemorystore;
-parcelable SameL3NetworkResponseParcelable {
- String l2Key1;
- String l2Key2;
- float confidence;
-}
diff --git a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl
deleted file mode 100644
index 92c6779..0000000
--- a/services/net/aidl/ipmemorystore/1/android/net/ipmemorystore/StatusParcelable.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-parcelable StatusParcelable {
- int resultCode;
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl
deleted file mode 100644
index a8cbab2..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStore.aidl
+++ /dev/null
@@ -1,9 +0,0 @@
-package android.net;
-interface IIpMemoryStore {
- oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener);
- oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener);
- oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener);
- oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl
deleted file mode 100644
index cf02c26..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/IIpMemoryStoreCallbacks.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net;
-interface IIpMemoryStoreCallbacks {
- oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl
deleted file mode 100644
index 291dbef..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/Blob.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-parcelable Blob {
- byte[] data;
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
deleted file mode 100644
index 52f40d4..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnBlobRetrievedListener {
- oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
deleted file mode 100644
index 7853514..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnL2KeyResponseListener {
- oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
deleted file mode 100644
index 3dd2ae6..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnNetworkAttributesRetrievedListener {
- oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
deleted file mode 100644
index 46d4ecb..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnSameL3NetworkResponseListener {
- oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl
deleted file mode 100644
index 54e654b..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/IOnStatusListener.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-interface IOnStatusListener {
- oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
deleted file mode 100644
index 9531ea3..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.net.ipmemorystore;
-parcelable NetworkAttributesParcelable {
- byte[] assignedV4Address;
- long assignedV4AddressExpiry;
- String groupHint;
- android.net.ipmemorystore.Blob[] dnsAddresses;
- int mtu;
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
deleted file mode 100644
index 414272b..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package android.net.ipmemorystore;
-parcelable SameL3NetworkResponseParcelable {
- String l2Key1;
- String l2Key2;
- float confidence;
-}
diff --git a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl
deleted file mode 100644
index 92c6779..0000000
--- a/services/net/aidl/ipmemorystore/2/android/net/ipmemorystore/StatusParcelable.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.ipmemorystore;
-parcelable StatusParcelable {
- int resultCode;
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
deleted file mode 100644
index 30893b2..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStore.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface IIpMemoryStore {
- oneway void storeNetworkAttributes(String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void storeBlob(String l2Key, String clientId, String name, in android.net.ipmemorystore.Blob data, android.net.ipmemorystore.IOnStatusListener listener);
- oneway void findL2Key(in android.net.ipmemorystore.NetworkAttributesParcelable attributes, android.net.ipmemorystore.IOnL2KeyResponseListener listener);
- oneway void isSameNetwork(String l2Key1, String l2Key2, android.net.ipmemorystore.IOnSameL3NetworkResponseListener listener);
- oneway void retrieveNetworkAttributes(String l2Key, android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener listener);
- oneway void retrieveBlob(String l2Key, String clientId, String name, android.net.ipmemorystore.IOnBlobRetrievedListener listener);
- oneway void factoryReset();
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
deleted file mode 100644
index 535ae2c..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/IIpMemoryStoreCallbacks.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface IIpMemoryStoreCallbacks {
- oneway void onIpMemoryStoreFetched(in android.net.IIpMemoryStore ipMemoryStore);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
deleted file mode 100644
index 6d2dc0c..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/Blob.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-parcelable Blob {
- byte[] data;
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
deleted file mode 100644
index 48c1fb8..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-interface IOnBlobRetrievedListener {
- oneway void onBlobRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in String name, in android.net.ipmemorystore.Blob data);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
deleted file mode 100644
index aebc724..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-interface IOnL2KeyResponseListener {
- oneway void onL2KeyResponse(in android.net.ipmemorystore.StatusParcelable status, in String l2Key);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
deleted file mode 100644
index b66db5a..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-interface IOnNetworkAttributesRetrievedListener {
- oneway void onNetworkAttributesRetrieved(in android.net.ipmemorystore.StatusParcelable status, in String l2Key, in android.net.ipmemorystore.NetworkAttributesParcelable attributes);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
deleted file mode 100644
index e9f2db4..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-interface IOnSameL3NetworkResponseListener {
- oneway void onSameL3NetworkResponse(in android.net.ipmemorystore.StatusParcelable status, in android.net.ipmemorystore.SameL3NetworkResponseParcelable response);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
deleted file mode 100644
index 49172ce..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/IOnStatusListener.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-interface IOnStatusListener {
- oneway void onComplete(in android.net.ipmemorystore.StatusParcelable status);
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
deleted file mode 100644
index 188db20..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-parcelable NetworkAttributesParcelable {
- byte[] assignedV4Address;
- long assignedV4AddressExpiry;
- String groupHint;
- android.net.ipmemorystore.Blob[] dnsAddresses;
- int mtu;
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
deleted file mode 100644
index 7a2ed48..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-parcelable SameL3NetworkResponseParcelable {
- String l2Key1;
- String l2Key2;
- float confidence;
-}
diff --git a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
deleted file mode 100644
index d9b0678..0000000
--- a/services/net/aidl/ipmemorystore/3/android/net/ipmemorystore/StatusParcelable.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ipmemorystore;
-parcelable StatusParcelable {
- int resultCode;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl
deleted file mode 100644
index 92b5345..0000000
--- a/services/net/aidl/networkstack/1/android/net/DhcpResultsParcelable.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.net;
-parcelable DhcpResultsParcelable {
- android.net.StaticIpConfiguration baseConfiguration;
- int leaseDuration;
- int mtu;
- String serverAddress;
- String vendorInfo;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl
deleted file mode 100644
index b19f522..0000000
--- a/services/net/aidl/networkstack/1/android/net/INetworkMonitor.aidl
+++ /dev/null
@@ -1,17 +0,0 @@
-package android.net;
-interface INetworkMonitor {
- oneway void start();
- oneway void launchCaptivePortalApp();
- oneway void notifyCaptivePortalAppFinished(int response);
- oneway void setAcceptPartialConnectivity();
- oneway void forceReevaluation(int uid);
- oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config);
- oneway void notifyDnsResponse(int returnCode);
- oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc);
- oneway void notifyNetworkDisconnected();
- oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp);
- oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc);
- const int NETWORK_TEST_RESULT_VALID = 0;
- const int NETWORK_TEST_RESULT_INVALID = 1;
- const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl
deleted file mode 100644
index ee9871d..0000000
--- a/services/net/aidl/networkstack/1/android/net/INetworkMonitorCallbacks.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.net;
-interface INetworkMonitorCallbacks {
- oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
- oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl);
- oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config);
- oneway void showProvisioningNotification(String action, String packageName);
- oneway void hideProvisioningNotification();
-}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl
deleted file mode 100644
index 7da11e4..0000000
--- a/services/net/aidl/networkstack/1/android/net/INetworkStackConnector.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package android.net;
-interface INetworkStackConnector {
- oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
- oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb);
- oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks);
- oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb);
-}
diff --git a/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl
deleted file mode 100644
index f6ca6f7..0000000
--- a/services/net/aidl/networkstack/1/android/net/INetworkStackStatusCallback.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net;
-interface INetworkStackStatusCallback {
- oneway void onStatusAvailable(int statusCode);
-}
diff --git a/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl
deleted file mode 100644
index c80a787..0000000
--- a/services/net/aidl/networkstack/1/android/net/InitialConfigurationParcelable.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package android.net;
-parcelable InitialConfigurationParcelable {
- android.net.LinkAddress[] ipAddresses;
- android.net.IpPrefix[] directlyConnectedRoutes;
- String[] dnsServers;
- String gateway;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl
deleted file mode 100644
index 2de790b..0000000
--- a/services/net/aidl/networkstack/1/android/net/PrivateDnsConfigParcel.aidl
+++ /dev/null
@@ -1,5 +0,0 @@
-package android.net;
-parcelable PrivateDnsConfigParcel {
- String hostname;
- String[] ips;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl
deleted file mode 100644
index 3a6c304..0000000
--- a/services/net/aidl/networkstack/1/android/net/ProvisioningConfigurationParcelable.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package android.net;
-parcelable ProvisioningConfigurationParcelable {
- boolean enableIPv4;
- boolean enableIPv6;
- boolean usingMultinetworkPolicyTracker;
- boolean usingIpReachabilityMonitor;
- int requestedPreDhcpActionMs;
- android.net.InitialConfigurationParcelable initialConfig;
- android.net.StaticIpConfiguration staticIpConfig;
- android.net.apf.ApfCapabilities apfCapabilities;
- int provisioningTimeoutMs;
- int ipv6AddrGenMode;
- android.net.Network network;
- String displayName;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index e121c06..0000000
--- a/services/net/aidl/networkstack/1/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,13 +0,0 @@
-package android.net;
-parcelable TcpKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
- int seq;
- int ack;
- int rcvWnd;
- int rcvWndScale;
- int tos;
- int ttl;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl
deleted file mode 100644
index 67193ae..0000000
--- a/services/net/aidl/networkstack/1/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ /dev/null
@@ -1,11 +0,0 @@
-package android.net.dhcp;
-parcelable DhcpServingParamsParcel {
- int serverAddr;
- int serverAddrPrefixLength;
- int[] defaultRouters;
- int[] dnsServers;
- int[] excludedAddrs;
- long dhcpLeaseTimeSecs;
- int linkMtu;
- boolean metered;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl
deleted file mode 100644
index 9143158..0000000
--- a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServer.aidl
+++ /dev/null
@@ -1,10 +0,0 @@
-package android.net.dhcp;
-interface IDhcpServer {
- oneway void start(in android.net.INetworkStackStatusCallback cb);
- oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb);
- oneway void stop(in android.net.INetworkStackStatusCallback cb);
- const int STATUS_UNKNOWN = 0;
- const int STATUS_SUCCESS = 1;
- const int STATUS_INVALID_ARGUMENT = 2;
- const int STATUS_UNKNOWN_ERROR = 3;
-}
diff --git a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl
deleted file mode 100644
index dcc4489..0000000
--- a/services/net/aidl/networkstack/1/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.dhcp;
-interface IDhcpServerCallbacks {
- oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
-}
diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl
deleted file mode 100644
index 95a1574..0000000
--- a/services/net/aidl/networkstack/1/android/net/ip/IIpClient.aidl
+++ /dev/null
@@ -1,14 +0,0 @@
-package android.net.ip;
-interface IIpClient {
- oneway void completedPreDhcpAction();
- oneway void confirmConfiguration();
- oneway void readPacketFilterComplete(in byte[] data);
- oneway void shutdown();
- oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req);
- oneway void stop();
- oneway void setTcpBufferSizes(in String tcpBufferSizes);
- oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo);
- oneway void setMulticastFilter(boolean enabled);
- oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt);
- oneway void removeKeepalivePacketFilter(int slot);
-}
diff --git a/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl
deleted file mode 100644
index d6bc808..0000000
--- a/services/net/aidl/networkstack/1/android/net/ip/IIpClientCallbacks.aidl
+++ /dev/null
@@ -1,16 +0,0 @@
-package android.net.ip;
-interface IIpClientCallbacks {
- oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
- oneway void onPreDhcpAction();
- oneway void onPostDhcpAction();
- oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults);
- oneway void onProvisioningSuccess(in android.net.LinkProperties newLp);
- oneway void onProvisioningFailure(in android.net.LinkProperties newLp);
- oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp);
- oneway void onReachabilityLost(in String logMsg);
- oneway void onQuit();
- oneway void installPacketFilter(in byte[] filter);
- oneway void startReadPacketFilter();
- oneway void setFallbackMulticastFilter(boolean enabled);
- oneway void setNeighborDiscoveryOffload(boolean enable);
-}
diff --git a/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl
deleted file mode 100644
index 31891de..0000000
--- a/services/net/aidl/networkstack/2/android/net/DhcpResultsParcelable.aidl
+++ /dev/null
@@ -1,9 +0,0 @@
-package android.net;
-parcelable DhcpResultsParcelable {
- android.net.StaticIpConfiguration baseConfiguration;
- int leaseDuration;
- int mtu;
- String serverAddress;
- String vendorInfo;
- String serverHostName;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl
deleted file mode 100644
index 029968b..0000000
--- a/services/net/aidl/networkstack/2/android/net/INetworkMonitor.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-package android.net;
-interface INetworkMonitor {
- oneway void start();
- oneway void launchCaptivePortalApp();
- oneway void notifyCaptivePortalAppFinished(int response);
- oneway void setAcceptPartialConnectivity();
- oneway void forceReevaluation(int uid);
- oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config);
- oneway void notifyDnsResponse(int returnCode);
- oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc);
- oneway void notifyNetworkDisconnected();
- oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp);
- oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc);
- const int NETWORK_TEST_RESULT_VALID = 0;
- const int NETWORK_TEST_RESULT_INVALID = 1;
- const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
- const int NETWORK_VALIDATION_RESULT_VALID = 1;
- const int NETWORK_VALIDATION_RESULT_PARTIAL = 2;
- const int NETWORK_VALIDATION_PROBE_DNS = 4;
- const int NETWORK_VALIDATION_PROBE_HTTP = 8;
- const int NETWORK_VALIDATION_PROBE_HTTPS = 16;
- const int NETWORK_VALIDATION_PROBE_FALLBACK = 32;
- const int NETWORK_VALIDATION_PROBE_PRIVDNS = 64;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl
deleted file mode 100644
index ee9871d..0000000
--- a/services/net/aidl/networkstack/2/android/net/INetworkMonitorCallbacks.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package android.net;
-interface INetworkMonitorCallbacks {
- oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
- oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl);
- oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config);
- oneway void showProvisioningNotification(String action, String packageName);
- oneway void hideProvisioningNotification();
-}
diff --git a/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl
deleted file mode 100644
index 7da11e4..0000000
--- a/services/net/aidl/networkstack/2/android/net/INetworkStackConnector.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package android.net;
-interface INetworkStackConnector {
- oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
- oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb);
- oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks);
- oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb);
-}
diff --git a/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl
deleted file mode 100644
index f6ca6f7..0000000
--- a/services/net/aidl/networkstack/2/android/net/INetworkStackStatusCallback.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net;
-interface INetworkStackStatusCallback {
- oneway void onStatusAvailable(int statusCode);
-}
diff --git a/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl
deleted file mode 100644
index c80a787..0000000
--- a/services/net/aidl/networkstack/2/android/net/InitialConfigurationParcelable.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package android.net;
-parcelable InitialConfigurationParcelable {
- android.net.LinkAddress[] ipAddresses;
- android.net.IpPrefix[] directlyConnectedRoutes;
- String[] dnsServers;
- String gateway;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index 65de883..0000000
--- a/services/net/aidl/networkstack/2/android/net/NattKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package android.net;
-parcelable NattKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl
deleted file mode 100644
index 2de790b..0000000
--- a/services/net/aidl/networkstack/2/android/net/PrivateDnsConfigParcel.aidl
+++ /dev/null
@@ -1,5 +0,0 @@
-package android.net;
-parcelable PrivateDnsConfigParcel {
- String hostname;
- String[] ips;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl
deleted file mode 100644
index 3a6c304..0000000
--- a/services/net/aidl/networkstack/2/android/net/ProvisioningConfigurationParcelable.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package android.net;
-parcelable ProvisioningConfigurationParcelable {
- boolean enableIPv4;
- boolean enableIPv6;
- boolean usingMultinetworkPolicyTracker;
- boolean usingIpReachabilityMonitor;
- int requestedPreDhcpActionMs;
- android.net.InitialConfigurationParcelable initialConfig;
- android.net.StaticIpConfiguration staticIpConfig;
- android.net.apf.ApfCapabilities apfCapabilities;
- int provisioningTimeoutMs;
- int ipv6AddrGenMode;
- android.net.Network network;
- String displayName;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index e121c06..0000000
--- a/services/net/aidl/networkstack/2/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,13 +0,0 @@
-package android.net;
-parcelable TcpKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
- int seq;
- int ack;
- int rcvWnd;
- int rcvWndScale;
- int tos;
- int ttl;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl
deleted file mode 100644
index 67193ae..0000000
--- a/services/net/aidl/networkstack/2/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ /dev/null
@@ -1,11 +0,0 @@
-package android.net.dhcp;
-parcelable DhcpServingParamsParcel {
- int serverAddr;
- int serverAddrPrefixLength;
- int[] defaultRouters;
- int[] dnsServers;
- int[] excludedAddrs;
- long dhcpLeaseTimeSecs;
- int linkMtu;
- boolean metered;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl
deleted file mode 100644
index 9143158..0000000
--- a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServer.aidl
+++ /dev/null
@@ -1,10 +0,0 @@
-package android.net.dhcp;
-interface IDhcpServer {
- oneway void start(in android.net.INetworkStackStatusCallback cb);
- oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb);
- oneway void stop(in android.net.INetworkStackStatusCallback cb);
- const int STATUS_UNKNOWN = 0;
- const int STATUS_SUCCESS = 1;
- const int STATUS_INVALID_ARGUMENT = 2;
- const int STATUS_UNKNOWN_ERROR = 3;
-}
diff --git a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl
deleted file mode 100644
index dcc4489..0000000
--- a/services/net/aidl/networkstack/2/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ /dev/null
@@ -1,4 +0,0 @@
-package android.net.dhcp;
-interface IDhcpServerCallbacks {
- oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
-}
diff --git a/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl
deleted file mode 100644
index 77d5917..0000000
--- a/services/net/aidl/networkstack/2/android/net/ip/IIpClient.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package android.net.ip;
-interface IIpClient {
- oneway void completedPreDhcpAction();
- oneway void confirmConfiguration();
- oneway void readPacketFilterComplete(in byte[] data);
- oneway void shutdown();
- oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req);
- oneway void stop();
- oneway void setTcpBufferSizes(in String tcpBufferSizes);
- oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo);
- oneway void setMulticastFilter(boolean enabled);
- oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt);
- oneway void removeKeepalivePacketFilter(int slot);
- oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
-}
diff --git a/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl
deleted file mode 100644
index d6bc808..0000000
--- a/services/net/aidl/networkstack/2/android/net/ip/IIpClientCallbacks.aidl
+++ /dev/null
@@ -1,16 +0,0 @@
-package android.net.ip;
-interface IIpClientCallbacks {
- oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
- oneway void onPreDhcpAction();
- oneway void onPostDhcpAction();
- oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults);
- oneway void onProvisioningSuccess(in android.net.LinkProperties newLp);
- oneway void onProvisioningFailure(in android.net.LinkProperties newLp);
- oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp);
- oneway void onReachabilityLost(in String logMsg);
- oneway void onQuit();
- oneway void installPacketFilter(in byte[] filter);
- oneway void startReadPacketFilter();
- oneway void setFallbackMulticastFilter(boolean enabled);
- oneway void setNeighborDiscoveryOffload(boolean enable);
-}
diff --git a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl b/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
deleted file mode 100644
index 07ff321..0000000
--- a/services/net/aidl/networkstack/3/android/net/DhcpResultsParcelable.aidl
+++ /dev/null
@@ -1,26 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable DhcpResultsParcelable {
- android.net.StaticIpConfiguration baseConfiguration;
- int leaseDuration;
- int mtu;
- String serverAddress;
- String vendorInfo;
- String serverHostName;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
deleted file mode 100644
index 8aa68bd..0000000
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitor.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface INetworkMonitor {
- oneway void start();
- oneway void launchCaptivePortalApp();
- oneway void notifyCaptivePortalAppFinished(int response);
- oneway void setAcceptPartialConnectivity();
- oneway void forceReevaluation(int uid);
- oneway void notifyPrivateDnsChanged(in android.net.PrivateDnsConfigParcel config);
- oneway void notifyDnsResponse(int returnCode);
- oneway void notifyNetworkConnected(in android.net.LinkProperties lp, in android.net.NetworkCapabilities nc);
- oneway void notifyNetworkDisconnected();
- oneway void notifyLinkPropertiesChanged(in android.net.LinkProperties lp);
- oneway void notifyNetworkCapabilitiesChanged(in android.net.NetworkCapabilities nc);
- const int NETWORK_TEST_RESULT_VALID = 0;
- const int NETWORK_TEST_RESULT_INVALID = 1;
- const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
- const int NETWORK_VALIDATION_RESULT_VALID = 1;
- const int NETWORK_VALIDATION_RESULT_PARTIAL = 2;
- const int NETWORK_VALIDATION_PROBE_DNS = 4;
- const int NETWORK_VALIDATION_PROBE_HTTP = 8;
- const int NETWORK_VALIDATION_PROBE_HTTPS = 16;
- const int NETWORK_VALIDATION_PROBE_FALLBACK = 32;
- const int NETWORK_VALIDATION_PROBE_PRIVDNS = 64;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
deleted file mode 100644
index ea93729..0000000
--- a/services/net/aidl/networkstack/3/android/net/INetworkMonitorCallbacks.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface INetworkMonitorCallbacks {
- oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
- oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl);
- oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config);
- oneway void showProvisioningNotification(String action, String packageName);
- oneway void hideProvisioningNotification();
-}
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
deleted file mode 100644
index e3a83d1..0000000
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackConnector.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface INetworkStackConnector {
- oneway void makeDhcpServer(in String ifName, in android.net.dhcp.DhcpServingParamsParcel params, in android.net.dhcp.IDhcpServerCallbacks cb);
- oneway void makeNetworkMonitor(in android.net.Network network, String name, in android.net.INetworkMonitorCallbacks cb);
- oneway void makeIpClient(in String ifName, in android.net.ip.IIpClientCallbacks callbacks);
- oneway void fetchIpMemoryStore(in android.net.IIpMemoryStoreCallbacks cb);
-}
diff --git a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl b/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
deleted file mode 100644
index 3112a08..0000000
--- a/services/net/aidl/networkstack/3/android/net/INetworkStackStatusCallback.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-interface INetworkStackStatusCallback {
- oneway void onStatusAvailable(int statusCode);
-}
diff --git a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
deleted file mode 100644
index f846b26..0000000
--- a/services/net/aidl/networkstack/3/android/net/InitialConfigurationParcelable.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable InitialConfigurationParcelable {
- android.net.LinkAddress[] ipAddresses;
- android.net.IpPrefix[] directlyConnectedRoutes;
- String[] dnsServers;
- String gateway;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index de75940..0000000
--- a/services/net/aidl/networkstack/3/android/net/NattKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable NattKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl b/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
deleted file mode 100644
index cf0fbce9..0000000
--- a/services/net/aidl/networkstack/3/android/net/PrivateDnsConfigParcel.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable PrivateDnsConfigParcel {
- String hostname;
- String[] ips;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
deleted file mode 100644
index c0f2d4d..0000000
--- a/services/net/aidl/networkstack/3/android/net/ProvisioningConfigurationParcelable.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable ProvisioningConfigurationParcelable {
- boolean enableIPv4;
- boolean enableIPv6;
- boolean usingMultinetworkPolicyTracker;
- boolean usingIpReachabilityMonitor;
- int requestedPreDhcpActionMs;
- android.net.InitialConfigurationParcelable initialConfig;
- android.net.StaticIpConfiguration staticIpConfig;
- android.net.apf.ApfCapabilities apfCapabilities;
- int provisioningTimeoutMs;
- int ipv6AddrGenMode;
- android.net.Network network;
- String displayName;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index 5926794..0000000
--- a/services/net/aidl/networkstack/3/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net;
-parcelable TcpKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
- int seq;
- int ack;
- int rcvWnd;
- int rcvWndScale;
- int tos;
- int ttl;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
deleted file mode 100644
index 7ab156f..0000000
--- a/services/net/aidl/networkstack/3/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.dhcp;
-parcelable DhcpServingParamsParcel {
- int serverAddr;
- int serverAddrPrefixLength;
- int[] defaultRouters;
- int[] dnsServers;
- int[] excludedAddrs;
- long dhcpLeaseTimeSecs;
- int linkMtu;
- boolean metered;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
deleted file mode 100644
index d281ecf..0000000
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServer.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.dhcp;
-interface IDhcpServer {
- oneway void start(in android.net.INetworkStackStatusCallback cb);
- oneway void updateParams(in android.net.dhcp.DhcpServingParamsParcel params, in android.net.INetworkStackStatusCallback cb);
- oneway void stop(in android.net.INetworkStackStatusCallback cb);
- const int STATUS_UNKNOWN = 0;
- const int STATUS_SUCCESS = 1;
- const int STATUS_INVALID_ARGUMENT = 2;
- const int STATUS_UNKNOWN_ERROR = 3;
-}
diff --git a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
deleted file mode 100644
index 98be0ab..0000000
--- a/services/net/aidl/networkstack/3/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ /dev/null
@@ -1,21 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.dhcp;
-interface IDhcpServerCallbacks {
- oneway void onDhcpServerCreated(int statusCode, in android.net.dhcp.IDhcpServer server);
-}
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
deleted file mode 100644
index 85c8676..0000000
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClient.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ip;
-interface IIpClient {
- oneway void completedPreDhcpAction();
- oneway void confirmConfiguration();
- oneway void readPacketFilterComplete(in byte[] data);
- oneway void shutdown();
- oneway void startProvisioning(in android.net.ProvisioningConfigurationParcelable req);
- oneway void stop();
- oneway void setTcpBufferSizes(in String tcpBufferSizes);
- oneway void setHttpProxy(in android.net.ProxyInfo proxyInfo);
- oneway void setMulticastFilter(boolean enabled);
- oneway void addKeepalivePacketFilter(int slot, in android.net.TcpKeepalivePacketDataParcelable pkt);
- oneway void removeKeepalivePacketFilter(int slot);
- oneway void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
- oneway void addNattKeepalivePacketFilter(int slot, in android.net.NattKeepalivePacketDataParcelable pkt);
-}
diff --git a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl b/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
deleted file mode 100644
index 7fe39ed..0000000
--- a/services/net/aidl/networkstack/3/android/net/ip/IIpClientCallbacks.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a frozen snapshot of an AIDL interface (or parcelable). Do not
-// try to edit this file. It looks like you are doing that because you have
-// modified an AIDL interface in a backward-incompatible way, e.g., deleting a
-// function from an interface or a field from a parcelable and it broke the
-// build. That breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.net.ip;
-interface IIpClientCallbacks {
- oneway void onIpClientCreated(in android.net.ip.IIpClient ipClient);
- oneway void onPreDhcpAction();
- oneway void onPostDhcpAction();
- oneway void onNewDhcpResults(in android.net.DhcpResultsParcelable dhcpResults);
- oneway void onProvisioningSuccess(in android.net.LinkProperties newLp);
- oneway void onProvisioningFailure(in android.net.LinkProperties newLp);
- oneway void onLinkPropertiesChange(in android.net.LinkProperties newLp);
- oneway void onReachabilityLost(in String logMsg);
- oneway void onQuit();
- oneway void installPacketFilter(in byte[] filter);
- oneway void startReadPacketFilter();
- oneway void setFallbackMulticastFilter(boolean enabled);
- oneway void setNeighborDiscoveryOffload(boolean enable);
-}
diff --git a/services/net/java/android/net/DhcpResultsParcelable.aidl b/services/net/java/android/net/DhcpResultsParcelable.aidl
deleted file mode 100644
index c98d9c2..0000000
--- a/services/net/java/android/net/DhcpResultsParcelable.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright (c) 2019, 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 perNmissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.net.StaticIpConfiguration;
-
-parcelable DhcpResultsParcelable {
- StaticIpConfiguration baseConfiguration;
- int leaseDuration;
- int mtu;
- String serverAddress;
- String vendorInfo;
- String serverHostName;
-}
diff --git a/services/net/java/android/net/IIpMemoryStore.aidl b/services/net/java/android/net/IIpMemoryStore.aidl
deleted file mode 100644
index add221a..0000000
--- a/services/net/java/android/net/IIpMemoryStore.aidl
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 android.net;
-
-import android.net.ipmemorystore.Blob;
-import android.net.ipmemorystore.NetworkAttributesParcelable;
-import android.net.ipmemorystore.IOnBlobRetrievedListener;
-import android.net.ipmemorystore.IOnL2KeyResponseListener;
-import android.net.ipmemorystore.IOnNetworkAttributesRetrievedListener;
-import android.net.ipmemorystore.IOnSameL3NetworkResponseListener;
-import android.net.ipmemorystore.IOnStatusListener;
-
-/** {@hide} */
-oneway interface IIpMemoryStore {
- /**
- * Store network attributes for a given L2 key.
- * If L2Key is null, choose automatically from the attributes ; passing null is equivalent to
- * calling findL2Key with the attributes and storing in the returned value.
- *
- * @param l2Key The L2 key for the L2 network. Clients that don't know or care about the L2
- * key and only care about grouping can pass a unique ID here like the ones
- * generated by {@code java.util.UUID.randomUUID()}, but keep in mind the low
- * relevance of such a network will lead to it being evicted soon if it's not
- * refreshed. Use findL2Key to try and find a similar L2Key to these attributes.
- * @param attributes The attributes for this network.
- * @param listener A listener that will be invoked to inform of the completion of this call,
- * or null if the client is not interested in learning about success/failure.
- * @return (through the listener) The L2 key. This is useful if the L2 key was not specified.
- * If the call failed, the L2 key will be null.
- */
- void storeNetworkAttributes(String l2Key, in NetworkAttributesParcelable attributes,
- IOnStatusListener listener);
-
- /**
- * Store a binary blob associated with an L2 key and a name.
- *
- * @param l2Key The L2 key for this network.
- * @param clientId The ID of the client.
- * @param name The name of this data.
- * @param data The data to store.
- * @param listener A listener to inform of the completion of this call, or null if the client
- * is not interested in learning about success/failure.
- * @return (through the listener) A status to indicate success or failure.
- */
- void storeBlob(String l2Key, String clientId, String name, in Blob data,
- IOnStatusListener listener);
-
- /**
- * Returns the best L2 key associated with the attributes.
- *
- * This will find a record that would be in the same group as the passed attributes. This is
- * useful to choose the key for storing a sample or private data when the L2 key is not known.
- * If multiple records are group-close to these attributes, the closest match is returned.
- * If multiple records have the same closeness, the one with the smaller (unicode codepoint
- * order) L2 key is returned.
- * If no record matches these attributes, null is returned.
- *
- * @param attributes The attributes of the network to find.
- * @param listener The listener that will be invoked to return the answer.
- * @return (through the listener) The L2 key if one matched, or null.
- */
- void findL2Key(in NetworkAttributesParcelable attributes, IOnL2KeyResponseListener listener);
-
- /**
- * Returns whether, to the best of the store's ability to tell, the two specified L2 keys point
- * to the same L3 network. Group-closeness is used to determine this.
- *
- * @param l2Key1 The key for the first network.
- * @param l2Key2 The key for the second network.
- * @param listener The listener that will be invoked to return the answer.
- * @return (through the listener) A SameL3NetworkResponse containing the answer and confidence.
- */
- void isSameNetwork(String l2Key1, String l2Key2, IOnSameL3NetworkResponseListener listener);
-
- /**
- * Retrieve the network attributes for a key.
- * If no record is present for this key, this will return null attributes.
- *
- * @param l2Key The key of the network to query.
- * @param listener The listener that will be invoked to return the answer.
- * @return (through the listener) The network attributes and the L2 key associated with
- * the query.
- */
- void retrieveNetworkAttributes(String l2Key, IOnNetworkAttributesRetrievedListener listener);
-
- /**
- * Retrieve previously stored private data.
- * If no data was stored for this L2 key and name this will return null.
- *
- * @param l2Key The L2 key.
- * @param clientId The id of the client that stored this data.
- * @param name The name of the data.
- * @param listener The listener that will be invoked to return the answer.
- * @return (through the listener) The private data (or null), with the L2 key
- * and the name of the data associated with the query.
- */
- void retrieveBlob(String l2Key, String clientId, String name,
- IOnBlobRetrievedListener listener);
-
- /**
- * Delete all data because a factory reset operation is in progress.
- */
- void factoryReset();
-}
diff --git a/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl b/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl
deleted file mode 100644
index 53108db..0000000
--- a/services/net/java/android/net/IIpMemoryStoreCallbacks.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net;
-
-import android.net.IIpMemoryStore;
-
-/** {@hide} */
-oneway interface IIpMemoryStoreCallbacks {
- void onIpMemoryStoreFetched(in IIpMemoryStore ipMemoryStore);
-}
diff --git a/services/net/java/android/net/INetworkMonitor.aidl b/services/net/java/android/net/INetworkMonitor.aidl
deleted file mode 100644
index 3fc81a3..0000000
--- a/services/net/java/android/net/INetworkMonitor.aidl
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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 perNmissions and
- * limitations under the License.
- */
-package android.net;
-
-import android.net.LinkProperties;
-import android.net.NetworkCapabilities;
-import android.net.PrivateDnsConfigParcel;
-
-/** @hide */
-oneway interface INetworkMonitor {
- // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
- // The network should be used as a default internet connection. It was found to be:
- // 1. a functioning network providing internet access, or
- // 2. a captive portal and the user decided to use it as is.
- const int NETWORK_TEST_RESULT_VALID = 0;
-
- // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
- // The network should not be used as a default internet connection. It was found to be:
- // 1. a captive portal and the user is prompted to sign-in, or
- // 2. a captive portal and the user did not want to use it, or
- // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed).
- const int NETWORK_TEST_RESULT_INVALID = 1;
-
- // After a network has been tested, this result can be sent with EVENT_NETWORK_TESTED.
- // The network may be used as a default internet connection, but it was found to be a partial
- // connectivity network which can get the pass result for http probe but get the failed result
- // for https probe.
- const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
-
- // Network validation flags indicate probe result and types. If no NETWORK_VALIDATION_RESULT_*
- // are set, then it's equal to NETWORK_TEST_RESULT_INVALID. If NETWORK_VALIDATION_RESULT_VALID
- // is set, then the network validates and equal to NETWORK_TEST_RESULT_VALID. If
- // NETWORK_VALIDATION_RESULT_PARTIAL is set, then the network has partial connectivity which
- // is equal to NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY. NETWORK_VALIDATION_PROBE_* is set
- // when the specific probe result of the network is resolved.
- const int NETWORK_VALIDATION_RESULT_VALID = 0x01;
- const int NETWORK_VALIDATION_RESULT_PARTIAL = 0x02;
- const int NETWORK_VALIDATION_PROBE_DNS = 0x04;
- const int NETWORK_VALIDATION_PROBE_HTTP = 0x08;
- const int NETWORK_VALIDATION_PROBE_HTTPS = 0x10;
- const int NETWORK_VALIDATION_PROBE_FALLBACK = 0x20;
- const int NETWORK_VALIDATION_PROBE_PRIVDNS = 0x40;
-
- void start();
- void launchCaptivePortalApp();
- void notifyCaptivePortalAppFinished(int response);
- void setAcceptPartialConnectivity();
- void forceReevaluation(int uid);
- void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
- void notifyDnsResponse(int returnCode);
- void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc);
- void notifyNetworkDisconnected();
- void notifyLinkPropertiesChanged(in LinkProperties lp);
- void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc);
-}
diff --git a/services/net/java/android/net/INetworkMonitorCallbacks.aidl b/services/net/java/android/net/INetworkMonitorCallbacks.aidl
deleted file mode 100644
index 2c61511..0000000
--- a/services/net/java/android/net/INetworkMonitorCallbacks.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 android.net;
-
-import android.net.INetworkMonitor;
-import android.net.PrivateDnsConfigParcel;
-
-/** @hide */
-oneway interface INetworkMonitorCallbacks {
- void onNetworkMonitorCreated(in INetworkMonitor networkMonitor);
- void notifyNetworkTested(int testResult, @nullable String redirectUrl);
- void notifyPrivateDnsConfigResolved(in PrivateDnsConfigParcel config);
- void showProvisioningNotification(String action, String packageName);
- void hideProvisioningNotification();
-}
\ No newline at end of file
diff --git a/services/net/java/android/net/INetworkStackConnector.aidl b/services/net/java/android/net/INetworkStackConnector.aidl
deleted file mode 100644
index 3751c36..0000000
--- a/services/net/java/android/net/INetworkStackConnector.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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 perNmissions and
- * limitations under the License.
- */
-package android.net;
-
-import android.net.IIpMemoryStoreCallbacks;
-import android.net.INetworkMonitorCallbacks;
-import android.net.Network;
-import android.net.dhcp.DhcpServingParamsParcel;
-import android.net.dhcp.IDhcpServerCallbacks;
-import android.net.ip.IIpClientCallbacks;
-
-/** @hide */
-oneway interface INetworkStackConnector {
- void makeDhcpServer(in String ifName, in DhcpServingParamsParcel params,
- in IDhcpServerCallbacks cb);
- void makeNetworkMonitor(in Network network, String name, in INetworkMonitorCallbacks cb);
- void makeIpClient(in String ifName, in IIpClientCallbacks callbacks);
- void fetchIpMemoryStore(in IIpMemoryStoreCallbacks cb);
-}
diff --git a/services/net/java/android/net/INetworkStackStatusCallback.aidl b/services/net/java/android/net/INetworkStackStatusCallback.aidl
deleted file mode 100644
index 51032d8..0000000
--- a/services/net/java/android/net/INetworkStackStatusCallback.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 android.net;
-
-/** @hide */
-oneway interface INetworkStackStatusCallback {
- void onStatusAvailable(int statusCode);
-}
\ No newline at end of file
diff --git a/services/net/java/android/net/InitialConfigurationParcelable.aidl b/services/net/java/android/net/InitialConfigurationParcelable.aidl
deleted file mode 100644
index 3fa88c3..0000000
--- a/services/net/java/android/net/InitialConfigurationParcelable.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net;
-
-import android.net.IpPrefix;
-import android.net.LinkAddress;
-
-parcelable InitialConfigurationParcelable {
- LinkAddress[] ipAddresses;
- IpPrefix[] directlyConnectedRoutes;
- String[] dnsServers;
- String gateway;
-}
\ No newline at end of file
diff --git a/services/net/java/android/net/IpMemoryStoreClient.java b/services/net/java/android/net/IpMemoryStoreClient.java
deleted file mode 100644
index 014b528..0000000
--- a/services/net/java/android/net/IpMemoryStoreClient.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.net.ipmemorystore.Blob;
-import android.net.ipmemorystore.NetworkAttributes;
-import android.net.ipmemorystore.OnBlobRetrievedListener;
-import android.net.ipmemorystore.OnL2KeyResponseListener;
-import android.net.ipmemorystore.OnNetworkAttributesRetrievedListener;
-import android.net.ipmemorystore.OnSameL3NetworkResponseListener;
-import android.net.ipmemorystore.OnStatusListener;
-import android.net.ipmemorystore.Status;
-import android.os.RemoteException;
-import android.util.Log;
-
-import java.util.concurrent.ExecutionException;
-import java.util.function.Consumer;
-
-/**
- * service used to communicate with the ip memory store service in network stack,
- * which is running in a separate module.
- * @hide
- */
-public abstract class IpMemoryStoreClient {
- private static final String TAG = IpMemoryStoreClient.class.getSimpleName();
- private final Context mContext;
-
- public IpMemoryStoreClient(@NonNull final Context context) {
- if (context == null) throw new IllegalArgumentException("missing context");
- mContext = context;
- }
-
- protected abstract void runWhenServiceReady(Consumer<IIpMemoryStore> cb)
- throws ExecutionException;
-
- @FunctionalInterface
- private interface ThrowingRunnable {
- void run() throws RemoteException;
- }
-
- private void ignoringRemoteException(ThrowingRunnable r) {
- ignoringRemoteException("Failed to execute remote procedure call", r);
- }
-
- private void ignoringRemoteException(String message, ThrowingRunnable r) {
- try {
- r.run();
- } catch (RemoteException e) {
- Log.e(TAG, message, e);
- }
- }
-
- /**
- * Store network attributes for a given L2 key.
- * If L2Key is null, choose automatically from the attributes ; passing null is equivalent to
- * calling findL2Key with the attributes and storing in the returned value.
- *
- * @param l2Key The L2 key for the L2 network. Clients that don't know or care about the L2
- * key and only care about grouping can pass a unique ID here like the ones
- * generated by {@code java.util.UUID.randomUUID()}, but keep in mind the low
- * relevance of such a network will lead to it being evicted soon if it's not
- * refreshed. Use findL2Key to try and find a similar L2Key to these attributes.
- * @param attributes The attributes for this network.
- * @param listener A listener that will be invoked to inform of the completion of this call,
- * or null if the client is not interested in learning about success/failure.
- * Through the listener, returns the L2 key. This is useful if the L2 key was not specified.
- * If the call failed, the L2 key will be null.
- */
- public void storeNetworkAttributes(@NonNull final String l2Key,
- @NonNull final NetworkAttributes attributes,
- @Nullable final OnStatusListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.storeNetworkAttributes(l2Key, attributes.toParcelable(),
- OnStatusListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error storing network attributes",
- () -> listener.onComplete(new Status(Status.ERROR_UNKNOWN)));
- }
- }
-
- /**
- * Store a binary blob associated with an L2 key and a name.
- *
- * @param l2Key The L2 key for this network.
- * @param clientId The ID of the client.
- * @param name The name of this data.
- * @param data The data to store.
- * @param listener A listener to inform of the completion of this call, or null if the client
- * is not interested in learning about success/failure.
- * Through the listener, returns a status to indicate success or failure.
- */
- public void storeBlob(@NonNull final String l2Key, @NonNull final String clientId,
- @NonNull final String name, @NonNull final Blob data,
- @Nullable final OnStatusListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.storeBlob(l2Key, clientId, name, data,
- OnStatusListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error storing blob",
- () -> listener.onComplete(new Status(Status.ERROR_UNKNOWN)));
- }
- }
-
- /**
- * Returns the best L2 key associated with the attributes.
- *
- * This will find a record that would be in the same group as the passed attributes. This is
- * useful to choose the key for storing a sample or private data when the L2 key is not known.
- * If multiple records are group-close to these attributes, the closest match is returned.
- * If multiple records have the same closeness, the one with the smaller (unicode codepoint
- * order) L2 key is returned.
- * If no record matches these attributes, null is returned.
- *
- * @param attributes The attributes of the network to find.
- * @param listener The listener that will be invoked to return the answer.
- * Through the listener, returns the L2 key if one matched, or null.
- */
- public void findL2Key(@NonNull final NetworkAttributes attributes,
- @NonNull final OnL2KeyResponseListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.findL2Key(attributes.toParcelable(),
- OnL2KeyResponseListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error finding L2 Key",
- () -> listener.onL2KeyResponse(new Status(Status.ERROR_UNKNOWN), null));
- }
- }
-
- /**
- * Returns whether, to the best of the store's ability to tell, the two specified L2 keys point
- * to the same L3 network. Group-closeness is used to determine this.
- *
- * @param l2Key1 The key for the first network.
- * @param l2Key2 The key for the second network.
- * @param listener The listener that will be invoked to return the answer.
- * Through the listener, a SameL3NetworkResponse containing the answer and confidence.
- */
- public void isSameNetwork(@NonNull final String l2Key1, @NonNull final String l2Key2,
- @NonNull final OnSameL3NetworkResponseListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.isSameNetwork(l2Key1, l2Key2,
- OnSameL3NetworkResponseListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error checking for network sameness",
- () -> listener.onSameL3NetworkResponse(new Status(Status.ERROR_UNKNOWN), null));
- }
- }
-
- /**
- * Retrieve the network attributes for a key.
- * If no record is present for this key, this will return null attributes.
- *
- * @param l2Key The key of the network to query.
- * @param listener The listener that will be invoked to return the answer.
- * Through the listener, returns the network attributes and the L2 key associated with
- * the query.
- */
- public void retrieveNetworkAttributes(@NonNull final String l2Key,
- @NonNull final OnNetworkAttributesRetrievedListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.retrieveNetworkAttributes(l2Key,
- OnNetworkAttributesRetrievedListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error retrieving network attributes",
- () -> listener.onNetworkAttributesRetrieved(new Status(Status.ERROR_UNKNOWN),
- null, null));
- }
- }
-
- /**
- * Retrieve previously stored private data.
- * If no data was stored for this L2 key and name this will return null.
- *
- * @param l2Key The L2 key.
- * @param clientId The id of the client that stored this data.
- * @param name The name of the data.
- * @param listener The listener that will be invoked to return the answer.
- * Through the listener, returns the private data (or null), with the L2 key
- * and the name of the data associated with the query.
- */
- public void retrieveBlob(@NonNull final String l2Key, @NonNull final String clientId,
- @NonNull final String name, @NonNull final OnBlobRetrievedListener listener) {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.retrieveBlob(l2Key, clientId, name,
- OnBlobRetrievedListener.toAIDL(listener))));
- } catch (ExecutionException m) {
- ignoringRemoteException("Error retrieving blob",
- () -> listener.onBlobRetrieved(new Status(Status.ERROR_UNKNOWN),
- null, null, null));
- }
- }
-
- /**
- * Wipe the data in the database upon network factory reset.
- */
- public void factoryReset() {
- try {
- runWhenServiceReady(service -> ignoringRemoteException(
- () -> service.factoryReset()));
- } catch (ExecutionException m) {
- Log.e(TAG, "Error executing factory reset", m);
- }
- }
-}
diff --git a/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl b/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index 6f006d4..0000000
--- a/services/net/java/android/net/NattKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net;
-
-parcelable NattKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
-}
-
diff --git a/services/net/java/android/net/PrivateDnsConfigParcel.aidl b/services/net/java/android/net/PrivateDnsConfigParcel.aidl
deleted file mode 100644
index b52fce6..0000000
--- a/services/net/java/android/net/PrivateDnsConfigParcel.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 android.net;
-
-parcelable PrivateDnsConfigParcel {
- String hostname;
- String[] ips;
-}
diff --git a/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl b/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl
deleted file mode 100644
index 99606fb..0000000
--- a/services/net/java/android/net/ProvisioningConfigurationParcelable.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-**
-** Copyright (C) 2019 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 android.net;
-
-import android.net.InitialConfigurationParcelable;
-import android.net.Network;
-import android.net.StaticIpConfiguration;
-import android.net.apf.ApfCapabilities;
-
-parcelable ProvisioningConfigurationParcelable {
- boolean enableIPv4;
- boolean enableIPv6;
- boolean usingMultinetworkPolicyTracker;
- boolean usingIpReachabilityMonitor;
- int requestedPreDhcpActionMs;
- InitialConfigurationParcelable initialConfig;
- StaticIpConfiguration staticIpConfig;
- ApfCapabilities apfCapabilities;
- int provisioningTimeoutMs;
- int ipv6AddrGenMode;
- Network network;
- String displayName;
-}
diff --git a/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl b/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl
deleted file mode 100644
index e25168d..0000000
--- a/services/net/java/android/net/TcpKeepalivePacketDataParcelable.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net;
-
-parcelable TcpKeepalivePacketDataParcelable {
- byte[] srcAddress;
- int srcPort;
- byte[] dstAddress;
- int dstPort;
- int seq;
- int ack;
- int rcvWnd;
- int rcvWndScale;
- int tos;
- int ttl;
-}
diff --git a/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl b/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl
deleted file mode 100644
index 7b8b9ee..0000000
--- a/services/net/java/android/net/dhcp/DhcpServingParamsParcel.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- *
- * 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 android.net.dhcp;
-
-parcelable DhcpServingParamsParcel {
- int serverAddr;
- int serverAddrPrefixLength;
- int[] defaultRouters;
- int[] dnsServers;
- int[] excludedAddrs;
- long dhcpLeaseTimeSecs;
- int linkMtu;
- boolean metered;
-}
-
diff --git a/services/net/java/android/net/dhcp/IDhcpServer.aidl b/services/net/java/android/net/dhcp/IDhcpServer.aidl
deleted file mode 100644
index 559433b..0000000
--- a/services/net/java/android/net/dhcp/IDhcpServer.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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 perNmissions and
- * limitations under the License.
- */
-
-package android.net.dhcp;
-
-import android.net.INetworkStackStatusCallback;
-import android.net.dhcp.DhcpServingParamsParcel;
-
-/** @hide */
-oneway interface IDhcpServer {
- const int STATUS_UNKNOWN = 0;
- const int STATUS_SUCCESS = 1;
- const int STATUS_INVALID_ARGUMENT = 2;
- const int STATUS_UNKNOWN_ERROR = 3;
-
- void start(in INetworkStackStatusCallback cb);
- void updateParams(in DhcpServingParamsParcel params, in INetworkStackStatusCallback cb);
- void stop(in INetworkStackStatusCallback cb);
-}
diff --git a/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl b/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl
deleted file mode 100644
index 7ab4dcd..0000000
--- a/services/net/java/android/net/dhcp/IDhcpServerCallbacks.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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 perNmissions and
- * limitations under the License.
- */
-
-package android.net.dhcp;
-
-import android.net.dhcp.IDhcpServer;
-
-/** @hide */
-oneway interface IDhcpServerCallbacks {
- void onDhcpServerCreated(int statusCode, in IDhcpServer server);
-}
diff --git a/services/net/java/android/net/ip/IIpClient.aidl b/services/net/java/android/net/ip/IIpClient.aidl
deleted file mode 100644
index 9989c52..0000000
--- a/services/net/java/android/net/ip/IIpClient.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2019, 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 perNmissions and
- * limitations under the License.
- */
-package android.net.ip;
-
-import android.net.ProxyInfo;
-import android.net.ProvisioningConfigurationParcelable;
-import android.net.NattKeepalivePacketDataParcelable;
-import android.net.TcpKeepalivePacketDataParcelable;
-
-/** @hide */
-oneway interface IIpClient {
- void completedPreDhcpAction();
- void confirmConfiguration();
- void readPacketFilterComplete(in byte[] data);
- void shutdown();
- void startProvisioning(in ProvisioningConfigurationParcelable req);
- void stop();
- void setTcpBufferSizes(in String tcpBufferSizes);
- void setHttpProxy(in ProxyInfo proxyInfo);
- void setMulticastFilter(boolean enabled);
- void addKeepalivePacketFilter(int slot, in TcpKeepalivePacketDataParcelable pkt);
- void removeKeepalivePacketFilter(int slot);
- void setL2KeyAndGroupHint(in String l2Key, in String groupHint);
- void addNattKeepalivePacketFilter(int slot, in NattKeepalivePacketDataParcelable pkt);
-}
diff --git a/services/net/java/android/net/ip/IIpClientCallbacks.aidl b/services/net/java/android/net/ip/IIpClientCallbacks.aidl
deleted file mode 100644
index 3681416..0000000
--- a/services/net/java/android/net/ip/IIpClientCallbacks.aidl
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (c) 2019, 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 perNmissions and
- * limitations under the License.
- */
-package android.net.ip;
-
-import android.net.LinkProperties;
-import android.net.ip.IIpClient;
-import android.net.DhcpResultsParcelable;
-
-/** @hide */
-oneway interface IIpClientCallbacks {
- void onIpClientCreated(in IIpClient ipClient);
-
- void onPreDhcpAction();
- void onPostDhcpAction();
-
- // This is purely advisory and not an indication of provisioning
- // success or failure. This is only here for callers that want to
- // expose DHCPv4 results to other APIs (e.g., WifiInfo#setInetAddress).
- // DHCPv4 or static IPv4 configuration failure or success can be
- // determined by whether or not the passed-in DhcpResults object is
- // null or not.
- void onNewDhcpResults(in DhcpResultsParcelable dhcpResults);
-
- void onProvisioningSuccess(in LinkProperties newLp);
- void onProvisioningFailure(in LinkProperties newLp);
-
- // Invoked on LinkProperties changes.
- void onLinkPropertiesChange(in LinkProperties newLp);
-
- // Called when the internal IpReachabilityMonitor (if enabled) has
- // detected the loss of a critical number of required neighbors.
- void onReachabilityLost(in String logMsg);
-
- // Called when the IpClient state machine terminates.
- void onQuit();
-
- // Install an APF program to filter incoming packets.
- void installPacketFilter(in byte[] filter);
-
- // Asynchronously read back the APF program & data buffer from the wifi driver.
- // Due to Wifi HAL limitations, the current implementation only supports dumping the entire
- // buffer. In response to this request, the driver returns the data buffer asynchronously
- // by sending an IpClient#EVENT_READ_PACKET_FILTER_COMPLETE message.
- void startReadPacketFilter();
-
- // If multicast filtering cannot be accomplished with APF, this function will be called to
- // actuate multicast filtering using another means.
- void setFallbackMulticastFilter(boolean enabled);
-
- // Enabled/disable Neighbor Discover offload functionality. This is
- // called, for example, whenever 464xlat is being started or stopped.
- void setNeighborDiscoveryOffload(boolean enable);
-}
\ No newline at end of file
diff --git a/services/net/java/android/net/ipmemorystore/Blob.aidl b/services/net/java/android/net/ipmemorystore/Blob.aidl
deleted file mode 100644
index 9dbef11..0000000
--- a/services/net/java/android/net/ipmemorystore/Blob.aidl
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-/**
- * A blob of data opaque to the memory store. The client mutates this at its own risk,
- * and it is strongly suggested to never do it at all and treat this as immutable.
- * {@hide}
- */
-parcelable Blob {
- byte[] data;
-}
diff --git a/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl b/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
deleted file mode 100644
index 4926feb..0000000
--- a/services/net/java/android/net/ipmemorystore/IOnBlobRetrievedListener.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.net.ipmemorystore.Blob;
-import android.net.ipmemorystore.StatusParcelable;
-
-/** {@hide} */
-oneway interface IOnBlobRetrievedListener {
- /**
- * Private data was retrieved for the L2 key and name specified.
- * Note this does not return the client ID, as clients are expected to only ever use one ID.
- */
- void onBlobRetrieved(in StatusParcelable status, in String l2Key, in String name,
- in Blob data);
-}
diff --git a/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl b/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
deleted file mode 100644
index dea0cc4..0000000
--- a/services/net/java/android/net/ipmemorystore/IOnL2KeyResponseListener.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.net.ipmemorystore.StatusParcelable;
-
-/** {@hide} */
-oneway interface IOnL2KeyResponseListener {
- /**
- * The operation completed with the specified L2 key.
- */
- void onL2KeyResponse(in StatusParcelable status, in String l2Key);
-}
diff --git a/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl b/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
deleted file mode 100644
index 870e217..0000000
--- a/services/net/java/android/net/ipmemorystore/IOnNetworkAttributesRetrievedListener.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.net.ipmemorystore.NetworkAttributesParcelable;
-import android.net.ipmemorystore.StatusParcelable;
-
-/** {@hide} */
-oneway interface IOnNetworkAttributesRetrievedListener {
- /**
- * Network attributes were fetched for the specified L2 key. While the L2 key will never
- * be null, the attributes may be if no data is stored about this L2 key.
- */
- void onNetworkAttributesRetrieved(in StatusParcelable status, in String l2Key,
- in NetworkAttributesParcelable attributes);
-}
diff --git a/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl b/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
deleted file mode 100644
index b8ccfb9..0000000
--- a/services/net/java/android/net/ipmemorystore/IOnSameL3NetworkResponseListener.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.net.ipmemorystore.SameL3NetworkResponseParcelable;
-import android.net.ipmemorystore.StatusParcelable;
-
-/** {@hide} */
-oneway interface IOnSameL3NetworkResponseListener {
- /**
- * The memory store has come up with the answer to a query that was sent.
- */
- void onSameL3NetworkResponse(in StatusParcelable status,
- in SameL3NetworkResponseParcelable response);
-}
diff --git a/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl b/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl
deleted file mode 100644
index 5d07504..0000000
--- a/services/net/java/android/net/ipmemorystore/IOnStatusListener.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.net.ipmemorystore.StatusParcelable;
-
-/** {@hide} */
-oneway interface IOnStatusListener {
- /**
- * The operation has completed with the specified status.
- */
- void onComplete(in StatusParcelable status);
-}
diff --git a/services/net/java/android/net/ipmemorystore/NetworkAttributes.java b/services/net/java/android/net/ipmemorystore/NetworkAttributes.java
deleted file mode 100644
index 818515a..0000000
--- a/services/net/java/android/net/ipmemorystore/NetworkAttributes.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.StringJoiner;
-
-/**
- * A POD object to represent attributes of a single L2 network entry.
- * @hide
- */
-public class NetworkAttributes {
- private static final boolean DBG = true;
-
- // Weight cutoff for grouping. To group, a similarity score is computed with the following
- // algorithm : if both fields are non-null and equals() then add their assigned weight, else if
- // both are null then add a portion of their assigned weight (see NULL_MATCH_WEIGHT),
- // otherwise add nothing.
- // As a guideline, this should be something like 60~75% of the total weights in this class. The
- // design states "in essence a reader should imagine that if two important columns don't match,
- // or one important and several unimportant columns don't match then the two records are
- // considered a different group".
- private static final float TOTAL_WEIGHT_CUTOFF = 520.0f;
- // The portion of the weight that is earned when scoring group-sameness by having both columns
- // being null. This is because some networks rightfully don't have some attributes (e.g. a
- // V6-only network won't have an assigned V4 address) and both being null should count for
- // something, but attributes may also be null just because data is unavailable.
- private static final float NULL_MATCH_WEIGHT = 0.25f;
-
- // The v4 address that was assigned to this device the last time it joined this network.
- // This typically comes from DHCP but could be something else like static configuration.
- // This does not apply to IPv6.
- // TODO : add a list of v6 prefixes for the v6 case.
- @Nullable
- public final Inet4Address assignedV4Address;
- private static final float WEIGHT_ASSIGNEDV4ADDR = 300.0f;
-
- // The lease expiry timestamp of v4 address allocated from DHCP server, in milliseconds.
- @Nullable
- public final Long assignedV4AddressExpiry;
- // lease expiry doesn't imply any correlation between "the same lease expiry value" and "the
- // same L3 network".
- private static final float WEIGHT_ASSIGNEDV4ADDREXPIRY = 0.0f;
-
- // Optionally supplied by the client if it has an opinion on L3 network. For example, this
- // could be a hash of the SSID + security type on WiFi.
- @Nullable
- public final String groupHint;
- private static final float WEIGHT_GROUPHINT = 300.0f;
-
- // The list of DNS server addresses.
- @Nullable
- public final List<InetAddress> dnsAddresses;
- private static final float WEIGHT_DNSADDRESSES = 200.0f;
-
- // The mtu on this network.
- @Nullable
- public final Integer mtu;
- private static final float WEIGHT_MTU = 50.0f;
-
- // The sum of all weights in this class. Tests ensure that this stays equal to the total of
- // all weights.
- /** @hide */
- @VisibleForTesting
- public static final float TOTAL_WEIGHT = WEIGHT_ASSIGNEDV4ADDR
- + WEIGHT_ASSIGNEDV4ADDREXPIRY
- + WEIGHT_GROUPHINT
- + WEIGHT_DNSADDRESSES
- + WEIGHT_MTU;
-
- /** @hide */
- @VisibleForTesting
- public NetworkAttributes(
- @Nullable final Inet4Address assignedV4Address,
- @Nullable final Long assignedV4AddressExpiry,
- @Nullable final String groupHint,
- @Nullable final List<InetAddress> dnsAddresses,
- @Nullable final Integer mtu) {
- if (mtu != null && mtu < 0) throw new IllegalArgumentException("MTU can't be negative");
- if (assignedV4AddressExpiry != null && assignedV4AddressExpiry <= 0) {
- throw new IllegalArgumentException("lease expiry can't be negative or zero");
- }
- this.assignedV4Address = assignedV4Address;
- this.assignedV4AddressExpiry = assignedV4AddressExpiry;
- this.groupHint = groupHint;
- this.dnsAddresses = null == dnsAddresses ? null :
- Collections.unmodifiableList(new ArrayList<>(dnsAddresses));
- this.mtu = mtu;
- }
-
- @VisibleForTesting
- public NetworkAttributes(@NonNull final NetworkAttributesParcelable parcelable) {
- // The call to the other constructor must be the first statement of this constructor,
- // so everything has to be inline
- this((Inet4Address) getByAddressOrNull(parcelable.assignedV4Address),
- parcelable.assignedV4AddressExpiry > 0
- ? parcelable.assignedV4AddressExpiry : null,
- parcelable.groupHint,
- blobArrayToInetAddressList(parcelable.dnsAddresses),
- parcelable.mtu >= 0 ? parcelable.mtu : null);
- }
-
- @Nullable
- private static InetAddress getByAddressOrNull(@Nullable final byte[] address) {
- if (null == address) return null;
- try {
- return InetAddress.getByAddress(address);
- } catch (UnknownHostException e) {
- return null;
- }
- }
-
- @Nullable
- private static List<InetAddress> blobArrayToInetAddressList(@Nullable final Blob[] blobs) {
- if (null == blobs) return null;
- final ArrayList<InetAddress> list = new ArrayList<>(blobs.length);
- for (final Blob b : blobs) {
- final InetAddress addr = getByAddressOrNull(b.data);
- if (null != addr) list.add(addr);
- }
- return list;
- }
-
- @Nullable
- private static Blob[] inetAddressListToBlobArray(@Nullable final List<InetAddress> addresses) {
- if (null == addresses) return null;
- final ArrayList<Blob> blobs = new ArrayList<>();
- for (int i = 0; i < addresses.size(); ++i) {
- final InetAddress addr = addresses.get(i);
- if (null == addr) continue;
- final Blob b = new Blob();
- b.data = addr.getAddress();
- blobs.add(b);
- }
- return blobs.toArray(new Blob[0]);
- }
-
- /** Converts this NetworkAttributes to a parcelable object */
- @NonNull
- public NetworkAttributesParcelable toParcelable() {
- final NetworkAttributesParcelable parcelable = new NetworkAttributesParcelable();
- parcelable.assignedV4Address =
- (null == assignedV4Address) ? null : assignedV4Address.getAddress();
- parcelable.assignedV4AddressExpiry =
- (null == assignedV4AddressExpiry) ? 0 : assignedV4AddressExpiry;
- parcelable.groupHint = groupHint;
- parcelable.dnsAddresses = inetAddressListToBlobArray(dnsAddresses);
- parcelable.mtu = (null == mtu) ? -1 : mtu;
- return parcelable;
- }
-
- private float samenessContribution(final float weight,
- @Nullable final Object o1, @Nullable final Object o2) {
- if (null == o1) {
- return (null == o2) ? weight * NULL_MATCH_WEIGHT : 0f;
- }
- return Objects.equals(o1, o2) ? weight : 0f;
- }
-
- /** @hide */
- public float getNetworkGroupSamenessConfidence(@NonNull final NetworkAttributes o) {
- final float samenessScore =
- samenessContribution(WEIGHT_ASSIGNEDV4ADDR, assignedV4Address, o.assignedV4Address)
- + samenessContribution(WEIGHT_ASSIGNEDV4ADDREXPIRY, assignedV4AddressExpiry,
- o.assignedV4AddressExpiry)
- + samenessContribution(WEIGHT_GROUPHINT, groupHint, o.groupHint)
- + samenessContribution(WEIGHT_DNSADDRESSES, dnsAddresses, o.dnsAddresses)
- + samenessContribution(WEIGHT_MTU, mtu, o.mtu);
- // The minimum is 0, the max is TOTAL_WEIGHT and should be represented by 1.0, and
- // TOTAL_WEIGHT_CUTOFF should represent 0.5, but there is no requirement that
- // TOTAL_WEIGHT_CUTOFF would be half of TOTAL_WEIGHT (indeed, it should not be).
- // So scale scores under the cutoff between 0 and 0.5, and the scores over the cutoff
- // between 0.5 and 1.0.
- if (samenessScore < TOTAL_WEIGHT_CUTOFF) {
- return samenessScore / (TOTAL_WEIGHT_CUTOFF * 2);
- } else {
- return (samenessScore - TOTAL_WEIGHT_CUTOFF) / (TOTAL_WEIGHT - TOTAL_WEIGHT_CUTOFF) / 2
- + 0.5f;
- }
- }
-
- /** @hide */
- public static class Builder {
- @Nullable
- private Inet4Address mAssignedAddress;
- @Nullable
- private Long mAssignedAddressExpiry;
- @Nullable
- private String mGroupHint;
- @Nullable
- private List<InetAddress> mDnsAddresses;
- @Nullable
- private Integer mMtu;
-
- /**
- * Set the assigned address.
- * @param assignedV4Address The assigned address.
- * @return This builder.
- */
- public Builder setAssignedV4Address(@Nullable final Inet4Address assignedV4Address) {
- mAssignedAddress = assignedV4Address;
- return this;
- }
-
- /**
- * Set the lease expiry timestamp of assigned v4 address. Long.MAX_VALUE is used
- * to represent "infinite lease".
- *
- * @param assignedV4AddressExpiry The lease expiry timestamp of assigned v4 address.
- * @return This builder.
- */
- public Builder setAssignedV4AddressExpiry(
- @Nullable final Long assignedV4AddressExpiry) {
- if (null != assignedV4AddressExpiry && assignedV4AddressExpiry <= 0) {
- throw new IllegalArgumentException("lease expiry can't be negative or zero");
- }
- mAssignedAddressExpiry = assignedV4AddressExpiry;
- return this;
- }
-
- /**
- * Set the group hint.
- * @param groupHint The group hint.
- * @return This builder.
- */
- public Builder setGroupHint(@Nullable final String groupHint) {
- mGroupHint = groupHint;
- return this;
- }
-
- /**
- * Set the DNS addresses.
- * @param dnsAddresses The DNS addresses.
- * @return This builder.
- */
- public Builder setDnsAddresses(@Nullable final List<InetAddress> dnsAddresses) {
- if (DBG && null != dnsAddresses) {
- // Parceling code crashes if one of the addresses is null, therefore validate
- // them when running in debug.
- for (final InetAddress address : dnsAddresses) {
- if (null == address) throw new IllegalArgumentException("Null DNS address");
- }
- }
- this.mDnsAddresses = dnsAddresses;
- return this;
- }
-
- /**
- * Set the MTU.
- * @param mtu The MTU.
- * @return This builder.
- */
- public Builder setMtu(@Nullable final Integer mtu) {
- if (null != mtu && mtu < 0) throw new IllegalArgumentException("MTU can't be negative");
- mMtu = mtu;
- return this;
- }
-
- /**
- * Return the built NetworkAttributes object.
- * @return The built NetworkAttributes object.
- */
- public NetworkAttributes build() {
- return new NetworkAttributes(mAssignedAddress, mAssignedAddressExpiry,
- mGroupHint, mDnsAddresses, mMtu);
- }
- }
-
- /** @hide */
- public boolean isEmpty() {
- return (null == assignedV4Address) && (null == assignedV4AddressExpiry)
- && (null == groupHint) && (null == dnsAddresses) && (null == mtu);
- }
-
- @Override
- public boolean equals(@Nullable final Object o) {
- if (!(o instanceof NetworkAttributes)) return false;
- final NetworkAttributes other = (NetworkAttributes) o;
- return Objects.equals(assignedV4Address, other.assignedV4Address)
- && Objects.equals(assignedV4AddressExpiry, other.assignedV4AddressExpiry)
- && Objects.equals(groupHint, other.groupHint)
- && Objects.equals(dnsAddresses, other.dnsAddresses)
- && Objects.equals(mtu, other.mtu);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(assignedV4Address, assignedV4AddressExpiry,
- groupHint, dnsAddresses, mtu);
- }
-
- /** Pretty print */
- @Override
- public String toString() {
- final StringJoiner resultJoiner = new StringJoiner(" ", "{", "}");
- final ArrayList<String> nullFields = new ArrayList<>();
-
- if (null != assignedV4Address) {
- resultJoiner.add("assignedV4Addr :");
- resultJoiner.add(assignedV4Address.toString());
- } else {
- nullFields.add("assignedV4Addr");
- }
-
- if (null != assignedV4AddressExpiry) {
- resultJoiner.add("assignedV4AddressExpiry :");
- resultJoiner.add(assignedV4AddressExpiry.toString());
- } else {
- nullFields.add("assignedV4AddressExpiry");
- }
-
- if (null != groupHint) {
- resultJoiner.add("groupHint :");
- resultJoiner.add(groupHint);
- } else {
- nullFields.add("groupHint");
- }
-
- if (null != dnsAddresses) {
- resultJoiner.add("dnsAddr : [");
- for (final InetAddress addr : dnsAddresses) {
- resultJoiner.add(addr.getHostAddress());
- }
- resultJoiner.add("]");
- } else {
- nullFields.add("dnsAddr");
- }
-
- if (null != mtu) {
- resultJoiner.add("mtu :");
- resultJoiner.add(mtu.toString());
- } else {
- nullFields.add("mtu");
- }
-
- if (!nullFields.isEmpty()) {
- resultJoiner.add("; Null fields : [");
- for (final String field : nullFields) {
- resultJoiner.add(field);
- }
- resultJoiner.add("]");
- }
-
- return resultJoiner.toString();
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl b/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
deleted file mode 100644
index 997eb2b..0000000
--- a/services/net/java/android/net/ipmemorystore/NetworkAttributesParcelable.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-// Blob[] is used to represent an array of byte[], as structured AIDL does not support arrays
-// of arrays.
-import android.net.ipmemorystore.Blob;
-
-/**
- * An object to represent attributes of a single L2 network entry.
- * See NetworkAttributes.java for a description of each field. The types used in this class
- * are structured parcelable types instead of the richer types of the NetworkAttributes object,
- * but they have the same purpose. The NetworkAttributes.java file also contains the code
- * to convert the richer types to the parcelable types and back.
- * @hide
- */
-parcelable NetworkAttributesParcelable {
- byte[] assignedV4Address;
- long assignedV4AddressExpiry;
- String groupHint;
- Blob[] dnsAddresses;
- int mtu;
-}
diff --git a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java
deleted file mode 100644
index a17483a..0000000
--- a/services/net/java/android/net/ipmemorystore/OnBlobRetrievedListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-
-/**
- * A listener for the IpMemoryStore to return a blob.
- * @hide
- */
-public interface OnBlobRetrievedListener {
- /**
- * The memory store has come up with the answer to a query that was sent.
- */
- void onBlobRetrieved(Status status, String l2Key, String name, Blob blob);
-
- /** Converts this OnBlobRetrievedListener to a parcelable object */
- @NonNull
- static IOnBlobRetrievedListener toAIDL(@NonNull final OnBlobRetrievedListener listener) {
- return new IOnBlobRetrievedListener.Stub() {
- @Override
- public void onBlobRetrieved(final StatusParcelable statusParcelable, final String l2Key,
- final String name, final Blob blob) {
- // NonNull, but still don't crash the system server if null
- if (null != listener) {
- listener.onBlobRetrieved(new Status(statusParcelable), l2Key, name, blob);
- }
- }
-
- @Override
- public int getInterfaceVersion() {
- return this.VERSION;
- }
- };
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java b/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java
deleted file mode 100644
index e608aec..0000000
--- a/services/net/java/android/net/ipmemorystore/OnL2KeyResponseListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-
-/**
- * A listener for the IpMemoryStore to return a L2 key.
- * @hide
- */
-public interface OnL2KeyResponseListener {
- /**
- * The operation has completed with the specified status.
- */
- void onL2KeyResponse(Status status, String l2Key);
-
- /** Converts this OnL2KeyResponseListener to a parcelable object */
- @NonNull
- static IOnL2KeyResponseListener toAIDL(@NonNull final OnL2KeyResponseListener listener) {
- return new IOnL2KeyResponseListener.Stub() {
- @Override
- public void onL2KeyResponse(final StatusParcelable statusParcelable,
- final String l2Key) {
- // NonNull, but still don't crash the system server if null
- if (null != listener) {
- listener.onL2KeyResponse(new Status(statusParcelable), l2Key);
- }
- }
-
- @Override
- public int getInterfaceVersion() {
- return this.VERSION;
- }
- };
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java b/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java
deleted file mode 100644
index 395ad98..0000000
--- a/services/net/java/android/net/ipmemorystore/OnNetworkAttributesRetrievedListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-
-/**
- * A listener for the IpMemoryStore to return network attributes.
- * @hide
- */
-public interface OnNetworkAttributesRetrievedListener {
- /**
- * The memory store has come up with the answer to a query that was sent.
- */
- void onNetworkAttributesRetrieved(Status status, String l2Key, NetworkAttributes attributes);
-
- /** Converts this OnNetworkAttributesRetrievedListener to a parcelable object */
- @NonNull
- static IOnNetworkAttributesRetrievedListener toAIDL(
- @NonNull final OnNetworkAttributesRetrievedListener listener) {
- return new IOnNetworkAttributesRetrievedListener.Stub() {
- @Override
- public void onNetworkAttributesRetrieved(final StatusParcelable statusParcelable,
- final String l2Key,
- final NetworkAttributesParcelable networkAttributesParcelable) {
- // NonNull, but still don't crash the system server if null
- if (null != listener) {
- listener.onNetworkAttributesRetrieved(
- new Status(statusParcelable), l2Key, null == networkAttributesParcelable
- ? null : new NetworkAttributes(networkAttributesParcelable));
- }
- }
-
- @Override
- public int getInterfaceVersion() {
- return this.VERSION;
- }
- };
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java b/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java
deleted file mode 100644
index 67f8da8..0000000
--- a/services/net/java/android/net/ipmemorystore/OnSameL3NetworkResponseListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-
-/**
- * A listener for the IpMemoryStore to return a response about network sameness.
- * @hide
- */
-public interface OnSameL3NetworkResponseListener {
- /**
- * The memory store has come up with the answer to a query that was sent.
- */
- void onSameL3NetworkResponse(Status status, SameL3NetworkResponse response);
-
- /** Converts this OnSameL3NetworkResponseListener to a parcelable object */
- @NonNull
- static IOnSameL3NetworkResponseListener toAIDL(
- @NonNull final OnSameL3NetworkResponseListener listener) {
- return new IOnSameL3NetworkResponseListener.Stub() {
- @Override
- public void onSameL3NetworkResponse(final StatusParcelable statusParcelable,
- final SameL3NetworkResponseParcelable sameL3NetworkResponseParcelable) {
- // NonNull, but still don't crash the system server if null
- if (null != listener) {
- listener.onSameL3NetworkResponse(
- new Status(statusParcelable),
- new SameL3NetworkResponse(sameL3NetworkResponseParcelable));
- }
- }
-
- @Override
- public int getInterfaceVersion() {
- return this.VERSION;
- }
- };
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/OnStatusListener.java b/services/net/java/android/net/ipmemorystore/OnStatusListener.java
deleted file mode 100644
index 4262efd..0000000
--- a/services/net/java/android/net/ipmemorystore/OnStatusListener.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
-/**
- * A listener for the IpMemoryStore to return a status to a client.
- * @hide
- */
-public interface OnStatusListener {
- /**
- * The operation has completed with the specified status.
- */
- void onComplete(Status status);
-
- /** Converts this OnStatusListener to a parcelable object */
- @NonNull
- static IOnStatusListener toAIDL(@Nullable final OnStatusListener listener) {
- return new IOnStatusListener.Stub() {
- @Override
- public void onComplete(final StatusParcelable statusParcelable) {
- if (null != listener) {
- listener.onComplete(new Status(statusParcelable));
- }
- }
-
- @Override
- public int getInterfaceVersion() {
- return this.VERSION;
- }
- };
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java b/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java
deleted file mode 100644
index 291aca8..0000000
--- a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponse.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.Objects;
-
-/**
- * An object representing the answer to a query whether two given L2 networks represent the
- * same L3 network. Parcels as a SameL3NetworkResponseParceled object.
- * @hide
- */
-public class SameL3NetworkResponse {
- @IntDef(prefix = "NETWORK_",
- value = {NETWORK_SAME, NETWORK_DIFFERENT, NETWORK_NEVER_CONNECTED})
- @Retention(RetentionPolicy.SOURCE)
- public @interface NetworkSameness {}
-
- /**
- * Both L2 networks represent the same L3 network.
- */
- public static final int NETWORK_SAME = 1;
-
- /**
- * The two L2 networks represent a different L3 network.
- */
- public static final int NETWORK_DIFFERENT = 2;
-
- /**
- * The device has never connected to at least one of these two L2 networks, or data
- * has been wiped. Therefore the device has never seen the L3 network behind at least
- * one of these two L2 networks, and can't evaluate whether it's the same as the other.
- */
- public static final int NETWORK_NEVER_CONNECTED = 3;
-
- /**
- * The first L2 key specified in the query.
- */
- @NonNull
- public final String l2Key1;
-
- /**
- * The second L2 key specified in the query.
- */
- @NonNull
- public final String l2Key2;
-
- /**
- * A confidence value indicating whether the two L2 networks represent the same L3 network.
- *
- * If both L2 networks were known, this value will be between 0.0 and 1.0, with 0.0
- * representing complete confidence that the given L2 networks represent a different
- * L3 network, and 1.0 representing complete confidence that the given L2 networks
- * represent the same L3 network.
- * If at least one of the L2 networks was not known, this value will be outside of the
- * 0.0~1.0 range.
- *
- * Most apps should not be interested in this, and are encouraged to use the collapsing
- * {@link #getNetworkSameness()} function below.
- */
- public final float confidence;
-
- /**
- * @return whether the two L2 networks represent the same L3 network. Either
- * {@code NETWORK_SAME}, {@code NETWORK_DIFFERENT} or {@code NETWORK_NEVER_CONNECTED}.
- */
- @NetworkSameness
- public final int getNetworkSameness() {
- if (confidence > 1.0 || confidence < 0.0) return NETWORK_NEVER_CONNECTED;
- return confidence > 0.5 ? NETWORK_SAME : NETWORK_DIFFERENT;
- }
-
- /** @hide */
- public SameL3NetworkResponse(@NonNull final String l2Key1, @NonNull final String l2Key2,
- final float confidence) {
- this.l2Key1 = l2Key1;
- this.l2Key2 = l2Key2;
- this.confidence = confidence;
- }
-
- /** Builds a SameL3NetworkResponse from a parcelable object */
- @VisibleForTesting
- public SameL3NetworkResponse(@NonNull final SameL3NetworkResponseParcelable parceled) {
- this(parceled.l2Key1, parceled.l2Key2, parceled.confidence);
- }
-
- /** Converts this SameL3NetworkResponse to a parcelable object */
- @NonNull
- public SameL3NetworkResponseParcelable toParcelable() {
- final SameL3NetworkResponseParcelable parcelable = new SameL3NetworkResponseParcelable();
- parcelable.l2Key1 = l2Key1;
- parcelable.l2Key2 = l2Key2;
- parcelable.confidence = confidence;
- return parcelable;
- }
-
- // Note key1 and key2 have to match each other for this to return true. If
- // key1 matches o.key2 and the other way around this returns false.
- @Override
- public boolean equals(@Nullable final Object o) {
- if (!(o instanceof SameL3NetworkResponse)) return false;
- final SameL3NetworkResponse other = (SameL3NetworkResponse) o;
- return l2Key1.equals(other.l2Key1) && l2Key2.equals(other.l2Key2)
- && confidence == other.confidence;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(l2Key1, l2Key2, confidence);
- }
-
- @Override
- /** Pretty print */
- public String toString() {
- switch (getNetworkSameness()) {
- case NETWORK_SAME:
- return "\"" + l2Key1 + "\" same L3 network as \"" + l2Key2 + "\"";
- case NETWORK_DIFFERENT:
- return "\"" + l2Key1 + "\" different L3 network from \"" + l2Key2 + "\"";
- case NETWORK_NEVER_CONNECTED:
- return "\"" + l2Key1 + "\" can't be tested against \"" + l2Key2 + "\"";
- default:
- return "Buggy sameness value ? \"" + l2Key1 + "\", \"" + l2Key2 + "\"";
- }
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl b/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
deleted file mode 100644
index 7196699..0000000
--- a/services/net/java/android/net/ipmemorystore/SameL3NetworkResponseParcelable.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-/** {@hide} */
-parcelable SameL3NetworkResponseParcelable {
- String l2Key1;
- String l2Key2;
- float confidence;
-}
diff --git a/services/net/java/android/net/ipmemorystore/Status.java b/services/net/java/android/net/ipmemorystore/Status.java
deleted file mode 100644
index 13242c0..0000000
--- a/services/net/java/android/net/ipmemorystore/Status.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-import android.annotation.NonNull;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-/**
- * A parcelable status representing the result of an operation.
- * Parcels as StatusParceled.
- * @hide
- */
-public class Status {
- public static final int SUCCESS = 0;
-
- public static final int ERROR_GENERIC = -1;
- public static final int ERROR_ILLEGAL_ARGUMENT = -2;
- public static final int ERROR_DATABASE_CANNOT_BE_OPENED = -3;
- public static final int ERROR_STORAGE = -4;
- public static final int ERROR_UNKNOWN = -5;
-
- public final int resultCode;
-
- public Status(final int resultCode) {
- this.resultCode = resultCode;
- }
-
- @VisibleForTesting
- public Status(@NonNull final StatusParcelable parcelable) {
- this(parcelable.resultCode);
- }
-
- /** Converts this Status to a parcelable object */
- @NonNull
- public StatusParcelable toParcelable() {
- final StatusParcelable parcelable = new StatusParcelable();
- parcelable.resultCode = resultCode;
- return parcelable;
- }
-
- public boolean isSuccess() {
- return SUCCESS == resultCode;
- }
-
- /** Pretty print */
- @Override
- public String toString() {
- switch (resultCode) {
- case SUCCESS: return "SUCCESS";
- case ERROR_GENERIC: return "GENERIC ERROR";
- case ERROR_ILLEGAL_ARGUMENT: return "ILLEGAL ARGUMENT";
- case ERROR_DATABASE_CANNOT_BE_OPENED: return "DATABASE CANNOT BE OPENED";
- // "DB storage error" is not very helpful but SQLite does not provide specific error
- // codes upon store failure. Thus this indicates SQLite returned some error upon store
- case ERROR_STORAGE: return "DATABASE STORAGE ERROR";
- default: return "Unknown value ?!";
- }
- }
-}
diff --git a/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl b/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl
deleted file mode 100644
index fb36ef4..0000000
--- a/services/net/java/android/net/ipmemorystore/StatusParcelable.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 android.net.ipmemorystore;
-
-/** {@hide} */
-parcelable StatusParcelable {
- int resultCode;
-}
diff --git a/services/tests/servicestests/src/com/android/server/backup/transport/DelegatingTransportTest.java b/services/tests/servicestests/src/com/android/server/backup/transport/DelegatingTransportTest.java
new file mode 100644
index 0000000..bae11eb
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/backup/transport/DelegatingTransportTest.java
@@ -0,0 +1,386 @@
+/*
+ * Copyright (C) 2019 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.server.backup.transport;
+
+import static junit.framework.Assert.assertEquals;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+import android.app.backup.RestoreDescription;
+import android.app.backup.RestoreSet;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.backup.IBackupTransport;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class DelegatingTransportTest {
+ @Mock private IBackupTransport mBackupTransport;
+ @Mock private PackageInfo mPackageInfo;
+ @Mock private ParcelFileDescriptor mFd;
+
+ private final String mPackageName = "testpackage";
+ private final RestoreSet mRestoreSet = new RestoreSet();
+ private final int mFlags = 1;
+ private final long mRestoreToken = 10;
+ private final long mSize = 100;
+ private final int mNumBytes = 1000;
+ private DelegatingTransport mDelegatingTransport;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mDelegatingTransport = new DelegatingTransport() {
+ @Override
+ protected IBackupTransport getDelegate() {
+ return mBackupTransport;
+ }
+ };
+ }
+
+ @Test
+ public void testName() throws RemoteException {
+ String exp = "dummy";
+ when(mBackupTransport.name()).thenReturn(exp);
+
+ String ret = mDelegatingTransport.name();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).name();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testConfigurationIntent() throws RemoteException {
+ Intent exp = new Intent("dummy");
+ when(mBackupTransport.configurationIntent()).thenReturn(exp);
+
+ Intent ret = mDelegatingTransport.configurationIntent();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).configurationIntent();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testCurrentDestinationString() throws RemoteException {
+ String exp = "dummy";
+ when(mBackupTransport.currentDestinationString()).thenReturn(exp);
+
+ String ret = mDelegatingTransport.currentDestinationString();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).currentDestinationString();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testDataManagementIntent() throws RemoteException {
+ Intent exp = new Intent("dummy");
+ when(mBackupTransport.dataManagementIntent()).thenReturn(exp);
+
+ Intent ret = mDelegatingTransport.dataManagementIntent();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).dataManagementIntent();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testDataManagementIntentLabel() throws RemoteException {
+ String exp = "dummy";
+ when(mBackupTransport.dataManagementIntentLabel()).thenReturn(exp);
+
+ CharSequence ret = mDelegatingTransport.dataManagementIntentLabel();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).dataManagementIntentLabel();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testTransportDirName() throws RemoteException {
+ String exp = "dummy";
+ when(mBackupTransport.transportDirName()).thenReturn(exp);
+
+ String ret = mDelegatingTransport.transportDirName();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).transportDirName();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testRequestBackupTime() throws RemoteException {
+ long exp = 1000L;
+ when(mBackupTransport.requestBackupTime()).thenReturn(exp);
+
+ long ret = mDelegatingTransport.requestBackupTime();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).requestBackupTime();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testInitializeDevice() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.initializeDevice()).thenReturn(exp);
+
+ long ret = mDelegatingTransport.initializeDevice();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).initializeDevice();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testPerformBackup() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.performBackup(mPackageInfo, mFd, mFlags)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.performBackup(mPackageInfo, mFd, mFlags);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).performBackup(mPackageInfo, mFd, mFlags);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testClearBackupData() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.clearBackupData(mPackageInfo)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.clearBackupData(mPackageInfo);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).clearBackupData(mPackageInfo);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testFinishBackup() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.finishBackup()).thenReturn(exp);
+
+ int ret = mDelegatingTransport.finishBackup();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).finishBackup();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetAvailableRestoreSets() throws RemoteException {
+ RestoreSet[] exp = new RestoreSet[] {mRestoreSet};
+ when(mBackupTransport.getAvailableRestoreSets()).thenReturn(exp);
+
+ RestoreSet[] ret = mDelegatingTransport.getAvailableRestoreSets();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getAvailableRestoreSets();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetCurrentRestoreSet() throws RemoteException {
+ long exp = 1000;
+ when(mBackupTransport.getCurrentRestoreSet()).thenReturn(exp);
+
+ long ret = mDelegatingTransport.getCurrentRestoreSet();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getCurrentRestoreSet();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testStartRestore() throws RemoteException {
+ int exp = 1000;
+ PackageInfo[] packageInfos = {mPackageInfo};
+ when(mBackupTransport.startRestore(mRestoreToken, packageInfos)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.startRestore(mRestoreToken, packageInfos);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).startRestore(mRestoreToken, packageInfos);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testNextRestorePackage() throws RemoteException {
+ RestoreDescription exp = new RestoreDescription(mPackageName, 1);
+ when(mBackupTransport.nextRestorePackage()).thenReturn(exp);
+
+ RestoreDescription ret = mDelegatingTransport.nextRestorePackage();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).nextRestorePackage();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetRestoreData() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.getRestoreData(mFd)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.getRestoreData(mFd);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getRestoreData(mFd);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void tesFinishRestore() throws RemoteException {
+ mDelegatingTransport.finishRestore();
+
+ verify(mBackupTransport, times(1)).finishRestore();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testRequestFullBackupTime() throws RemoteException {
+ long exp = 1000L;
+ when(mBackupTransport.requestFullBackupTime()).thenReturn(exp);
+
+ long ret = mDelegatingTransport.requestFullBackupTime();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).requestFullBackupTime();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testPerformFullBackup() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.performFullBackup(mPackageInfo, mFd, mFlags)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.performFullBackup(mPackageInfo, mFd, mFlags);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).performFullBackup(mPackageInfo, mFd, mFlags);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testCheckFullBackupSize() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.checkFullBackupSize(mSize)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.checkFullBackupSize(mSize);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).checkFullBackupSize(mSize);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testSendBackupData() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.sendBackupData(mNumBytes)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.sendBackupData(mNumBytes);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).sendBackupData(mNumBytes);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testCancelFullBackup() throws RemoteException {
+ mDelegatingTransport.cancelFullBackup();
+
+ verify(mBackupTransport, times(1)).cancelFullBackup();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testIsAppEligibleForBackup() throws RemoteException {
+ boolean exp = true;
+ when(mBackupTransport.isAppEligibleForBackup(mPackageInfo, true)).thenReturn(exp);
+
+ boolean ret = mDelegatingTransport.isAppEligibleForBackup(mPackageInfo, true);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).isAppEligibleForBackup(mPackageInfo, true);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetBackupQuota() throws RemoteException {
+ long exp = 1000;
+ when(mBackupTransport.getBackupQuota(mPackageName, true)).thenReturn(exp);
+
+ long ret = mDelegatingTransport.getBackupQuota(mPackageName, true);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getBackupQuota(mPackageName, true);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetNextFullRestoreDataChunk() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.getNextFullRestoreDataChunk(mFd)).thenReturn(exp);
+
+ int ret = mDelegatingTransport.getNextFullRestoreDataChunk(mFd);
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getNextFullRestoreDataChunk(mFd);
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testAbortFullRestore() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.abortFullRestore()).thenReturn(exp);
+
+ int ret = mDelegatingTransport.abortFullRestore();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).abortFullRestore();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+
+ @Test
+ public void testGetTransportFlags() throws RemoteException {
+ int exp = 1000;
+ when(mBackupTransport.getTransportFlags()).thenReturn(exp);
+
+ int ret = mDelegatingTransport.getTransportFlags();
+
+ assertEquals(exp, ret);
+ verify(mBackupTransport, times(1)).getTransportFlags();
+ verifyNoMoreInteractions(mBackupTransport);
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/protolog/ProtoLogImplTest.java b/services/tests/servicestests/src/com/android/server/protolog/ProtoLogImplTest.java
new file mode 100644
index 0000000..7aa3d0d
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/protolog/ProtoLogImplTest.java
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2019 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.server.protolog;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import static com.android.server.protolog.ProtoLogImpl.PROTOLOG_VERSION;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.SystemClock;
+import android.platform.test.annotations.Presubmit;
+import android.util.proto.ProtoInputStream;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.server.protolog.common.IProtoLogGroup;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.LinkedList;
+
+/**
+ * Test class for {@link ProtoLogImpl}.
+ */
+@SuppressWarnings("ConstantConditions")
+@SmallTest
+@Presubmit
+@RunWith(JUnit4.class)
+public class ProtoLogImplTest {
+
+ private static final byte[] MAGIC_HEADER = new byte[]{
+ 0x9, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x4c, 0x4f, 0x47
+ };
+
+ private ProtoLogImpl mProtoLog;
+ private File mFile;
+
+ @Mock
+ private ProtoLogViewerConfigReader mReader;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ final Context testContext = getInstrumentation().getContext();
+ mFile = testContext.getFileStreamPath("tracing_test.dat");
+ //noinspection ResultOfMethodCallIgnored
+ mFile.delete();
+ mProtoLog = new ProtoLogImpl(mFile, 1024 * 1024, mReader);
+ }
+
+ @After
+ public void tearDown() {
+ if (mFile != null) {
+ //noinspection ResultOfMethodCallIgnored
+ mFile.delete();
+ }
+ ProtoLogImpl.setSingleInstance(null);
+ }
+
+ @Test
+ public void isEnabled_returnsFalseByDefault() {
+ assertFalse(mProtoLog.isProtoEnabled());
+ }
+
+ @Test
+ public void isEnabled_returnsTrueAfterStart() {
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ assertTrue(mProtoLog.isProtoEnabled());
+ }
+
+ @Test
+ public void isEnabled_returnsFalseAfterStop() {
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ mProtoLog.stopProtoLog(mock(PrintWriter.class), true);
+ assertFalse(mProtoLog.isProtoEnabled());
+ }
+
+ @Test
+ public void logFile_startsWithMagicHeader() throws Exception {
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ mProtoLog.stopProtoLog(mock(PrintWriter.class), true);
+
+ assertTrue("Log file should exist", mFile.exists());
+
+ byte[] header = new byte[MAGIC_HEADER.length];
+ try (InputStream is = new FileInputStream(mFile)) {
+ assertEquals(MAGIC_HEADER.length, is.read(header));
+ assertArrayEquals(MAGIC_HEADER, header);
+ }
+ }
+
+ @Test
+ public void getSingleInstance() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ assertSame(mockedProtoLog, ProtoLogImpl.getSingleInstance());
+ }
+
+ @Test
+ public void d_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.d(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.DEBUG), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void v_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.v(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.VERBOSE), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void i_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.i(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.INFO), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void w_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.w(TestProtoLogGroup.TEST_GROUP, 1234,
+ 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.WARN), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void e_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.e(TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.ERROR), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void wtf_logCalled() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogImpl.wtf(TestProtoLogGroup.TEST_GROUP,
+ 1234, 4321, "test %d");
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.WTF), eq(
+ TestProtoLogGroup.TEST_GROUP),
+ eq(1234), eq(4321), eq("test %d"), eq(new Object[]{}));
+ }
+
+ @Test
+ public void log_logcatEnabledExternalMessage() {
+ when(mReader.getViewerString(anyInt())).thenReturn("test %b %d %% %o %x %e %g %s %f");
+ ProtoLogImpl implSpy = Mockito.spy(mProtoLog);
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+
+ implSpy.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null,
+ new Object[]{true, 10000, 20000, 30000, 0.0001, 0.00002, "test", 0.000003});
+
+ verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq(
+ ProtoLogImpl.LogLevel.INFO),
+ eq("test true 10000 % 47040 7530 1.000000e-04 2.00000e-05 test 0.000003"));
+ verify(mReader).getViewerString(eq(1234));
+ }
+
+ @Test
+ public void log_logcatEnabledInvalidMessage() {
+ when(mReader.getViewerString(anyInt())).thenReturn("test %b %d %% %o %x %e %g %s %f");
+ ProtoLogImpl implSpy = Mockito.spy(mProtoLog);
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+
+ implSpy.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null,
+ new Object[]{true, 10000, 0.0001, 0.00002, "test"});
+
+ verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq(
+ ProtoLogImpl.LogLevel.INFO),
+ eq("UNKNOWN MESSAGE (1234) true 10000 1.0E-4 2.0E-5 test"));
+ verify(mReader).getViewerString(eq(1234));
+ }
+
+ @Test
+ public void log_logcatEnabledInlineMessage() {
+ when(mReader.getViewerString(anyInt())).thenReturn("test %d");
+ ProtoLogImpl implSpy = Mockito.spy(mProtoLog);
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+
+ implSpy.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d",
+ new Object[]{5});
+
+ verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq(
+ ProtoLogImpl.LogLevel.INFO), eq("test 5"));
+ verify(mReader, never()).getViewerString(anyInt());
+ }
+
+ @Test
+ public void log_logcatEnabledNoMessage() {
+ when(mReader.getViewerString(anyInt())).thenReturn(null);
+ ProtoLogImpl implSpy = Mockito.spy(mProtoLog);
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(true);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+
+ implSpy.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, null,
+ new Object[]{5});
+
+ verify(implSpy).passToLogcat(eq(TestProtoLogGroup.TEST_GROUP.getTag()), eq(
+ ProtoLogImpl.LogLevel.INFO), eq("UNKNOWN MESSAGE (1234) 5"));
+ verify(mReader).getViewerString(eq(1234));
+ }
+
+ @Test
+ public void log_logcatDisabled() {
+ when(mReader.getViewerString(anyInt())).thenReturn("test %d");
+ ProtoLogImpl implSpy = Mockito.spy(mProtoLog);
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+
+ implSpy.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234, 4321, "test %d",
+ new Object[]{5});
+
+ verify(implSpy, never()).passToLogcat(any(), any(), any());
+ verify(mReader, never()).getViewerString(anyInt());
+ }
+
+ private static class ProtoLogData {
+ Integer mMessageHash = null;
+ Long mElapsedTime = null;
+ LinkedList<String> mStrParams = new LinkedList<>();
+ LinkedList<Long> mSint64Params = new LinkedList<>();
+ LinkedList<Double> mDoubleParams = new LinkedList<>();
+ LinkedList<Boolean> mBooleanParams = new LinkedList<>();
+ }
+
+ private ProtoLogData readProtoLogSingle(ProtoInputStream ip) throws IOException {
+ while (ip.nextField() != ProtoInputStream.NO_MORE_FIELDS) {
+ if (ip.getFieldNumber() == (int) ProtoLogFileProto.VERSION) {
+ assertEquals(PROTOLOG_VERSION, ip.readString(ProtoLogFileProto.VERSION));
+ continue;
+ }
+ if (ip.getFieldNumber() != (int) ProtoLogFileProto.LOG) {
+ continue;
+ }
+ long token = ip.start(ProtoLogFileProto.LOG);
+ ProtoLogData data = new ProtoLogData();
+ while (ip.nextField() != ProtoInputStream.NO_MORE_FIELDS) {
+ switch (ip.getFieldNumber()) {
+ case (int) ProtoLogMessage.MESSAGE_HASH: {
+ data.mMessageHash = ip.readInt(ProtoLogMessage.MESSAGE_HASH);
+ break;
+ }
+ case (int) ProtoLogMessage.ELAPSED_REALTIME_NANOS: {
+ data.mElapsedTime = ip.readLong(ProtoLogMessage.ELAPSED_REALTIME_NANOS);
+ break;
+ }
+ case (int) ProtoLogMessage.STR_PARAMS: {
+ data.mStrParams.add(ip.readString(ProtoLogMessage.STR_PARAMS));
+ break;
+ }
+ case (int) ProtoLogMessage.SINT64_PARAMS: {
+ data.mSint64Params.add(ip.readLong(ProtoLogMessage.SINT64_PARAMS));
+ break;
+ }
+ case (int) ProtoLogMessage.DOUBLE_PARAMS: {
+ data.mDoubleParams.add(ip.readDouble(ProtoLogMessage.DOUBLE_PARAMS));
+ break;
+ }
+ case (int) ProtoLogMessage.BOOLEAN_PARAMS: {
+ data.mBooleanParams.add(ip.readBoolean(ProtoLogMessage.BOOLEAN_PARAMS));
+ break;
+ }
+ }
+ }
+ ip.end(token);
+ return data;
+ }
+ return null;
+ }
+
+ @Test
+ public void log_protoEnabled() throws Exception {
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(true);
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ long before = SystemClock.elapsedRealtimeNanos();
+ mProtoLog.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234,
+ 0b1110101001010100, null,
+ new Object[]{"test", 1, 2, 3, 0.4, 0.5, 0.6, true});
+ long after = SystemClock.elapsedRealtimeNanos();
+ mProtoLog.stopProtoLog(mock(PrintWriter.class), true);
+ try (InputStream is = new FileInputStream(mFile)) {
+ ProtoInputStream ip = new ProtoInputStream(is);
+ ProtoLogData data = readProtoLogSingle(ip);
+ assertNotNull(data);
+ assertEquals(1234, data.mMessageHash.longValue());
+ assertTrue(before < data.mElapsedTime && data.mElapsedTime < after);
+ assertArrayEquals(new String[]{"test"}, data.mStrParams.toArray());
+ assertArrayEquals(new Long[]{1L, 2L, 3L}, data.mSint64Params.toArray());
+ assertArrayEquals(new Double[]{0.4, 0.5, 0.6}, data.mDoubleParams.toArray());
+ assertArrayEquals(new Boolean[]{true}, data.mBooleanParams.toArray());
+ }
+ }
+
+ @Test
+ public void log_invalidParamsMask() throws Exception {
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(true);
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ long before = SystemClock.elapsedRealtimeNanos();
+ mProtoLog.log(
+ ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234,
+ 0b01100100, null,
+ new Object[]{"test", 1, 0.1, true});
+ long after = SystemClock.elapsedRealtimeNanos();
+ mProtoLog.stopProtoLog(mock(PrintWriter.class), true);
+ try (InputStream is = new FileInputStream(mFile)) {
+ ProtoInputStream ip = new ProtoInputStream(is);
+ ProtoLogData data = readProtoLogSingle(ip);
+ assertNotNull(data);
+ assertEquals(1234, data.mMessageHash.longValue());
+ assertTrue(before < data.mElapsedTime && data.mElapsedTime < after);
+ assertArrayEquals(new String[]{"test", "(INVALID PARAMS_MASK) true"},
+ data.mStrParams.toArray());
+ assertArrayEquals(new Long[]{1L}, data.mSint64Params.toArray());
+ assertArrayEquals(new Double[]{0.1}, data.mDoubleParams.toArray());
+ assertArrayEquals(new Boolean[]{}, data.mBooleanParams.toArray());
+ }
+ }
+
+ @Test
+ public void log_protoDisabled() throws Exception {
+ TestProtoLogGroup.TEST_GROUP.setLogToLogcat(false);
+ TestProtoLogGroup.TEST_GROUP.setLogToProto(false);
+ mProtoLog.startProtoLog(mock(PrintWriter.class));
+ mProtoLog.log(ProtoLogImpl.LogLevel.INFO, TestProtoLogGroup.TEST_GROUP, 1234,
+ 0b11, null, new Object[]{true});
+ mProtoLog.stopProtoLog(mock(PrintWriter.class), true);
+ try (InputStream is = new FileInputStream(mFile)) {
+ ProtoInputStream ip = new ProtoInputStream(is);
+ ProtoLogData data = readProtoLogSingle(ip);
+ assertNull(data);
+ }
+ }
+
+ private enum TestProtoLogGroup implements IProtoLogGroup {
+ TEST_GROUP(true, true, false, "WindowManagetProtoLogTest");
+
+ private final boolean mEnabled;
+ private volatile boolean mLogToProto;
+ private volatile boolean mLogToLogcat;
+ private final String mTag;
+
+ /**
+ * @param enabled set to false to exclude all log statements for this group from
+ * compilation,
+ * they will not be available in runtime.
+ * @param logToProto enable binary logging for the group
+ * @param logToLogcat enable text logging for the group
+ * @param tag name of the source of the logged message
+ */
+ TestProtoLogGroup(boolean enabled, boolean logToProto, boolean logToLogcat, String tag) {
+ this.mEnabled = enabled;
+ this.mLogToProto = logToProto;
+ this.mLogToLogcat = logToLogcat;
+ this.mTag = tag;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mEnabled;
+ }
+
+ @Override
+ public boolean isLogToProto() {
+ return mLogToProto;
+ }
+
+ @Override
+ public boolean isLogToLogcat() {
+ return mLogToLogcat;
+ }
+
+ @Override
+ public boolean isLogToAny() {
+ return mLogToLogcat || mLogToProto;
+ }
+
+ @Override
+ public String getTag() {
+ return mTag;
+ }
+
+ @Override
+ public void setLogToProto(boolean logToProto) {
+ this.mLogToProto = logToProto;
+ }
+
+ @Override
+ public void setLogToLogcat(boolean logToLogcat) {
+ this.mLogToLogcat = logToLogcat;
+ }
+
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/protolog/ProtoLogViewerConfigReaderTest.java b/services/tests/servicestests/src/com/android/server/protolog/ProtoLogViewerConfigReaderTest.java
new file mode 100644
index 0000000..0254055
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/protolog/ProtoLogViewerConfigReaderTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2019 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.server.protolog;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.zip.GZIPOutputStream;
+
+@SmallTest
+@Presubmit
+@RunWith(JUnit4.class)
+public class ProtoLogViewerConfigReaderTest {
+ private static final String TEST_VIEWER_CONFIG = "{\n"
+ + " \"version\": \"1.0.0\",\n"
+ + " \"messages\": {\n"
+ + " \"70933285\": {\n"
+ + " \"message\": \"Test completed successfully: %b\",\n"
+ + " \"level\": \"ERROR\",\n"
+ + " \"group\": \"GENERIC_WM\"\n"
+ + " },\n"
+ + " \"1792430067\": {\n"
+ + " \"message\": \"Attempted to add window to a display that does not exist: %d."
+ + " Aborting.\",\n"
+ + " \"level\": \"WARN\",\n"
+ + " \"group\": \"GENERIC_WM\"\n"
+ + " },\n"
+ + " \"1352021864\": {\n"
+ + " \"message\": \"Test 2\",\n"
+ + " \"level\": \"WARN\",\n"
+ + " \"group\": \"GENERIC_WM\"\n"
+ + " },\n"
+ + " \"409412266\": {\n"
+ + " \"message\": \"Window %s is already added\",\n"
+ + " \"level\": \"WARN\",\n"
+ + " \"group\": \"GENERIC_WM\"\n"
+ + " }\n"
+ + " },\n"
+ + " \"groups\": {\n"
+ + " \"GENERIC_WM\": {\n"
+ + " \"tag\": \"WindowManager\"\n"
+ + " }\n"
+ + " }\n"
+ + "}\n";
+
+
+ private ProtoLogViewerConfigReader
+ mConfig = new ProtoLogViewerConfigReader();
+ private File mTestViewerConfig;
+
+ @Before
+ public void setUp() throws IOException {
+ mTestViewerConfig = File.createTempFile("testConfig", ".json.gz");
+ OutputStreamWriter writer = new OutputStreamWriter(
+ new GZIPOutputStream(new FileOutputStream(mTestViewerConfig)));
+ writer.write(TEST_VIEWER_CONFIG);
+ writer.close();
+ }
+
+ @After
+ public void tearDown() {
+ //noinspection ResultOfMethodCallIgnored
+ mTestViewerConfig.delete();
+ }
+
+ @Test
+ public void getViewerString_notLoaded() {
+ assertNull(mConfig.getViewerString(1));
+ }
+
+ @Test
+ public void loadViewerConfig() {
+ mConfig.loadViewerConfig(null, mTestViewerConfig.getAbsolutePath());
+ assertEquals("Test completed successfully: %b", mConfig.getViewerString(70933285));
+ assertEquals("Test 2", mConfig.getViewerString(1352021864));
+ assertEquals("Window %s is already added", mConfig.getViewerString(409412266));
+ assertNull(mConfig.getViewerString(1));
+ }
+
+ @Test
+ public void loadViewerConfig_invalidFile() {
+ mConfig.loadViewerConfig(null, "/tmp/unknown/file/does/not/exist");
+ // No exception is thrown.
+ assertNull(mConfig.getViewerString(1));
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/protolog/common/LogDataTypeTest.java b/services/tests/servicestests/src/com/android/server/protolog/common/LogDataTypeTest.java
new file mode 100644
index 0000000..4c7f5fd
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/protolog/common/LogDataTypeTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2019 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.server.protolog.common;
+
+import static org.junit.Assert.assertEquals;
+
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@SmallTest
+@Presubmit
+@RunWith(JUnit4.class)
+public class LogDataTypeTest {
+ @Test
+ public void parseFormatString() {
+ String str = "%b %d %o %x %f %e %g %s %%";
+ List<Integer> out = LogDataType.parseFormatString(str);
+ assertEquals(Arrays.asList(
+ LogDataType.BOOLEAN,
+ LogDataType.LONG,
+ LogDataType.LONG,
+ LogDataType.LONG,
+ LogDataType.DOUBLE,
+ LogDataType.DOUBLE,
+ LogDataType.DOUBLE,
+ LogDataType.STRING
+ ), out);
+ }
+
+ @Test(expected = InvalidFormatStringException.class)
+ public void parseFormatString_invalid() {
+ String str = "%q";
+ LogDataType.parseFormatString(str);
+ }
+
+ @Test
+ public void logDataTypesToBitMask() {
+ List<Integer> types = Arrays.asList(LogDataType.STRING, LogDataType.DOUBLE,
+ LogDataType.LONG, LogDataType.BOOLEAN);
+ int mask = LogDataType.logDataTypesToBitMask(types);
+ assertEquals(0b11011000, mask);
+ }
+
+ @Test(expected = BitmaskConversionException.class)
+ public void logDataTypesToBitMask_toManyParams() {
+ ArrayList<Integer> types = new ArrayList<>();
+ for (int i = 0; i <= 16; i++) {
+ types.add(LogDataType.STRING);
+ }
+ LogDataType.logDataTypesToBitMask(types);
+ }
+
+ @Test
+ public void bitmaskToLogDataTypes() {
+ int bitmask = 0b11011000;
+ List<Integer> types = Arrays.asList(LogDataType.STRING, LogDataType.DOUBLE,
+ LogDataType.LONG, LogDataType.BOOLEAN);
+ for (int i = 0; i < types.size(); i++) {
+ assertEquals(types.get(i).intValue(), LogDataType.bitmaskToLogDataType(bitmask, i));
+ }
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/utils/TraceBufferTest.java b/services/tests/servicestests/src/com/android/server/utils/TraceBufferTest.java
new file mode 100644
index 0000000..09b75e7
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/utils/TraceBufferTest.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2019 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.server.utils;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.platform.test.annotations.Presubmit;
+import android.util.proto.ProtoOutputStream;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.internal.util.Preconditions;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+
+
+/**
+ * Test class for {@link TraceBuffer}.
+ *
+ * Build/Install/Run:
+ * atest WmTests:TraceBufferTest
+ */
+@SmallTest
+@Presubmit
+public class TraceBufferTest {
+ private File mFile;
+ private TraceBuffer mBuffer;
+
+ @Before
+ public void setUp() throws Exception {
+ final Context testContext = getInstrumentation().getContext();
+ mFile = testContext.getFileStreamPath("tracing_test.dat");
+ mFile.delete();
+
+ mBuffer = new TraceBuffer(10);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ mFile.delete();
+ }
+
+ @Test
+ public void test_addItem() {
+ ProtoOutputStream toWrite = getDummy(1);
+ final int objectSize = toWrite.getRawSize();
+ mBuffer.setCapacity(objectSize);
+ mBuffer.resetBuffer();
+
+ Preconditions.checkArgument(mBuffer.size() == 0);
+
+ mBuffer.add(toWrite);
+
+ assertEquals("Item was not added to the buffer", 1, mBuffer.size());
+ assertEquals("Total buffer getSize differs from inserted object",
+ mBuffer.getBufferSize(), objectSize);
+ assertEquals("Available buffer space does not match used one", 0,
+ mBuffer.getAvailableSpace());
+ }
+
+ @Test
+ public void test_addItemMustOverwriteOne() {
+ ProtoOutputStream toWrite1 = getDummy(1);
+ ProtoOutputStream toWrite2 = getDummy(2);
+ ProtoOutputStream toWrite3 = getDummy(3);
+ final int objectSize = toWrite1.getRawSize();
+ final int bufferCapacity = objectSize * 2 + 1;
+ mBuffer.setCapacity(bufferCapacity);
+ mBuffer.resetBuffer();
+
+ mBuffer.add(toWrite1);
+ byte[] toWrite1Bytes = toWrite1.getBytes();
+ assertTrue("First element should be in the list",
+ mBuffer.contains(toWrite1Bytes));
+
+ mBuffer.add(toWrite2);
+ byte[] toWrite2Bytes = toWrite2.getBytes();
+ assertTrue("First element should be in the list",
+ mBuffer.contains(toWrite1Bytes));
+ assertTrue("Second element should be in the list",
+ mBuffer.contains(toWrite2Bytes));
+
+ mBuffer.add(toWrite3);
+ byte[] toWrite3Bytes = toWrite3.getBytes();
+ assertTrue("First element should not be in the list",
+ !mBuffer.contains(toWrite1Bytes));
+ assertTrue("Second element should be in the list",
+ mBuffer.contains(toWrite2Bytes));
+ assertTrue("Third element should be in the list",
+ mBuffer.contains(toWrite3Bytes));
+ assertEquals("Buffer should have 2 elements", 2, mBuffer.size());
+ assertEquals(String.format("Buffer is full, used space should be %d", bufferCapacity),
+ mBuffer.getBufferSize(), bufferCapacity - 1);
+ assertEquals(" Buffer is full, available space should be 0", 1,
+ mBuffer.getAvailableSpace());
+ }
+
+ @Test
+ public void test_addItemMustOverwriteMultiple() {
+ ProtoOutputStream toWriteSmall1 = getDummy(1);
+ ProtoOutputStream toWriteSmall2 = getDummy(2);
+ final int objectSize = toWriteSmall1.getRawSize();
+ final int bufferCapacity = objectSize * 2;
+ mBuffer.setCapacity(bufferCapacity);
+ mBuffer.resetBuffer();
+
+ ProtoOutputStream toWriteBig = new ProtoOutputStream();
+ toWriteBig.write(MAGIC_NUMBER, 1);
+ toWriteBig.write(MAGIC_NUMBER, 2);
+
+ mBuffer.add(toWriteSmall1);
+ byte[] toWriteSmall1Bytes = toWriteSmall1.getBytes();
+ assertTrue("First element should be in the list",
+ mBuffer.contains(toWriteSmall1Bytes));
+
+ mBuffer.add(toWriteSmall2);
+ byte[] toWriteSmall2Bytes = toWriteSmall2.getBytes();
+ assertTrue("First element should be in the list",
+ mBuffer.contains(toWriteSmall1Bytes));
+ assertTrue("Second element should be in the list",
+ mBuffer.contains(toWriteSmall2Bytes));
+
+ mBuffer.add(toWriteBig);
+ byte[] toWriteBigBytes = toWriteBig.getBytes();
+ assertTrue("Third element should overwrite all others",
+ !mBuffer.contains(toWriteSmall1Bytes));
+ assertTrue("Third element should overwrite all others",
+ !mBuffer.contains(toWriteSmall2Bytes));
+ assertTrue("Third element should overwrite all others",
+ mBuffer.contains(toWriteBigBytes));
+
+ assertEquals(" Buffer should have only 1 big element", 1, mBuffer.size());
+ assertEquals(String.format(" Buffer is full, used space should be %d", bufferCapacity),
+ mBuffer.getBufferSize(), bufferCapacity);
+ assertEquals(" Buffer is full, available space should be 0", 0,
+ mBuffer.getAvailableSpace());
+ }
+
+ @Test
+ public void test_startResetsBuffer() {
+ ProtoOutputStream toWrite = getDummy(1);
+ mBuffer.resetBuffer();
+ Preconditions.checkArgument(mBuffer.size() == 0);
+
+ mBuffer.add(toWrite);
+ assertEquals("Item was not added to the buffer", 1, mBuffer.size());
+ mBuffer.resetBuffer();
+ assertEquals("Buffer should be empty after reset", 0, mBuffer.size());
+ assertEquals("Buffer size should be 0 after reset", 0, mBuffer.getBufferSize());
+ }
+
+ private ProtoOutputStream getDummy(int value) {
+ ProtoOutputStream toWrite = new ProtoOutputStream();
+ toWrite.write(MAGIC_NUMBER, value);
+ toWrite.flush();
+
+ return toWrite;
+ }
+
+}
diff --git a/services/tests/wmtests/src/com/android/server/wm/ProtoLogIntegrationTest.java b/services/tests/wmtests/src/com/android/server/wm/ProtoLogIntegrationTest.java
new file mode 100644
index 0000000..8eecff5
--- /dev/null
+++ b/services/tests/wmtests/src/com/android/server/wm/ProtoLogIntegrationTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2019 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.server.wm;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.server.protolog.ProtoLogImpl;
+
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ * Check if the ProtoLogTools is used to process the WindowManager source code.
+ */
+@SmallTest
+@Presubmit
+public class ProtoLogIntegrationTest {
+ @After
+ public void tearDown() {
+ ProtoLogImpl.setSingleInstance(null);
+ }
+
+ @Test
+ public void testProtoLogToolIntegration() {
+ ProtoLogImpl mockedProtoLog = mock(ProtoLogImpl.class);
+ ProtoLogImpl.setSingleInstance(mockedProtoLog);
+ ProtoLogGroup.testProtoLog();
+ verify(mockedProtoLog).log(eq(ProtoLogImpl.LogLevel.ERROR), eq(
+ ProtoLogGroup.TEST_GROUP),
+ eq(485522692), eq(0b0010101001010111),
+ eq(ProtoLogGroup.TEST_GROUP.isLogToLogcat()
+ ? "Test completed successfully: %b %d %o %x %e %g %f %% %s"
+ : null),
+ eq(new Object[]{true, 1L, 2L, 3L, 0.4, 0.5, 0.6, "ok"}));
+ }
+}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTraceBufferTest.java b/services/tests/wmtests/src/com/android/server/wm/WindowTraceBufferTest.java
deleted file mode 100644
index b299f0d..0000000
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTraceBufferTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2019 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.server.wm;
-
-import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
-
-import static com.android.server.wm.WindowManagerTraceFileProto.MAGIC_NUMBER;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import android.content.Context;
-import android.platform.test.annotations.Presubmit;
-import android.util.proto.ProtoOutputStream;
-
-import androidx.test.filters.SmallTest;
-
-import com.android.internal.util.Preconditions;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-
-
-/**
- * Test class for {@link WindowTraceBuffer}.
- *
- * Build/Install/Run:
- * atest WmTests:WindowTraceBufferTest
- */
-@SmallTest
-@Presubmit
-public class WindowTraceBufferTest {
- private File mFile;
- private WindowTraceBuffer mBuffer;
-
- @Before
- public void setUp() throws Exception {
- final Context testContext = getInstrumentation().getContext();
- mFile = testContext.getFileStreamPath("tracing_test.dat");
- mFile.delete();
-
- mBuffer = new WindowTraceBuffer(10);
- }
-
- @After
- public void tearDown() throws Exception {
- mFile.delete();
- }
-
- @Test
- public void test_addItem() {
- ProtoOutputStream toWrite = getDummy(1);
- final int objectSize = toWrite.getRawSize();
- mBuffer.setCapacity(objectSize);
- mBuffer.resetBuffer();
-
- Preconditions.checkArgument(mBuffer.size() == 0);
-
- mBuffer.add(toWrite);
-
- assertEquals("Item was not added to the buffer", 1, mBuffer.size());
- assertEquals("Total buffer getSize differs from inserted object",
- mBuffer.getBufferSize(), objectSize);
- assertEquals("Available buffer space does not match used one", 0,
- mBuffer.getAvailableSpace());
- }
-
- @Test
- public void test_addItemMustOverwriteOne() {
- ProtoOutputStream toWrite1 = getDummy(1);
- ProtoOutputStream toWrite2 = getDummy(2);
- ProtoOutputStream toWrite3 = getDummy(3);
- final int objectSize = toWrite1.getRawSize();
- final int bufferCapacity = objectSize * 2 + 1;
- mBuffer.setCapacity(bufferCapacity);
- mBuffer.resetBuffer();
-
- mBuffer.add(toWrite1);
- byte[] toWrite1Bytes = toWrite1.getBytes();
- assertTrue("First element should be in the list",
- mBuffer.contains(toWrite1Bytes));
-
- mBuffer.add(toWrite2);
- byte[] toWrite2Bytes = toWrite2.getBytes();
- assertTrue("First element should be in the list",
- mBuffer.contains(toWrite1Bytes));
- assertTrue("Second element should be in the list",
- mBuffer.contains(toWrite2Bytes));
-
- mBuffer.add(toWrite3);
- byte[] toWrite3Bytes = toWrite3.getBytes();
- assertTrue("First element should not be in the list",
- !mBuffer.contains(toWrite1Bytes));
- assertTrue("Second element should be in the list",
- mBuffer.contains(toWrite2Bytes));
- assertTrue("Third element should be in the list",
- mBuffer.contains(toWrite3Bytes));
- assertEquals("Buffer should have 2 elements", 2, mBuffer.size());
- assertEquals(String.format("Buffer is full, used space should be %d", bufferCapacity),
- mBuffer.getBufferSize(), bufferCapacity - 1);
- assertEquals(" Buffer is full, available space should be 0", 1,
- mBuffer.getAvailableSpace());
- }
-
- @Test
- public void test_addItemMustOverwriteMultiple() {
- ProtoOutputStream toWriteSmall1 = getDummy(1);
- ProtoOutputStream toWriteSmall2 = getDummy(2);
- final int objectSize = toWriteSmall1.getRawSize();
- final int bufferCapacity = objectSize * 2;
- mBuffer.setCapacity(bufferCapacity);
- mBuffer.resetBuffer();
-
- ProtoOutputStream toWriteBig = new ProtoOutputStream();
- toWriteBig.write(MAGIC_NUMBER, 1);
- toWriteBig.write(MAGIC_NUMBER, 2);
-
- mBuffer.add(toWriteSmall1);
- byte[] toWriteSmall1Bytes = toWriteSmall1.getBytes();
- assertTrue("First element should be in the list",
- mBuffer.contains(toWriteSmall1Bytes));
-
- mBuffer.add(toWriteSmall2);
- byte[] toWriteSmall2Bytes = toWriteSmall2.getBytes();
- assertTrue("First element should be in the list",
- mBuffer.contains(toWriteSmall1Bytes));
- assertTrue("Second element should be in the list",
- mBuffer.contains(toWriteSmall2Bytes));
-
- mBuffer.add(toWriteBig);
- byte[] toWriteBigBytes = toWriteBig.getBytes();
- assertTrue("Third element should overwrite all others",
- !mBuffer.contains(toWriteSmall1Bytes));
- assertTrue("Third element should overwrite all others",
- !mBuffer.contains(toWriteSmall2Bytes));
- assertTrue("Third element should overwrite all others",
- mBuffer.contains(toWriteBigBytes));
-
- assertEquals(" Buffer should have only 1 big element", 1, mBuffer.size());
- assertEquals(String.format(" Buffer is full, used space should be %d", bufferCapacity),
- mBuffer.getBufferSize(), bufferCapacity);
- assertEquals(" Buffer is full, available space should be 0", 0,
- mBuffer.getAvailableSpace());
- }
-
- @Test
- public void test_startResetsBuffer() {
- ProtoOutputStream toWrite = getDummy(1);
- mBuffer.resetBuffer();
- Preconditions.checkArgument(mBuffer.size() == 0);
-
- mBuffer.add(toWrite);
- assertEquals("Item was not added to the buffer", 1, mBuffer.size());
- mBuffer.resetBuffer();
- assertEquals("Buffer should be empty after reset", 0, mBuffer.size());
- assertEquals("Buffer size should be 0 after reset", 0, mBuffer.getBufferSize());
- }
-
- private ProtoOutputStream getDummy(int value) {
- ProtoOutputStream toWrite = new ProtoOutputStream();
- toWrite.write(MAGIC_NUMBER, value);
- toWrite.flush();
-
- return toWrite;
- }
-
-}
diff --git a/services/wifi/Android.bp b/services/wifi/Android.bp
index 608fc2c..3c916a6 100644
--- a/services/wifi/Android.bp
+++ b/services/wifi/Android.bp
@@ -5,9 +5,6 @@
"java/**/*.java",
"java/**/*.aidl",
],
- aidl: {
- local_include_dirs: ["java"]
- },
libs: [
"services.net",
],
diff --git a/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl b/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl
index 3af4666..eadc726 100644
--- a/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl
+++ b/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl
@@ -15,9 +15,8 @@
*/
package android.net.wifi;
-import android.net.wifi.WifiApiServiceInfo;
-
/** @hide */
interface IWifiStackConnector {
- List<WifiApiServiceInfo> getWifiApiServiceInfos();
+ IBinder retrieveApiServiceImpl(String serviceName);
+ boolean startApiService(String serviceName);
}
diff --git a/services/wifi/java/android/net/wifi/WifiApiServiceInfo.aidl b/services/wifi/java/android/net/wifi/WifiApiServiceInfo.aidl
deleted file mode 100644
index 45e4c69..0000000
--- a/services/wifi/java/android/net/wifi/WifiApiServiceInfo.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2019 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 android.net.wifi;
-
-/** @hide */
-parcelable WifiApiServiceInfo {
- String name;
- IBinder binder;
-}
diff --git a/services/wifi/java/android/net/wifi/WifiStackClient.java b/services/wifi/java/android/net/wifi/WifiStackClient.java
index dcdfbc5..64af7a8 100644
--- a/services/wifi/java/android/net/wifi/WifiStackClient.java
+++ b/services/wifi/java/android/net/wifi/WifiStackClient.java
@@ -21,13 +21,12 @@
import android.annotation.NonNull;
import android.content.Context;
import android.net.ConnectivityModuleConnector;
+import android.os.HandlerThread;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
-import java.util.List;
-
/**
* Service used to communicate with the wifi stack, which could be running in a separate
* module.
@@ -57,23 +56,21 @@
@Override
public void onModuleServiceConnected(IBinder service) {
Log.i(TAG, "Wifi stack connected");
- registerWifiStackService(service);
- IWifiStackConnector connector = IWifiStackConnector.Stub.asInterface(service);
+ // spin up a new thread to not block system_server main thread
+ HandlerThread thread = new HandlerThread("InitWifiServicesThread");
+ thread.start();
+ thread.getThreadHandler().post(() -> {
+ registerWifiStackService(service);
+ IWifiStackConnector connector = IWifiStackConnector.Stub.asInterface(service);
+ registerApiServiceAndStart(connector, Context.WIFI_SCANNING_SERVICE);
+ registerApiServiceAndStart(connector, Context.WIFI_SERVICE);
+ registerApiServiceAndStart(connector, Context.WIFI_P2P_SERVICE);
+ registerApiServiceAndStart(connector, Context.WIFI_AWARE_SERVICE);
+ registerApiServiceAndStart(connector, Context.WIFI_RTT_RANGING_SERVICE);
- List<WifiApiServiceInfo> wifiApiServiceInfos;
- try {
- wifiApiServiceInfos = connector.getWifiApiServiceInfos();
- } catch (RemoteException e) {
- throw new RuntimeException("Failed to getWifiApiServiceInfos()", e);
- }
-
- for (WifiApiServiceInfo wifiApiServiceInfo : wifiApiServiceInfos) {
- String serviceName = wifiApiServiceInfo.name;
- IBinder binder = wifiApiServiceInfo.binder;
- Log.i(TAG, "Registering " + serviceName);
- ServiceManager.addService(serviceName, binder);
- }
+ thread.quitSafely();
+ });
}
}
@@ -84,6 +81,32 @@
Log.i(TAG, "Wifi stack service registered");
}
+ private void registerApiServiceAndStart(
+ IWifiStackConnector stackConnector, String serviceName) {
+ IBinder service = null;
+ try {
+ service = stackConnector.retrieveApiServiceImpl(serviceName);
+ } catch (RemoteException e) {
+ throw new RuntimeException("Failed to retrieve service impl " + serviceName, e);
+ }
+ if (service == null) {
+ Log.i(TAG, "Service " + serviceName + " not available");
+ return;
+ }
+ Log.i(TAG, "Registering " + serviceName);
+ ServiceManager.addService(serviceName, service);
+
+ boolean success = false;
+ try {
+ success = stackConnector.startApiService(serviceName);
+ } catch (RemoteException e) {
+ throw new RuntimeException("Failed to start service " + serviceName, e);
+ }
+ if (!success) {
+ throw new RuntimeException("Service " + serviceName + " start failed");
+ }
+ }
+
/**
* Start the wifi stack. Should be called only once on device startup.
*
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 51de903..dcd35fd 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -896,6 +896,11 @@
*/
public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+ /**
+ * Integer extra to specify SIM slot index.
+ */
+ public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
+
private final Context mContext;
private volatile INetworkPolicyManager mNetworkPolicy;
@@ -2123,6 +2128,7 @@
if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId);
+ intent.putExtra(EXTRA_SLOT_INDEX, phoneId);
intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 85b54872..4f276bc 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -2449,41 +2449,37 @@
* @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
*/
public String getNetworkCountryIso() {
- return getNetworkCountryIsoForPhone(getPhoneId());
+ return getNetworkCountryIso(getPhoneId());
}
/**
- * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current
+ * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current
* registered operator or the cell nearby, if available.
* <p>
+ * The ISO-3166 country code is provided in lowercase 2 character format.
+ * <p>
+ * Note: In multi-sim, this returns a shared emergency network country iso from other
+ * subscription if the subscription used to create the TelephonyManager doesn't camp on
+ * a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding
+ * slot.
* Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
* if on a CDMA network).
- *
- * @param subId for which Network CountryIso is returned
- * @hide
- */
- @UnsupportedAppUsage
- public String getNetworkCountryIso(int subId) {
- return getNetworkCountryIsoForPhone(getPhoneId(subId));
- }
-
- /**
- * Returns the ISO country code equivalent of the current registered
- * operator's MCC (Mobile Country Code) of a subscription.
* <p>
- * Availability: Only when user is registered to a network. Result may be
- * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
- * on a CDMA network).
*
- * @param phoneId for which Network CountryIso is returned
+ * @param slotIndex the SIM slot index to get network country ISO.
+ *
+ * @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
+ *
+ * {@hide}
*/
- /** {@hide} */
- @UnsupportedAppUsage
- public String getNetworkCountryIsoForPhone(int phoneId) {
+ @SystemApi
+ @TestApi
+ @NonNull
+ public String getNetworkCountryIso(int slotIndex) {
try {
ITelephony telephony = getITelephony();
if (telephony == null) return "";
- return telephony.getNetworkCountryIsoForPhone(phoneId);
+ return telephony.getNetworkCountryIsoForPhone(slotIndex);
} catch (RemoteException ex) {
return "";
}
@@ -4562,6 +4558,17 @@
}
/**
+ * Sim activation type: voice
+ * @hide
+ */
+ public static final int SIM_ACTIVATION_TYPE_VOICE = 0;
+ /**
+ * Sim activation type: data
+ * @hide
+ */
+ public static final int SIM_ACTIVATION_TYPE_DATA = 1;
+
+ /**
* Initial SIM activation state, unknown. Not set by any carrier apps.
* @hide
*/
@@ -5088,6 +5095,17 @@
*/
public static final int DATA_ACTIVITY_DORMANT = 0x00000004;
+ /** @hide */
+ @IntDef(prefix = {"DATA_"}, value = {
+ DATA_ACTIVITY_NONE,
+ DATA_ACTIVITY_IN,
+ DATA_ACTIVITY_OUT,
+ DATA_ACTIVITY_INOUT,
+ DATA_ACTIVITY_DORMANT,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataActivityType{}
+
/**
* Returns a constant indicating the type of activity on a data connection
* (cellular).
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index 98fee83..fe76b7c 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -43,8 +43,8 @@
void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
boolean notifyNow);
@UnsupportedAppUsage
- void notifyCallState(int state, String incomingNumber);
- void notifyCallStateForPhoneId(in int phoneId, in int subId, int state, String incomingNumber);
+ void notifyCallStateForAllSubs(int state, String incomingNumber);
+ void notifyCallState(in int phoneId, in int subId, int state, String incomingNumber);
void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
void notifySignalStrengthForPhoneId(in int phoneId, in int subId,
in SignalStrength signalStrength);
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index ee1a476..c9ec0f8 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -89,10 +89,6 @@
@UnsupportedAppUsage
public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info
- // Sim activation type
- public static final int SIM_ACTIVATION_TYPE_VOICE = 0;
- public static final int SIM_ACTIVATION_TYPE_DATA = 1;
-
public static final String PHONE_NAME_KEY = "phoneName";
public static final String DATA_NETWORK_TYPE_KEY = "networkType";
public static final String DATA_FAILURE_CAUSE_KEY = "failCause";
diff --git a/tests/utils/testutils/java/android/os/test/TestLooper.java b/tests/utils/testutils/java/android/os/test/TestLooper.java
index a49eda3..01bd47b 100644
--- a/tests/utils/testutils/java/android/os/test/TestLooper.java
+++ b/tests/utils/testutils/java/android/os/test/TestLooper.java
@@ -210,33 +210,36 @@
/**
* Run method for the auto dispatch thread.
* The thread loops a maximum of MAX_LOOPS times with a 10ms sleep between loops.
- * The thread continues looping and attempting to dispatch all messages until at
- * least one message has been dispatched.
+ * The thread continues looping and attempting to dispatch all messages until
+ * {@link #stopAutoDispatch()} has been invoked.
*/
@Override
public void run() {
int dispatchCount = 0;
for (int i = 0; i < MAX_LOOPS; i++) {
try {
- dispatchCount = dispatchAll();
+ dispatchCount += dispatchAll();
} catch (RuntimeException e) {
mAutoDispatchException = e;
- }
- Log.d(TAG, "dispatched " + dispatchCount + " messages");
- if (dispatchCount > 0) {
return;
}
+ Log.d(TAG, "dispatched " + dispatchCount + " messages");
try {
Thread.sleep(LOOP_SLEEP_TIME_MS);
} catch (InterruptedException e) {
- mAutoDispatchException = new IllegalStateException(
- "stopAutoDispatch called before any messages were dispatched.");
+ if (dispatchCount == 0) {
+ Log.e(TAG, "stopAutoDispatch called before any messages were dispatched.");
+ mAutoDispatchException = new IllegalStateException(
+ "stopAutoDispatch called before any messages were dispatched.");
+ }
return;
}
}
- Log.e(TAG, "AutoDispatchThread did not dispatch any messages.");
- mAutoDispatchException = new IllegalStateException(
- "TestLooper did not dispatch any messages before exiting.");
+ if (dispatchCount == 0) {
+ Log.e(TAG, "AutoDispatchThread did not dispatch any messages.");
+ mAutoDispatchException = new IllegalStateException(
+ "TestLooper did not dispatch any messages before exiting.");
+ }
}
/**
@@ -287,4 +290,17 @@
"stopAutoDispatch called without startAutoDispatch.");
}
}
+
+ /**
+ * If an AutoDispatchThread is currently running, stop and clean up.
+ * This method ignores exceptions raised for indicating that no messages were dispatched.
+ */
+ public void stopAutoDispatchAndIgnoreExceptions() {
+ try {
+ stopAutoDispatch();
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "stopAutoDispatch", e);
+ }
+
+ }
}
diff --git a/tools/protologtool/Android.bp b/tools/protologtool/Android.bp
index a86c226..d1a86c2 100644
--- a/tools/protologtool/Android.bp
+++ b/tools/protologtool/Android.bp
@@ -1,13 +1,21 @@
+java_library_host {
+ name: "protologtool-lib",
+ srcs: [
+ "src/com/android/protolog/tool/**/*.kt",
+ ],
+ static_libs: [
+ "protolog-common",
+ "javaparser",
+ "protolog-proto",
+ "jsonlib",
+ ],
+}
+
java_binary_host {
name: "protologtool",
manifest: "manifest.txt",
- srcs: [
- "src/**/*.kt",
- ],
static_libs: [
- "javaparser",
- "windowmanager-log-proto",
- "jsonlib",
+ "protologtool-lib",
],
}
@@ -15,13 +23,10 @@
name: "protologtool-tests",
test_suites: ["general-tests"],
srcs: [
- "src/**/*.kt",
"tests/**/*.kt",
],
static_libs: [
- "javaparser",
- "windowmanager-log-proto",
- "jsonlib",
+ "protologtool-lib",
"junit",
"mockito",
],
diff --git a/tools/protologtool/manifest.txt b/tools/protologtool/manifest.txt
index f5e53c4..cabebd5 100644
--- a/tools/protologtool/manifest.txt
+++ b/tools/protologtool/manifest.txt
@@ -1 +1 @@
-Main-class: com.android.protologtool.ProtoLogTool
+Main-class: com.android.protolog.tool.ProtoLogTool
diff --git a/tools/protologtool/src/com/android/protolog/tool/CodeUtils.kt b/tools/protologtool/src/com/android/protolog/tool/CodeUtils.kt
new file mode 100644
index 0000000..5c92161
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/CodeUtils.kt
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.ImportDeclaration
+import com.github.javaparser.ast.expr.BinaryExpr
+import com.github.javaparser.ast.expr.Expression
+import com.github.javaparser.ast.expr.StringLiteralExpr
+
+object CodeUtils {
+ /**
+ * Returns a stable hash of a string.
+ * We reimplement String::hashCode() for readability reasons.
+ */
+ fun hash(str: String, level: LogLevel): Int {
+ return (level.name + str).map { c -> c.toInt() }.reduce { h, c -> h * 31 + c }
+ }
+
+ fun isWildcardStaticImported(code: CompilationUnit, className: String): Boolean {
+ return code.findAll(ImportDeclaration::class.java)
+ .any { im -> im.isStatic && im.isAsterisk && im.name.toString() == className }
+ }
+
+ fun isClassImportedOrSamePackage(code: CompilationUnit, className: String): Boolean {
+ val packageName = className.substringBeforeLast('.')
+ return code.packageDeclaration.isPresent &&
+ code.packageDeclaration.get().nameAsString == packageName ||
+ code.findAll(ImportDeclaration::class.java)
+ .any { im ->
+ !im.isStatic &&
+ ((!im.isAsterisk && im.name.toString() == className) ||
+ (im.isAsterisk && im.name.toString() == packageName))
+ }
+ }
+
+ fun staticallyImportedMethods(code: CompilationUnit, className: String): Set<String> {
+ return code.findAll(ImportDeclaration::class.java)
+ .filter { im ->
+ im.isStatic &&
+ im.name.toString().substringBeforeLast('.') == className
+ }
+ .map { im -> im.name.toString().substringAfterLast('.') }.toSet()
+ }
+
+ fun concatMultilineString(expr: Expression): String {
+ return when (expr) {
+ is StringLiteralExpr -> expr.asString()
+ is BinaryExpr -> when {
+ expr.operator == BinaryExpr.Operator.PLUS ->
+ concatMultilineString(expr.left) + concatMultilineString(expr.right)
+ else -> throw InvalidProtoLogCallException(
+ "messageString must be a string literal " +
+ "or concatenation of string literals.", expr)
+ }
+ else -> throw InvalidProtoLogCallException("messageString must be a string literal " +
+ "or concatenation of string literals.", expr)
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/CommandOptions.kt b/tools/protologtool/src/com/android/protolog/tool/CommandOptions.kt
new file mode 100644
index 0000000..3dfa4d2
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/CommandOptions.kt
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import java.util.regex.Pattern
+
+class CommandOptions(args: Array<String>) {
+ companion object {
+ const val TRANSFORM_CALLS_CMD = "transform-protolog-calls"
+ const val GENERATE_CONFIG_CMD = "generate-viewer-config"
+ const val READ_LOG_CMD = "read-log"
+ private val commands = setOf(TRANSFORM_CALLS_CMD, GENERATE_CONFIG_CMD, READ_LOG_CMD)
+
+ private const val PROTOLOG_CLASS_PARAM = "--protolog-class"
+ private const val PROTOLOGIMPL_CLASS_PARAM = "--protolog-impl-class"
+ private const val PROTOLOGGROUP_CLASS_PARAM = "--loggroups-class"
+ private const val PROTOLOGGROUP_JAR_PARAM = "--loggroups-jar"
+ private const val VIEWER_CONFIG_JSON_PARAM = "--viewer-conf"
+ private const val OUTPUT_SOURCE_JAR_PARAM = "--output-srcjar"
+ private val parameters = setOf(PROTOLOG_CLASS_PARAM, PROTOLOGIMPL_CLASS_PARAM,
+ PROTOLOGGROUP_CLASS_PARAM, PROTOLOGGROUP_JAR_PARAM, VIEWER_CONFIG_JSON_PARAM,
+ OUTPUT_SOURCE_JAR_PARAM)
+
+ val USAGE = """
+ Usage: ${Constants.NAME} <command> [<args>]
+ Available commands:
+
+ $TRANSFORM_CALLS_CMD $PROTOLOG_CLASS_PARAM <class name> $PROTOLOGIMPL_CLASS_PARAM
+ <class name> $PROTOLOGGROUP_CLASS_PARAM <class name> $PROTOLOGGROUP_JAR_PARAM
+ <config.jar> $OUTPUT_SOURCE_JAR_PARAM <output.srcjar> [<input.java>]
+ - processes java files replacing stub calls with logging code.
+
+ $GENERATE_CONFIG_CMD $PROTOLOG_CLASS_PARAM <class name> $PROTOLOGGROUP_CLASS_PARAM
+ <class name> $PROTOLOGGROUP_JAR_PARAM <config.jar> $VIEWER_CONFIG_JSON_PARAM
+ <viewer.json> [<input.java>]
+ - creates viewer config file from given java files.
+
+ $READ_LOG_CMD $VIEWER_CONFIG_JSON_PARAM <viewer.json> <wm_log.pb>
+ - translates a binary log to a readable format.
+ """.trimIndent()
+
+ private fun validateClassName(name: String): String {
+ if (!Pattern.matches("^([a-z]+[A-Za-z0-9]*\\.)+([A-Za-z0-9]+)$", name)) {
+ throw InvalidCommandException("Invalid class name $name")
+ }
+ return name
+ }
+
+ private fun getParam(paramName: String, params: Map<String, String>): String {
+ if (!params.containsKey(paramName)) {
+ throw InvalidCommandException("Param $paramName required")
+ }
+ return params.getValue(paramName)
+ }
+
+ private fun validateNotSpecified(paramName: String, params: Map<String, String>): String {
+ if (params.containsKey(paramName)) {
+ throw InvalidCommandException("Unsupported param $paramName")
+ }
+ return ""
+ }
+
+ private fun validateJarName(name: String): String {
+ if (!name.endsWith(".jar")) {
+ throw InvalidCommandException("Jar file required, got $name instead")
+ }
+ return name
+ }
+
+ private fun validateSrcJarName(name: String): String {
+ if (!name.endsWith(".srcjar")) {
+ throw InvalidCommandException("Source jar file required, got $name instead")
+ }
+ return name
+ }
+
+ private fun validateJSONName(name: String): String {
+ if (!name.endsWith(".json")) {
+ throw InvalidCommandException("Json file required, got $name instead")
+ }
+ return name
+ }
+
+ private fun validateJavaInputList(list: List<String>): List<String> {
+ if (list.isEmpty()) {
+ throw InvalidCommandException("No java source input files")
+ }
+ list.forEach { name ->
+ if (!name.endsWith(".java")) {
+ throw InvalidCommandException("Not a java source file $name")
+ }
+ }
+ return list
+ }
+
+ private fun validateLogInputList(list: List<String>): String {
+ if (list.isEmpty()) {
+ throw InvalidCommandException("No log input file")
+ }
+ if (list.size > 1) {
+ throw InvalidCommandException("Only one log input file allowed")
+ }
+ return list[0]
+ }
+ }
+
+ val protoLogClassNameArg: String
+ val protoLogGroupsClassNameArg: String
+ val protoLogImplClassNameArg: String
+ val protoLogGroupsJarArg: String
+ val viewerConfigJsonArg: String
+ val outputSourceJarArg: String
+ val logProtofileArg: String
+ val javaSourceArgs: List<String>
+ val command: String
+
+ init {
+ if (args.isEmpty()) {
+ throw InvalidCommandException("No command specified.")
+ }
+ command = args[0]
+ if (command !in commands) {
+ throw InvalidCommandException("Unknown command.")
+ }
+
+ val params: MutableMap<String, String> = mutableMapOf()
+ val inputFiles: MutableList<String> = mutableListOf()
+
+ var idx = 1
+ while (idx < args.size) {
+ if (args[idx].startsWith("--")) {
+ if (idx + 1 >= args.size) {
+ throw InvalidCommandException("No value for ${args[idx]}")
+ }
+ if (args[idx] !in parameters) {
+ throw InvalidCommandException("Unknown parameter ${args[idx]}")
+ }
+ if (args[idx + 1].startsWith("--")) {
+ throw InvalidCommandException("No value for ${args[idx]}")
+ }
+ if (params.containsKey(args[idx])) {
+ throw InvalidCommandException("Duplicated parameter ${args[idx]}")
+ }
+ params[args[idx]] = args[idx + 1]
+ idx += 2
+ } else {
+ inputFiles.add(args[idx])
+ idx += 1
+ }
+ }
+
+ when (command) {
+ TRANSFORM_CALLS_CMD -> {
+ protoLogClassNameArg = validateClassName(getParam(PROTOLOG_CLASS_PARAM, params))
+ protoLogGroupsClassNameArg = validateClassName(getParam(PROTOLOGGROUP_CLASS_PARAM,
+ params))
+ protoLogImplClassNameArg = validateClassName(getParam(PROTOLOGIMPL_CLASS_PARAM,
+ params))
+ protoLogGroupsJarArg = validateJarName(getParam(PROTOLOGGROUP_JAR_PARAM, params))
+ viewerConfigJsonArg = validateNotSpecified(VIEWER_CONFIG_JSON_PARAM, params)
+ outputSourceJarArg = validateSrcJarName(getParam(OUTPUT_SOURCE_JAR_PARAM, params))
+ javaSourceArgs = validateJavaInputList(inputFiles)
+ logProtofileArg = ""
+ }
+ GENERATE_CONFIG_CMD -> {
+ protoLogClassNameArg = validateClassName(getParam(PROTOLOG_CLASS_PARAM, params))
+ protoLogGroupsClassNameArg = validateClassName(getParam(PROTOLOGGROUP_CLASS_PARAM,
+ params))
+ protoLogImplClassNameArg = validateNotSpecified(PROTOLOGIMPL_CLASS_PARAM, params)
+ protoLogGroupsJarArg = validateJarName(getParam(PROTOLOGGROUP_JAR_PARAM, params))
+ viewerConfigJsonArg = validateJSONName(getParam(VIEWER_CONFIG_JSON_PARAM, params))
+ outputSourceJarArg = validateNotSpecified(OUTPUT_SOURCE_JAR_PARAM, params)
+ javaSourceArgs = validateJavaInputList(inputFiles)
+ logProtofileArg = ""
+ }
+ READ_LOG_CMD -> {
+ protoLogClassNameArg = validateNotSpecified(PROTOLOG_CLASS_PARAM, params)
+ protoLogGroupsClassNameArg = validateNotSpecified(PROTOLOGGROUP_CLASS_PARAM, params)
+ protoLogImplClassNameArg = validateNotSpecified(PROTOLOGIMPL_CLASS_PARAM, params)
+ protoLogGroupsJarArg = validateNotSpecified(PROTOLOGGROUP_JAR_PARAM, params)
+ viewerConfigJsonArg = validateJSONName(getParam(VIEWER_CONFIG_JSON_PARAM, params))
+ outputSourceJarArg = validateNotSpecified(OUTPUT_SOURCE_JAR_PARAM, params)
+ javaSourceArgs = listOf()
+ logProtofileArg = validateLogInputList(inputFiles)
+ }
+ else -> {
+ throw InvalidCommandException("Unknown command.")
+ }
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/Constants.kt b/tools/protologtool/src/com/android/protolog/tool/Constants.kt
new file mode 100644
index 0000000..83b3c00
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/Constants.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+object Constants {
+ const val NAME = "protologtool"
+ const val VERSION = "1.0.0"
+ const val IS_LOG_TO_ANY_METHOD = "isLogToAny"
+ const val ENUM_VALUES_METHOD = "values"
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/LogGroup.kt b/tools/protologtool/src/com/android/protolog/tool/LogGroup.kt
new file mode 100644
index 0000000..587f7b9
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/LogGroup.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+data class LogGroup(
+ val name: String,
+ val enabled: Boolean,
+ val textEnabled: Boolean,
+ val tag: String
+)
diff --git a/tools/protologtool/src/com/android/protolog/tool/LogLevel.kt b/tools/protologtool/src/com/android/protolog/tool/LogLevel.kt
new file mode 100644
index 0000000..7759f35
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/LogLevel.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.ast.Node
+
+enum class LogLevel {
+ DEBUG, VERBOSE, INFO, WARN, ERROR, WTF;
+
+ companion object {
+ fun getLevelForMethodName(name: String, node: Node): LogLevel {
+ return when (name) {
+ "d" -> DEBUG
+ "v" -> VERBOSE
+ "i" -> INFO
+ "w" -> WARN
+ "e" -> ERROR
+ "wtf" -> WTF
+ else -> throw InvalidProtoLogCallException("Unknown log level $name", node)
+ }
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/LogParser.kt b/tools/protologtool/src/com/android/protolog/tool/LogParser.kt
new file mode 100644
index 0000000..a59038f
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/LogParser.kt
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonReader
+import com.android.server.protolog.common.InvalidFormatStringException
+import com.android.server.protolog.common.LogDataType
+import com.android.server.protolog.ProtoLogMessage
+import com.android.server.protolog.ProtoLogFileProto
+import java.io.BufferedReader
+import java.io.InputStream
+import java.io.InputStreamReader
+import java.io.PrintStream
+import java.lang.Exception
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+
+/**
+ * Implements a simple parser/viewer for binary ProtoLog logs.
+ * A binary log is translated into Android "LogCat"-like text log.
+ */
+class LogParser(private val configParser: ViewerConfigParser) {
+ companion object {
+ private val dateFormat = SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.US)
+ private val magicNumber =
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
+ }
+
+ private fun printTime(time: Long, offset: Long, ps: PrintStream) {
+ ps.print(dateFormat.format(Date(time / 1000000 + offset)) + " ")
+ }
+
+ private fun printFormatted(
+ protoLogMessage: ProtoLogMessage,
+ configEntry: ViewerConfigParser.ConfigEntry,
+ ps: PrintStream
+ ) {
+ val strParmIt = protoLogMessage.strParamsList.iterator()
+ val longParamsIt = protoLogMessage.sint64ParamsList.iterator()
+ val doubleParamsIt = protoLogMessage.doubleParamsList.iterator()
+ val boolParamsIt = protoLogMessage.booleanParamsList.iterator()
+ val args = mutableListOf<Any>()
+ val format = configEntry.messageString
+ val argTypes = LogDataType.parseFormatString(format)
+ try {
+ argTypes.forEach {
+ when (it) {
+ LogDataType.BOOLEAN -> args.add(boolParamsIt.next())
+ LogDataType.LONG -> args.add(longParamsIt.next())
+ LogDataType.DOUBLE -> args.add(doubleParamsIt.next())
+ LogDataType.STRING -> args.add(strParmIt.next())
+ null -> throw NullPointerException()
+ }
+ }
+ } catch (ex: NoSuchElementException) {
+ throw InvalidFormatStringException("Invalid format string in config", ex)
+ }
+ if (strParmIt.hasNext() || longParamsIt.hasNext() ||
+ doubleParamsIt.hasNext() || boolParamsIt.hasNext()) {
+ throw RuntimeException("Invalid format string in config - no enough matchers")
+ }
+ val formatted = format.format(*(args.toTypedArray()))
+ ps.print("${configEntry.level} ${configEntry.tag}: $formatted\n")
+ }
+
+ private fun printUnformatted(protoLogMessage: ProtoLogMessage, ps: PrintStream, tag: String) {
+ ps.println("$tag: ${protoLogMessage.messageHash} - ${protoLogMessage.strParamsList}" +
+ " ${protoLogMessage.sint64ParamsList} ${protoLogMessage.doubleParamsList}" +
+ " ${protoLogMessage.booleanParamsList}")
+ }
+
+ fun parse(protoLogInput: InputStream, jsonConfigInput: InputStream, ps: PrintStream) {
+ val jsonReader = JsonReader(BufferedReader(InputStreamReader(jsonConfigInput)))
+ val config = configParser.parseConfig(jsonReader)
+ val protoLog = ProtoLogFileProto.parseFrom(protoLogInput)
+
+ if (protoLog.magicNumber != magicNumber) {
+ throw InvalidInputException("ProtoLog file magic number is invalid.")
+ }
+ if (protoLog.version != Constants.VERSION) {
+ throw InvalidInputException("ProtoLog file version not supported by this tool," +
+ " log version ${protoLog.version}, viewer version ${Constants.VERSION}")
+ }
+
+ protoLog.logList.forEach { log ->
+ printTime(log.elapsedRealtimeNanos, protoLog.realTimeToElapsedTimeOffsetMillis, ps)
+ if (log.messageHash !in config) {
+ printUnformatted(log, ps, "UNKNOWN")
+ } else {
+ val conf = config.getValue(log.messageHash)
+ try {
+ printFormatted(log, conf, ps)
+ } catch (ex: Exception) {
+ printUnformatted(log, ps, "INVALID")
+ }
+ }
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallProcessor.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallProcessor.kt
new file mode 100644
index 0000000..eae6396
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallProcessor.kt
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.expr.Expression
+import com.github.javaparser.ast.expr.FieldAccessExpr
+import com.github.javaparser.ast.expr.MethodCallExpr
+import com.github.javaparser.ast.expr.NameExpr
+
+/**
+ * Helper class for visiting all ProtoLog calls.
+ * For every valid call in the given {@code CompilationUnit} a {@code ProtoLogCallVisitor} callback
+ * is executed.
+ */
+open class ProtoLogCallProcessor(
+ private val protoLogClassName: String,
+ private val protoLogGroupClassName: String,
+ private val groupMap: Map<String, LogGroup>
+) {
+ private val protoLogSimpleClassName = protoLogClassName.substringAfterLast('.')
+ private val protoLogGroupSimpleClassName = protoLogGroupClassName.substringAfterLast('.')
+
+ private fun getLogGroupName(
+ expr: Expression,
+ isClassImported: Boolean,
+ staticImports: Set<String>
+ ): String {
+ return when (expr) {
+ is NameExpr -> when {
+ expr.nameAsString in staticImports -> expr.nameAsString
+ else ->
+ throw InvalidProtoLogCallException("Unknown/not imported ProtoLogGroup", expr)
+ }
+ is FieldAccessExpr -> when {
+ expr.scope.toString() == protoLogGroupClassName
+ || isClassImported &&
+ expr.scope.toString() == protoLogGroupSimpleClassName -> expr.nameAsString
+ else ->
+ throw InvalidProtoLogCallException("Unknown/not imported ProtoLogGroup", expr)
+ }
+ else -> throw InvalidProtoLogCallException("Invalid group argument " +
+ "- must be ProtoLogGroup enum member reference", expr)
+ }
+ }
+
+ private fun isProtoCall(
+ call: MethodCallExpr,
+ isLogClassImported: Boolean,
+ staticLogImports: Collection<String>
+ ): Boolean {
+ return call.scope.isPresent && call.scope.get().toString() == protoLogClassName ||
+ isLogClassImported && call.scope.isPresent &&
+ call.scope.get().toString() == protoLogSimpleClassName ||
+ !call.scope.isPresent && staticLogImports.contains(call.name.toString())
+ }
+
+ open fun process(code: CompilationUnit, callVisitor: ProtoLogCallVisitor?): CompilationUnit {
+ if (CodeUtils.isWildcardStaticImported(code, protoLogClassName) ||
+ CodeUtils.isWildcardStaticImported(code, protoLogGroupClassName)) {
+ throw IllegalImportException("Wildcard static imports of $protoLogClassName " +
+ "and $protoLogGroupClassName methods are not supported.")
+ }
+
+ val isLogClassImported = CodeUtils.isClassImportedOrSamePackage(code, protoLogClassName)
+ val staticLogImports = CodeUtils.staticallyImportedMethods(code, protoLogClassName)
+ val isGroupClassImported = CodeUtils.isClassImportedOrSamePackage(code,
+ protoLogGroupClassName)
+ val staticGroupImports = CodeUtils.staticallyImportedMethods(code, protoLogGroupClassName)
+
+ code.findAll(MethodCallExpr::class.java)
+ .filter { call ->
+ isProtoCall(call, isLogClassImported, staticLogImports)
+ }.forEach { call ->
+ if (call.arguments.size < 2) {
+ throw InvalidProtoLogCallException("Method signature does not match " +
+ "any ProtoLog method.", call)
+ }
+
+ val messageString = CodeUtils.concatMultilineString(call.getArgument(1))
+ val groupNameArg = call.getArgument(0)
+ val groupName =
+ getLogGroupName(groupNameArg, isGroupClassImported, staticGroupImports)
+ if (groupName !in groupMap) {
+ throw InvalidProtoLogCallException("Unknown group argument " +
+ "- not a ProtoLogGroup enum member", call)
+ }
+
+ callVisitor?.processCall(call, messageString, LogLevel.getLevelForMethodName(
+ call.name.toString(), call), groupMap.getValue(groupName))
+ }
+ return code
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallVisitor.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallVisitor.kt
new file mode 100644
index 0000000..aa58b69
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogCallVisitor.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.ast.expr.MethodCallExpr
+
+interface ProtoLogCallVisitor {
+ fun processCall(call: MethodCallExpr, messageString: String, level: LogLevel, group: LogGroup)
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogGroupReader.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogGroupReader.kt
new file mode 100644
index 0000000..75493b6
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogGroupReader.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.protolog.tool.Constants.ENUM_VALUES_METHOD
+import com.android.server.protolog.common.IProtoLogGroup
+import java.io.File
+import java.net.URLClassLoader
+
+class ProtoLogGroupReader {
+ private fun getClassloaderForJar(jarPath: String): ClassLoader {
+ val jarFile = File(jarPath)
+ val url = jarFile.toURI().toURL()
+ return URLClassLoader(arrayOf(url), ProtoLogGroupReader::class.java.classLoader)
+ }
+
+ private fun getEnumValues(clazz: Class<*>): List<IProtoLogGroup> {
+ val valuesMethod = clazz.getMethod(ENUM_VALUES_METHOD)
+ @Suppress("UNCHECKED_CAST")
+ return (valuesMethod.invoke(null) as Array<IProtoLogGroup>).toList()
+ }
+
+ fun loadFromJar(jarPath: String, className: String): Map<String, LogGroup> {
+ try {
+ val classLoader = getClassloaderForJar(jarPath)
+ val clazz = classLoader.loadClass(className)
+ val values = getEnumValues(clazz)
+ return values.map { group ->
+ group.name() to
+ LogGroup(group.name(), group.isEnabled, group.isLogToLogcat, group.tag)
+ }.toMap()
+ } catch (ex: ReflectiveOperationException) {
+ throw RuntimeException("Unable to load ProtoLogGroup enum class", ex)
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt
new file mode 100644
index 0000000..9678ec3
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.protolog.tool.CommandOptions.Companion.USAGE
+import com.github.javaparser.StaticJavaParser
+import java.io.File
+import java.io.FileInputStream
+import java.io.FileOutputStream
+import java.util.jar.JarOutputStream
+import java.util.zip.ZipEntry
+import kotlin.system.exitProcess
+
+object ProtoLogTool {
+ private fun showHelpAndExit() {
+ println(USAGE)
+ exitProcess(-1)
+ }
+
+ private fun containsProtoLogText(source: String, protoLogClassName: String): Boolean {
+ val protoLogSimpleClassName = protoLogClassName.substringAfterLast('.')
+ return source.contains(protoLogSimpleClassName)
+ }
+
+ private fun processClasses(command: CommandOptions) {
+ val groups = ProtoLogGroupReader()
+ .loadFromJar(command.protoLogGroupsJarArg, command.protoLogGroupsClassNameArg)
+ val out = FileOutputStream(command.outputSourceJarArg)
+ val outJar = JarOutputStream(out)
+ val processor = ProtoLogCallProcessor(command.protoLogClassNameArg,
+ command.protoLogGroupsClassNameArg, groups)
+ val transformer = SourceTransformer(command.protoLogImplClassNameArg, processor)
+
+ command.javaSourceArgs.forEach { path ->
+ val file = File(path)
+ val text = file.readText()
+ val code = StaticJavaParser.parse(text)
+ val outSrc = when {
+ containsProtoLogText(text, command.protoLogClassNameArg) ->
+ transformer.processClass(text, code)
+ else -> text
+ }
+ val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration
+ .get().nameAsString else ""
+ val newPath = pack.replace('.', '/') + '/' + file.name
+ outJar.putNextEntry(ZipEntry(newPath))
+ outJar.write(outSrc.toByteArray())
+ outJar.closeEntry()
+ }
+
+ outJar.close()
+ out.close()
+ }
+
+ private fun viewerConf(command: CommandOptions) {
+ val groups = ProtoLogGroupReader()
+ .loadFromJar(command.protoLogGroupsJarArg, command.protoLogGroupsClassNameArg)
+ val processor = ProtoLogCallProcessor(command.protoLogClassNameArg,
+ command.protoLogGroupsClassNameArg, groups)
+ val builder = ViewerConfigBuilder(processor)
+ command.javaSourceArgs.forEach { path ->
+ val file = File(path)
+ val text = file.readText()
+ if (containsProtoLogText(text, command.protoLogClassNameArg)) {
+ builder.processClass(StaticJavaParser.parse(text))
+ }
+ }
+ val out = FileOutputStream(command.viewerConfigJsonArg)
+ out.write(builder.build().toByteArray())
+ out.close()
+ }
+
+ private fun read(command: CommandOptions) {
+ LogParser(ViewerConfigParser())
+ .parse(FileInputStream(command.logProtofileArg),
+ FileInputStream(command.viewerConfigJsonArg), System.out)
+ }
+
+ @JvmStatic
+ fun main(args: Array<String>) {
+ try {
+ val command = CommandOptions(args)
+ when (command.command) {
+ CommandOptions.TRANSFORM_CALLS_CMD -> processClasses(command)
+ CommandOptions.GENERATE_CONFIG_CMD -> viewerConf(command)
+ CommandOptions.READ_LOG_CMD -> read(command)
+ }
+ } catch (ex: InvalidCommandException) {
+ println(ex.message)
+ showHelpAndExit()
+ }
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/SourceTransformer.kt b/tools/protologtool/src/com/android/protolog/tool/SourceTransformer.kt
new file mode 100644
index 0000000..c392078
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/SourceTransformer.kt
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.protolog.tool.Constants.IS_LOG_TO_ANY_METHOD
+import com.android.server.protolog.common.LogDataType
+import com.github.javaparser.StaticJavaParser
+import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.NodeList
+import com.github.javaparser.ast.body.VariableDeclarator
+import com.github.javaparser.ast.expr.BooleanLiteralExpr
+import com.github.javaparser.ast.expr.CastExpr
+import com.github.javaparser.ast.expr.Expression
+import com.github.javaparser.ast.expr.FieldAccessExpr
+import com.github.javaparser.ast.expr.IntegerLiteralExpr
+import com.github.javaparser.ast.expr.MethodCallExpr
+import com.github.javaparser.ast.expr.NameExpr
+import com.github.javaparser.ast.expr.NullLiteralExpr
+import com.github.javaparser.ast.expr.SimpleName
+import com.github.javaparser.ast.expr.TypeExpr
+import com.github.javaparser.ast.expr.VariableDeclarationExpr
+import com.github.javaparser.ast.stmt.BlockStmt
+import com.github.javaparser.ast.stmt.ExpressionStmt
+import com.github.javaparser.ast.stmt.IfStmt
+import com.github.javaparser.ast.type.ArrayType
+import com.github.javaparser.ast.type.ClassOrInterfaceType
+import com.github.javaparser.ast.type.PrimitiveType
+import com.github.javaparser.ast.type.Type
+import com.github.javaparser.printer.PrettyPrinter
+import com.github.javaparser.printer.PrettyPrinterConfiguration
+import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter
+
+class SourceTransformer(
+ protoLogImplClassName: String,
+ private val protoLogCallProcessor: ProtoLogCallProcessor
+) : ProtoLogCallVisitor {
+ override fun processCall(
+ call: MethodCallExpr,
+ messageString: String,
+ level: LogLevel,
+ group: LogGroup
+ ) {
+ // Input format: ProtoLog.e(GROUP, "msg %d", arg)
+ if (!call.parentNode.isPresent) {
+ // Should never happen
+ throw RuntimeException("Unable to process log call $call " +
+ "- no parent node in AST")
+ }
+ if (call.parentNode.get() !is ExpressionStmt) {
+ // Should never happen
+ throw RuntimeException("Unable to process log call $call " +
+ "- parent node in AST is not an ExpressionStmt")
+ }
+ val parentStmt = call.parentNode.get() as ExpressionStmt
+ if (!parentStmt.parentNode.isPresent) {
+ // Should never happen
+ throw RuntimeException("Unable to process log call $call " +
+ "- no grandparent node in AST")
+ }
+ val ifStmt: IfStmt
+ if (group.enabled) {
+ val hash = CodeUtils.hash(messageString, level)
+ val newCall = call.clone()
+ if (!group.textEnabled) {
+ // Remove message string if text logging is not enabled by default.
+ // Out: ProtoLog.e(GROUP, null, arg)
+ newCall.arguments[1].replace(NameExpr("null"))
+ }
+ // Insert message string hash as a second argument.
+ // Out: ProtoLog.e(GROUP, 1234, null, arg)
+ newCall.arguments.add(1, IntegerLiteralExpr(hash))
+ val argTypes = LogDataType.parseFormatString(messageString)
+ val typeMask = LogDataType.logDataTypesToBitMask(argTypes)
+ // Insert bitmap representing which Number parameters are to be considered as
+ // floating point numbers.
+ // Out: ProtoLog.e(GROUP, 1234, 0, null, arg)
+ newCall.arguments.add(2, IntegerLiteralExpr(typeMask))
+ // Replace call to a stub method with an actual implementation.
+ // Out: com.android.server.wm.ProtoLogImpl.e(GROUP, 1234, null, arg)
+ newCall.setScope(protoLogImplClassNode)
+ // Create a call to GROUP.isLogAny()
+ // Out: GROUP.isLogAny()
+ val isLogAnyExpr = MethodCallExpr(newCall.arguments[0].clone(),
+ SimpleName(IS_LOG_TO_ANY_METHOD))
+ if (argTypes.size != call.arguments.size - 2) {
+ throw InvalidProtoLogCallException(
+ "Number of arguments does not mach format string", call)
+ }
+ val blockStmt = BlockStmt()
+ if (argTypes.isNotEmpty()) {
+ // Assign every argument to a variable to check its type in compile time
+ // (this is assignment is optimized-out by dex tool, there is no runtime impact)/
+ // Out: long protoLogParam0 = arg
+ argTypes.forEachIndexed { idx, type ->
+ val varName = "protoLogParam$idx"
+ val declaration = VariableDeclarator(getASTTypeForDataType(type), varName,
+ getConversionForType(type)(newCall.arguments[idx + 4].clone()))
+ blockStmt.addStatement(ExpressionStmt(VariableDeclarationExpr(declaration)))
+ newCall.setArgument(idx + 4, NameExpr(SimpleName(varName)))
+ }
+ } else {
+ // Assign (Object[])null as the vararg parameter to prevent allocating an empty
+ // object array.
+ val nullArray = CastExpr(ArrayType(objectType), NullLiteralExpr())
+ newCall.addArgument(nullArray)
+ }
+ blockStmt.addStatement(ExpressionStmt(newCall))
+ // Create an IF-statement with the previously created condition.
+ // Out: if (GROUP.isLogAny()) {
+ // long protoLogParam0 = arg;
+ // com.android.server.wm.ProtoLogImpl.e(GROUP, 1234, 0, null, protoLogParam0);
+ // }
+ ifStmt = IfStmt(isLogAnyExpr, blockStmt, null)
+ } else {
+ // Surround with if (false).
+ val newCall = parentStmt.clone()
+ ifStmt = IfStmt(BooleanLiteralExpr(false), BlockStmt(NodeList(newCall)), null)
+ newCall.setBlockComment(" ${group.name} is disabled ")
+ }
+ // Inline the new statement.
+ val printedIfStmt = inlinePrinter.print(ifStmt)
+ // Append blank lines to preserve line numbering in file (to allow debugging)
+ val newLines = LexicalPreservingPrinter.print(parentStmt).count { c -> c == '\n' }
+ val newStmt = printedIfStmt.substringBeforeLast('}') + ("\n".repeat(newLines)) + '}'
+ // pre-workaround code, see explanation below
+ /*
+ val inlinedIfStmt = StaticJavaParser.parseStatement(newStmt)
+ LexicalPreservingPrinter.setup(inlinedIfStmt)
+ // Replace the original call.
+ if (!parentStmt.replace(inlinedIfStmt)) {
+ // Should never happen
+ throw RuntimeException("Unable to process log call $call " +
+ "- unable to replace the call.")
+ }
+ */
+ /** Workaround for a bug in JavaParser (AST tree invalid after replacing a node when using
+ * LexicalPreservingPrinter (https://github.com/javaparser/javaparser/issues/2290).
+ * Replace the code below with the one commended-out above one the issue is resolved. */
+ if (!parentStmt.range.isPresent) {
+ // Should never happen
+ throw RuntimeException("Unable to process log call $call " +
+ "- unable to replace the call.")
+ }
+ val range = parentStmt.range.get()
+ val begin = range.begin.line - 1
+ val oldLines = processedCode.subList(begin, range.end.line)
+ val oldCode = oldLines.joinToString("\n")
+ val newCode = oldCode.replaceRange(
+ offsets[begin] + range.begin.column - 1,
+ oldCode.length - oldLines.lastOrNull()!!.length +
+ range.end.column + offsets[range.end.line - 1], newStmt)
+ newCode.split("\n").forEachIndexed { idx, line ->
+ offsets[begin + idx] += line.length - processedCode[begin + idx].length
+ processedCode[begin + idx] = line
+ }
+ }
+
+ private val inlinePrinter: PrettyPrinter
+ private val objectType = StaticJavaParser.parseClassOrInterfaceType("Object")
+
+ init {
+ val config = PrettyPrinterConfiguration()
+ config.endOfLineCharacter = " "
+ config.indentSize = 0
+ config.tabWidth = 1
+ inlinePrinter = PrettyPrinter(config)
+ }
+
+ companion object {
+ private val stringType: ClassOrInterfaceType =
+ StaticJavaParser.parseClassOrInterfaceType("String")
+
+ fun getASTTypeForDataType(type: Int): Type {
+ return when (type) {
+ LogDataType.STRING -> stringType.clone()
+ LogDataType.LONG -> PrimitiveType.longType()
+ LogDataType.DOUBLE -> PrimitiveType.doubleType()
+ LogDataType.BOOLEAN -> PrimitiveType.booleanType()
+ else -> {
+ // Should never happen.
+ throw RuntimeException("Invalid LogDataType")
+ }
+ }
+ }
+
+ fun getConversionForType(type: Int): (Expression) -> Expression {
+ return when (type) {
+ LogDataType.STRING -> { expr ->
+ MethodCallExpr(TypeExpr(StaticJavaParser.parseClassOrInterfaceType("String")),
+ SimpleName("valueOf"), NodeList(expr))
+ }
+ else -> { expr -> expr }
+ }
+ }
+ }
+
+ private val protoLogImplClassNode =
+ StaticJavaParser.parseExpression<FieldAccessExpr>(protoLogImplClassName)
+ private var processedCode: MutableList<String> = mutableListOf()
+ private var offsets: IntArray = IntArray(0)
+
+ fun processClass(
+ code: String,
+ compilationUnit: CompilationUnit =
+ StaticJavaParser.parse(code)
+ ): String {
+ processedCode = code.split('\n').toMutableList()
+ offsets = IntArray(processedCode.size)
+ LexicalPreservingPrinter.setup(compilationUnit)
+ protoLogCallProcessor.process(compilationUnit, this)
+ // return LexicalPreservingPrinter.print(compilationUnit)
+ return processedCode.joinToString("\n")
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ViewerConfigBuilder.kt b/tools/protologtool/src/com/android/protolog/tool/ViewerConfigBuilder.kt
new file mode 100644
index 0000000..a75b5c9
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ViewerConfigBuilder.kt
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonWriter
+import com.github.javaparser.ast.CompilationUnit
+import com.android.protolog.tool.Constants.VERSION
+import com.github.javaparser.ast.expr.MethodCallExpr
+import java.io.StringWriter
+
+class ViewerConfigBuilder(
+ private val protoLogCallVisitor: ProtoLogCallProcessor
+) : ProtoLogCallVisitor {
+ override fun processCall(
+ call: MethodCallExpr,
+ messageString: String,
+ level: LogLevel,
+ group: LogGroup
+ ) {
+ if (group.enabled) {
+ val key = CodeUtils.hash(messageString, level)
+ if (statements.containsKey(key)) {
+ if (statements[key] != Triple(messageString, level, group)) {
+ throw HashCollisionException(
+ "Please modify the log message \"$messageString\" " +
+ "or \"${statements[key]}\" - their hashes are equal.")
+ }
+ } else {
+ groups.add(group)
+ statements[key] = Triple(messageString, level, group)
+ }
+ }
+ }
+
+ private val statements: MutableMap<Int, Triple<String, LogLevel, LogGroup>> = mutableMapOf()
+ private val groups: MutableSet<LogGroup> = mutableSetOf()
+
+ fun processClass(unit: CompilationUnit) {
+ protoLogCallVisitor.process(unit, this)
+ }
+
+ fun build(): String {
+ val stringWriter = StringWriter()
+ val writer = JsonWriter(stringWriter)
+ writer.setIndent(" ")
+ writer.beginObject()
+ writer.name("version")
+ writer.value(VERSION)
+ writer.name("messages")
+ writer.beginObject()
+ statements.toSortedMap().forEach { (key, value) ->
+ writer.name(key.toString())
+ writer.beginObject()
+ writer.name("message")
+ writer.value(value.first)
+ writer.name("level")
+ writer.value(value.second.name)
+ writer.name("group")
+ writer.value(value.third.name)
+ writer.endObject()
+ }
+ writer.endObject()
+ writer.name("groups")
+ writer.beginObject()
+ groups.toSortedSet(Comparator { o1, o2 -> o1.name.compareTo(o2.name) }).forEach { group ->
+ writer.name(group.name)
+ writer.beginObject()
+ writer.name("tag")
+ writer.value(group.tag)
+ writer.endObject()
+ }
+ writer.endObject()
+ writer.endObject()
+ stringWriter.buffer.append('\n')
+ return stringWriter.toString()
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/ViewerConfigParser.kt b/tools/protologtool/src/com/android/protolog/tool/ViewerConfigParser.kt
new file mode 100644
index 0000000..7278db0
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/ViewerConfigParser.kt
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonReader
+
+open class ViewerConfigParser {
+ data class MessageEntry(
+ val messageString: String,
+ val level: String,
+ val groupName: String
+ )
+
+ fun parseMessage(jsonReader: JsonReader): MessageEntry {
+ jsonReader.beginObject()
+ var message: String? = null
+ var level: String? = null
+ var groupName: String? = null
+ while (jsonReader.hasNext()) {
+ when (jsonReader.nextName()) {
+ "message" -> message = jsonReader.nextString()
+ "level" -> level = jsonReader.nextString()
+ "group" -> groupName = jsonReader.nextString()
+ else -> jsonReader.skipValue()
+ }
+ }
+ jsonReader.endObject()
+ if (message.isNullOrBlank() || level.isNullOrBlank() || groupName.isNullOrBlank()) {
+ throw InvalidViewerConfigException("Invalid message entry in viewer config")
+ }
+ return MessageEntry(message, level, groupName)
+ }
+
+ data class GroupEntry(val tag: String)
+
+ fun parseGroup(jsonReader: JsonReader): GroupEntry {
+ jsonReader.beginObject()
+ var tag: String? = null
+ while (jsonReader.hasNext()) {
+ when (jsonReader.nextName()) {
+ "tag" -> tag = jsonReader.nextString()
+ else -> jsonReader.skipValue()
+ }
+ }
+ jsonReader.endObject()
+ if (tag.isNullOrBlank()) {
+ throw InvalidViewerConfigException("Invalid group entry in viewer config")
+ }
+ return GroupEntry(tag)
+ }
+
+ fun parseMessages(jsonReader: JsonReader): Map<Int, MessageEntry> {
+ val config: MutableMap<Int, MessageEntry> = mutableMapOf()
+ jsonReader.beginObject()
+ while (jsonReader.hasNext()) {
+ val key = jsonReader.nextName()
+ val hash = key.toIntOrNull()
+ ?: throw InvalidViewerConfigException("Invalid key in messages viewer config")
+ config[hash] = parseMessage(jsonReader)
+ }
+ jsonReader.endObject()
+ return config
+ }
+
+ fun parseGroups(jsonReader: JsonReader): Map<String, GroupEntry> {
+ val config: MutableMap<String, GroupEntry> = mutableMapOf()
+ jsonReader.beginObject()
+ while (jsonReader.hasNext()) {
+ val key = jsonReader.nextName()
+ config[key] = parseGroup(jsonReader)
+ }
+ jsonReader.endObject()
+ return config
+ }
+
+ data class ConfigEntry(val messageString: String, val level: String, val tag: String)
+
+ open fun parseConfig(jsonReader: JsonReader): Map<Int, ConfigEntry> {
+ var messages: Map<Int, MessageEntry>? = null
+ var groups: Map<String, GroupEntry>? = null
+ var version: String? = null
+
+ jsonReader.beginObject()
+ while (jsonReader.hasNext()) {
+ when (jsonReader.nextName()) {
+ "messages" -> messages = parseMessages(jsonReader)
+ "groups" -> groups = parseGroups(jsonReader)
+ "version" -> version = jsonReader.nextString()
+
+ else -> jsonReader.skipValue()
+ }
+ }
+ jsonReader.endObject()
+ if (messages == null || groups == null || version == null) {
+ throw InvalidViewerConfigException("Invalid config - definitions missing")
+ }
+ if (version != Constants.VERSION) {
+ throw InvalidViewerConfigException("Viewer config version not supported by this tool," +
+ " config version $version, viewer version ${Constants.VERSION}")
+ }
+ return messages.map { msg ->
+ msg.key to ConfigEntry(
+ msg.value.messageString, msg.value.level, groups[msg.value.groupName]?.tag
+ ?: throw InvalidViewerConfigException(
+ "Group definition missing for ${msg.value.groupName}"))
+ }.toMap()
+ }
+}
diff --git a/tools/protologtool/src/com/android/protolog/tool/exceptions.kt b/tools/protologtool/src/com/android/protolog/tool/exceptions.kt
new file mode 100644
index 0000000..0401d8f
--- /dev/null
+++ b/tools/protologtool/src/com/android/protolog/tool/exceptions.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.ast.Node
+import java.lang.Exception
+import java.lang.RuntimeException
+
+class HashCollisionException(message: String) : RuntimeException(message)
+
+class IllegalImportException(message: String) : Exception(message)
+
+class InvalidProtoLogCallException(message: String, node: Node)
+ : RuntimeException("$message\nAt: $node")
+
+class InvalidViewerConfigException(message: String) : Exception(message)
+
+class InvalidInputException(message: String) : Exception(message)
+
+class InvalidCommandException(message: String) : Exception(message)
diff --git a/tools/protologtool/src/com/android/protologtool/CodeUtils.kt b/tools/protologtool/src/com/android/protologtool/CodeUtils.kt
deleted file mode 100644
index facca62..0000000
--- a/tools/protologtool/src/com/android/protologtool/CodeUtils.kt
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.StaticJavaParser
-import com.github.javaparser.ast.CompilationUnit
-import com.github.javaparser.ast.ImportDeclaration
-import com.github.javaparser.ast.NodeList
-import com.github.javaparser.ast.expr.BinaryExpr
-import com.github.javaparser.ast.expr.Expression
-import com.github.javaparser.ast.expr.MethodCallExpr
-import com.github.javaparser.ast.expr.SimpleName
-import com.github.javaparser.ast.expr.StringLiteralExpr
-import com.github.javaparser.ast.expr.TypeExpr
-import com.github.javaparser.ast.type.PrimitiveType
-import com.github.javaparser.ast.type.Type
-
-object CodeUtils {
- /**
- * Returns a stable hash of a string.
- * We reimplement String::hashCode() for readability reasons.
- */
- fun hash(str: String, level: LogLevel): Int {
- return (level.name + str).map { c -> c.toInt() }.reduce { h, c -> h * 31 + c }
- }
-
- fun isWildcardStaticImported(code: CompilationUnit, className: String): Boolean {
- return code.findAll(ImportDeclaration::class.java)
- .any { im -> im.isStatic && im.isAsterisk && im.name.toString() == className }
- }
-
- fun isClassImportedOrSamePackage(code: CompilationUnit, className: String): Boolean {
- val packageName = className.substringBeforeLast('.')
- return code.packageDeclaration.isPresent &&
- code.packageDeclaration.get().nameAsString == packageName ||
- code.findAll(ImportDeclaration::class.java)
- .any { im ->
- !im.isStatic &&
- ((!im.isAsterisk && im.name.toString() == className) ||
- (im.isAsterisk && im.name.toString() == packageName))
- }
- }
-
- fun staticallyImportedMethods(code: CompilationUnit, className: String): Set<String> {
- return code.findAll(ImportDeclaration::class.java)
- .filter { im ->
- im.isStatic &&
- im.name.toString().substringBeforeLast('.') == className
- }
- .map { im -> im.name.toString().substringAfterLast('.') }.toSet()
- }
-
- fun concatMultilineString(expr: Expression): String {
- return when (expr) {
- is StringLiteralExpr -> expr.asString()
- is BinaryExpr -> when {
- expr.operator == BinaryExpr.Operator.PLUS ->
- concatMultilineString(expr.left) + concatMultilineString(expr.right)
- else -> throw InvalidProtoLogCallException(
- "messageString must be a string literal " +
- "or concatenation of string literals.", expr)
- }
- else -> throw InvalidProtoLogCallException("messageString must be a string literal " +
- "or concatenation of string literals.", expr)
- }
- }
-
- enum class LogDataTypes(
- val type: Type,
- val toType: (Expression) -> Expression = { expr -> expr }
- ) {
- // When adding new LogDataType make sure to update {@code logDataTypesToBitMask} accordingly
- STRING(StaticJavaParser.parseClassOrInterfaceType("String"),
- { expr ->
- MethodCallExpr(TypeExpr(StaticJavaParser.parseClassOrInterfaceType("String")),
- SimpleName("valueOf"), NodeList(expr))
- }),
- LONG(PrimitiveType.longType()),
- DOUBLE(PrimitiveType.doubleType()),
- BOOLEAN(PrimitiveType.booleanType());
- }
-
- fun parseFormatString(messageString: String): List<LogDataTypes> {
- val types = mutableListOf<LogDataTypes>()
- var i = 0
- while (i < messageString.length) {
- if (messageString[i] == '%') {
- if (i + 1 >= messageString.length) {
- throw InvalidFormatStringException("Invalid format string in config")
- }
- when (messageString[i + 1]) {
- 'b' -> types.add(CodeUtils.LogDataTypes.BOOLEAN)
- 'd', 'o', 'x' -> types.add(CodeUtils.LogDataTypes.LONG)
- 'f', 'e', 'g' -> types.add(CodeUtils.LogDataTypes.DOUBLE)
- 's' -> types.add(CodeUtils.LogDataTypes.STRING)
- '%' -> {
- }
- else -> throw InvalidFormatStringException("Invalid format string field" +
- " %${messageString[i + 1]}")
- }
- i += 2
- } else {
- i += 1
- }
- }
- return types
- }
-
- fun logDataTypesToBitMask(types: List<LogDataTypes>): Int {
- if (types.size > 16) {
- throw InvalidFormatStringException("Too many log call parameters " +
- "- max 16 parameters supported")
- }
- var mask = 0
- types.forEachIndexed { idx, type ->
- val x = LogDataTypes.values().indexOf(type)
- mask = mask or (x shl (idx * 2))
- }
- return mask
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/CommandOptions.kt b/tools/protologtool/src/com/android/protologtool/CommandOptions.kt
deleted file mode 100644
index df49e15..0000000
--- a/tools/protologtool/src/com/android/protologtool/CommandOptions.kt
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import java.util.regex.Pattern
-
-class CommandOptions(args: Array<String>) {
- companion object {
- const val TRANSFORM_CALLS_CMD = "transform-protolog-calls"
- const val GENERATE_CONFIG_CMD = "generate-viewer-config"
- const val READ_LOG_CMD = "read-log"
- private val commands = setOf(TRANSFORM_CALLS_CMD, GENERATE_CONFIG_CMD, READ_LOG_CMD)
-
- private const val PROTOLOG_CLASS_PARAM = "--protolog-class"
- private const val PROTOLOGIMPL_CLASS_PARAM = "--protolog-impl-class"
- private const val PROTOLOGGROUP_CLASS_PARAM = "--loggroups-class"
- private const val PROTOLOGGROUP_JAR_PARAM = "--loggroups-jar"
- private const val VIEWER_CONFIG_JSON_PARAM = "--viewer-conf"
- private const val OUTPUT_SOURCE_JAR_PARAM = "--output-srcjar"
- private val parameters = setOf(PROTOLOG_CLASS_PARAM, PROTOLOGIMPL_CLASS_PARAM,
- PROTOLOGGROUP_CLASS_PARAM, PROTOLOGGROUP_JAR_PARAM, VIEWER_CONFIG_JSON_PARAM,
- OUTPUT_SOURCE_JAR_PARAM)
-
- val USAGE = """
- Usage: ${Constants.NAME} <command> [<args>]
- Available commands:
-
- $TRANSFORM_CALLS_CMD $PROTOLOG_CLASS_PARAM <class name> $PROTOLOGIMPL_CLASS_PARAM
- <class name> $PROTOLOGGROUP_CLASS_PARAM <class name> $PROTOLOGGROUP_JAR_PARAM
- <config.jar> $OUTPUT_SOURCE_JAR_PARAM <output.srcjar> [<input.java>]
- - processes java files replacing stub calls with logging code.
-
- $GENERATE_CONFIG_CMD $PROTOLOG_CLASS_PARAM <class name> $PROTOLOGGROUP_CLASS_PARAM
- <class name> $PROTOLOGGROUP_JAR_PARAM <config.jar> $VIEWER_CONFIG_JSON_PARAM
- <viewer.json> [<input.java>]
- - creates viewer config file from given java files.
-
- $READ_LOG_CMD $VIEWER_CONFIG_JSON_PARAM <viewer.json> <wm_log.pb>
- - translates a binary log to a readable format.
- """.trimIndent()
-
- private fun validateClassName(name: String): String {
- if (!Pattern.matches("^([a-z]+[A-Za-z0-9]*\\.)+([A-Za-z0-9]+)$", name)) {
- throw InvalidCommandException("Invalid class name $name")
- }
- return name
- }
-
- private fun getParam(paramName: String, params: Map<String, String>): String {
- if (!params.containsKey(paramName)) {
- throw InvalidCommandException("Param $paramName required")
- }
- return params.getValue(paramName)
- }
-
- private fun validateNotSpecified(paramName: String, params: Map<String, String>): String {
- if (params.containsKey(paramName)) {
- throw InvalidCommandException("Unsupported param $paramName")
- }
- return ""
- }
-
- private fun validateJarName(name: String): String {
- if (!name.endsWith(".jar")) {
- throw InvalidCommandException("Jar file required, got $name instead")
- }
- return name
- }
-
- private fun validateSrcJarName(name: String): String {
- if (!name.endsWith(".srcjar")) {
- throw InvalidCommandException("Source jar file required, got $name instead")
- }
- return name
- }
-
- private fun validateJSONName(name: String): String {
- if (!name.endsWith(".json")) {
- throw InvalidCommandException("Json file required, got $name instead")
- }
- return name
- }
-
- private fun validateJavaInputList(list: List<String>): List<String> {
- if (list.isEmpty()) {
- throw InvalidCommandException("No java source input files")
- }
- list.forEach { name ->
- if (!name.endsWith(".java")) {
- throw InvalidCommandException("Not a java source file $name")
- }
- }
- return list
- }
-
- private fun validateLogInputList(list: List<String>): String {
- if (list.isEmpty()) {
- throw InvalidCommandException("No log input file")
- }
- if (list.size > 1) {
- throw InvalidCommandException("Only one log input file allowed")
- }
- return list[0]
- }
- }
-
- val protoLogClassNameArg: String
- val protoLogGroupsClassNameArg: String
- val protoLogImplClassNameArg: String
- val protoLogGroupsJarArg: String
- val viewerConfigJsonArg: String
- val outputSourceJarArg: String
- val logProtofileArg: String
- val javaSourceArgs: List<String>
- val command: String
-
- init {
- if (args.isEmpty()) {
- throw InvalidCommandException("No command specified.")
- }
- command = args[0]
- if (command !in commands) {
- throw InvalidCommandException("Unknown command.")
- }
-
- val params: MutableMap<String, String> = mutableMapOf()
- val inputFiles: MutableList<String> = mutableListOf()
-
- var idx = 1
- while (idx < args.size) {
- if (args[idx].startsWith("--")) {
- if (idx + 1 >= args.size) {
- throw InvalidCommandException("No value for ${args[idx]}")
- }
- if (args[idx] !in parameters) {
- throw InvalidCommandException("Unknown parameter ${args[idx]}")
- }
- if (args[idx + 1].startsWith("--")) {
- throw InvalidCommandException("No value for ${args[idx]}")
- }
- if (params.containsKey(args[idx])) {
- throw InvalidCommandException("Duplicated parameter ${args[idx]}")
- }
- params[args[idx]] = args[idx + 1]
- idx += 2
- } else {
- inputFiles.add(args[idx])
- idx += 1
- }
- }
-
- when (command) {
- TRANSFORM_CALLS_CMD -> {
- protoLogClassNameArg = validateClassName(getParam(PROTOLOG_CLASS_PARAM, params))
- protoLogGroupsClassNameArg = validateClassName(getParam(PROTOLOGGROUP_CLASS_PARAM,
- params))
- protoLogImplClassNameArg = validateClassName(getParam(PROTOLOGIMPL_CLASS_PARAM,
- params))
- protoLogGroupsJarArg = validateJarName(getParam(PROTOLOGGROUP_JAR_PARAM, params))
- viewerConfigJsonArg = validateNotSpecified(VIEWER_CONFIG_JSON_PARAM, params)
- outputSourceJarArg = validateSrcJarName(getParam(OUTPUT_SOURCE_JAR_PARAM, params))
- javaSourceArgs = validateJavaInputList(inputFiles)
- logProtofileArg = ""
- }
- GENERATE_CONFIG_CMD -> {
- protoLogClassNameArg = validateClassName(getParam(PROTOLOG_CLASS_PARAM, params))
- protoLogGroupsClassNameArg = validateClassName(getParam(PROTOLOGGROUP_CLASS_PARAM,
- params))
- protoLogImplClassNameArg = validateNotSpecified(PROTOLOGIMPL_CLASS_PARAM, params)
- protoLogGroupsJarArg = validateJarName(getParam(PROTOLOGGROUP_JAR_PARAM, params))
- viewerConfigJsonArg = validateJSONName(getParam(VIEWER_CONFIG_JSON_PARAM, params))
- outputSourceJarArg = validateNotSpecified(OUTPUT_SOURCE_JAR_PARAM, params)
- javaSourceArgs = validateJavaInputList(inputFiles)
- logProtofileArg = ""
- }
- READ_LOG_CMD -> {
- protoLogClassNameArg = validateNotSpecified(PROTOLOG_CLASS_PARAM, params)
- protoLogGroupsClassNameArg = validateNotSpecified(PROTOLOGGROUP_CLASS_PARAM, params)
- protoLogImplClassNameArg = validateNotSpecified(PROTOLOGIMPL_CLASS_PARAM, params)
- protoLogGroupsJarArg = validateNotSpecified(PROTOLOGGROUP_JAR_PARAM, params)
- viewerConfigJsonArg = validateJSONName(getParam(VIEWER_CONFIG_JSON_PARAM, params))
- outputSourceJarArg = validateNotSpecified(OUTPUT_SOURCE_JAR_PARAM, params)
- javaSourceArgs = listOf()
- logProtofileArg = validateLogInputList(inputFiles)
- }
- else -> {
- throw InvalidCommandException("Unknown command.")
- }
- }
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/Constants.kt b/tools/protologtool/src/com/android/protologtool/Constants.kt
deleted file mode 100644
index 2ccfc4d..0000000
--- a/tools/protologtool/src/com/android/protologtool/Constants.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-object Constants {
- const val NAME = "protologtool"
- const val VERSION = "1.0.0"
- const val IS_ENABLED_METHOD = "isEnabled"
- const val IS_LOG_TO_LOGCAT_METHOD = "isLogToLogcat"
- const val IS_LOG_TO_ANY_METHOD = "isLogToAny"
- const val GET_TAG_METHOD = "getTag"
- const val ENUM_VALUES_METHOD = "values"
-}
diff --git a/tools/protologtool/src/com/android/protologtool/LogGroup.kt b/tools/protologtool/src/com/android/protologtool/LogGroup.kt
deleted file mode 100644
index 42a37a2..0000000
--- a/tools/protologtool/src/com/android/protologtool/LogGroup.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-data class LogGroup(
- val name: String,
- val enabled: Boolean,
- val textEnabled: Boolean,
- val tag: String
-)
diff --git a/tools/protologtool/src/com/android/protologtool/LogLevel.kt b/tools/protologtool/src/com/android/protologtool/LogLevel.kt
deleted file mode 100644
index dc29557..0000000
--- a/tools/protologtool/src/com/android/protologtool/LogLevel.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.ast.Node
-
-enum class LogLevel {
- DEBUG, VERBOSE, INFO, WARN, ERROR, WTF;
-
- companion object {
- fun getLevelForMethodName(name: String, node: Node): LogLevel {
- return when (name) {
- "d" -> DEBUG
- "v" -> VERBOSE
- "i" -> INFO
- "w" -> WARN
- "e" -> ERROR
- "wtf" -> WTF
- else -> throw InvalidProtoLogCallException("Unknown log level $name", node)
- }
- }
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/LogParser.kt b/tools/protologtool/src/com/android/protologtool/LogParser.kt
deleted file mode 100644
index 4d0eb0e..0000000
--- a/tools/protologtool/src/com/android/protologtool/LogParser.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonReader
-import com.android.server.wm.ProtoLogMessage
-import com.android.server.wm.WindowManagerLogFileProto
-import java.io.BufferedReader
-import java.io.InputStream
-import java.io.InputStreamReader
-import java.io.PrintStream
-import java.lang.Exception
-import java.text.SimpleDateFormat
-import java.util.Date
-import java.util.Locale
-
-/**
- * Implements a simple parser/viewer for binary ProtoLog logs.
- * A binary log is translated into Android "LogCat"-like text log.
- */
-class LogParser(private val configParser: ViewerConfigParser) {
- companion object {
- private val dateFormat = SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.US)
- private val magicNumber =
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
- }
-
- private fun printTime(time: Long, offset: Long, ps: PrintStream) {
- ps.print(dateFormat.format(Date(time / 1000000 + offset)) + " ")
- }
-
- private fun printFormatted(
- protoLogMessage: ProtoLogMessage,
- configEntry: ViewerConfigParser.ConfigEntry,
- ps: PrintStream
- ) {
- val strParmIt = protoLogMessage.strParamsList.iterator()
- val longParamsIt = protoLogMessage.sint64ParamsList.iterator()
- val doubleParamsIt = protoLogMessage.doubleParamsList.iterator()
- val boolParamsIt = protoLogMessage.booleanParamsList.iterator()
- val args = mutableListOf<Any>()
- val format = configEntry.messageString
- val argTypes = CodeUtils.parseFormatString(format)
- try {
- argTypes.forEach {
- when (it) {
- CodeUtils.LogDataTypes.BOOLEAN -> args.add(boolParamsIt.next())
- CodeUtils.LogDataTypes.LONG -> args.add(longParamsIt.next())
- CodeUtils.LogDataTypes.DOUBLE -> args.add(doubleParamsIt.next())
- CodeUtils.LogDataTypes.STRING -> args.add(strParmIt.next())
- }
- }
- } catch (ex: NoSuchElementException) {
- throw InvalidFormatStringException("Invalid format string in config", ex)
- }
- if (strParmIt.hasNext() || longParamsIt.hasNext() ||
- doubleParamsIt.hasNext() || boolParamsIt.hasNext()) {
- throw RuntimeException("Invalid format string in config - no enough matchers")
- }
- val formatted = format.format(*(args.toTypedArray()))
- ps.print("${configEntry.level} ${configEntry.tag}: $formatted\n")
- }
-
- private fun printUnformatted(protoLogMessage: ProtoLogMessage, ps: PrintStream, tag: String) {
- ps.println("$tag: ${protoLogMessage.messageHash} - ${protoLogMessage.strParamsList}" +
- " ${protoLogMessage.sint64ParamsList} ${protoLogMessage.doubleParamsList}" +
- " ${protoLogMessage.booleanParamsList}")
- }
-
- fun parse(protoLogInput: InputStream, jsonConfigInput: InputStream, ps: PrintStream) {
- val jsonReader = JsonReader(BufferedReader(InputStreamReader(jsonConfigInput)))
- val config = configParser.parseConfig(jsonReader)
- val protoLog = WindowManagerLogFileProto.parseFrom(protoLogInput)
-
- if (protoLog.magicNumber != magicNumber) {
- throw InvalidInputException("ProtoLog file magic number is invalid.")
- }
- if (protoLog.version != Constants.VERSION) {
- throw InvalidInputException("ProtoLog file version not supported by this tool," +
- " log version ${protoLog.version}, viewer version ${Constants.VERSION}")
- }
-
- protoLog.logList.forEach { log ->
- printTime(log.elapsedRealtimeNanos, protoLog.realTimeToElapsedTimeOffsetMillis, ps)
- if (log.messageHash !in config) {
- printUnformatted(log, ps, "UNKNOWN")
- } else {
- val conf = config.getValue(log.messageHash)
- try {
- printFormatted(log, conf, ps)
- } catch (ex: Exception) {
- printUnformatted(log, ps, "INVALID")
- }
- }
- }
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ProtoLogCallProcessor.kt b/tools/protologtool/src/com/android/protologtool/ProtoLogCallProcessor.kt
deleted file mode 100644
index 29d8ae5..0000000
--- a/tools/protologtool/src/com/android/protologtool/ProtoLogCallProcessor.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.ast.CompilationUnit
-import com.github.javaparser.ast.expr.Expression
-import com.github.javaparser.ast.expr.FieldAccessExpr
-import com.github.javaparser.ast.expr.MethodCallExpr
-import com.github.javaparser.ast.expr.NameExpr
-
-/**
- * Helper class for visiting all ProtoLog calls.
- * For every valid call in the given {@code CompilationUnit} a {@code ProtoLogCallVisitor} callback
- * is executed.
- */
-open class ProtoLogCallProcessor(
- private val protoLogClassName: String,
- private val protoLogGroupClassName: String,
- private val groupMap: Map<String, LogGroup>
-) {
- private val protoLogSimpleClassName = protoLogClassName.substringAfterLast('.')
- private val protoLogGroupSimpleClassName = protoLogGroupClassName.substringAfterLast('.')
-
- private fun getLogGroupName(
- expr: Expression,
- isClassImported: Boolean,
- staticImports: Set<String>
- ): String {
- return when (expr) {
- is NameExpr -> when {
- expr.nameAsString in staticImports -> expr.nameAsString
- else ->
- throw InvalidProtoLogCallException("Unknown/not imported ProtoLogGroup", expr)
- }
- is FieldAccessExpr -> when {
- expr.scope.toString() == protoLogGroupClassName
- || isClassImported &&
- expr.scope.toString() == protoLogGroupSimpleClassName -> expr.nameAsString
- else ->
- throw InvalidProtoLogCallException("Unknown/not imported ProtoLogGroup", expr)
- }
- else -> throw InvalidProtoLogCallException("Invalid group argument " +
- "- must be ProtoLogGroup enum member reference", expr)
- }
- }
-
- private fun isProtoCall(
- call: MethodCallExpr,
- isLogClassImported: Boolean,
- staticLogImports: Collection<String>
- ): Boolean {
- return call.scope.isPresent && call.scope.get().toString() == protoLogClassName ||
- isLogClassImported && call.scope.isPresent &&
- call.scope.get().toString() == protoLogSimpleClassName ||
- !call.scope.isPresent && staticLogImports.contains(call.name.toString())
- }
-
- open fun process(code: CompilationUnit, callVisitor: ProtoLogCallVisitor?): CompilationUnit {
- if (CodeUtils.isWildcardStaticImported(code, protoLogClassName) ||
- CodeUtils.isWildcardStaticImported(code, protoLogGroupClassName)) {
- throw IllegalImportException("Wildcard static imports of $protoLogClassName " +
- "and $protoLogGroupClassName methods are not supported.")
- }
-
- val isLogClassImported = CodeUtils.isClassImportedOrSamePackage(code, protoLogClassName)
- val staticLogImports = CodeUtils.staticallyImportedMethods(code, protoLogClassName)
- val isGroupClassImported = CodeUtils.isClassImportedOrSamePackage(code,
- protoLogGroupClassName)
- val staticGroupImports = CodeUtils.staticallyImportedMethods(code, protoLogGroupClassName)
-
- code.findAll(MethodCallExpr::class.java)
- .filter { call ->
- isProtoCall(call, isLogClassImported, staticLogImports)
- }.forEach { call ->
- if (call.arguments.size < 2) {
- throw InvalidProtoLogCallException("Method signature does not match " +
- "any ProtoLog method.", call)
- }
-
- val messageString = CodeUtils.concatMultilineString(call.getArgument(1))
- val groupNameArg = call.getArgument(0)
- val groupName =
- getLogGroupName(groupNameArg, isGroupClassImported, staticGroupImports)
- if (groupName !in groupMap) {
- throw InvalidProtoLogCallException("Unknown group argument " +
- "- not a ProtoLogGroup enum member", call)
- }
-
- callVisitor?.processCall(call, messageString, LogLevel.getLevelForMethodName(
- call.name.toString(), call), groupMap.getValue(groupName))
- }
- return code
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ProtoLogCallVisitor.kt b/tools/protologtool/src/com/android/protologtool/ProtoLogCallVisitor.kt
deleted file mode 100644
index 42a75f8..0000000
--- a/tools/protologtool/src/com/android/protologtool/ProtoLogCallVisitor.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.ast.expr.MethodCallExpr
-
-interface ProtoLogCallVisitor {
- fun processCall(call: MethodCallExpr, messageString: String, level: LogLevel, group: LogGroup)
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ProtoLogGroupReader.kt b/tools/protologtool/src/com/android/protologtool/ProtoLogGroupReader.kt
deleted file mode 100644
index 664c8a6..0000000
--- a/tools/protologtool/src/com/android/protologtool/ProtoLogGroupReader.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.protologtool.Constants.ENUM_VALUES_METHOD
-import com.android.protologtool.Constants.GET_TAG_METHOD
-import com.android.protologtool.Constants.IS_ENABLED_METHOD
-import com.android.protologtool.Constants.IS_LOG_TO_LOGCAT_METHOD
-import java.io.File
-import java.lang.RuntimeException
-import java.net.URLClassLoader
-
-class ProtoLogGroupReader {
- private fun getClassloaderForJar(jarPath: String): ClassLoader {
- val jarFile = File(jarPath)
- val url = jarFile.toURI().toURL()
- return URLClassLoader(arrayOf(url), ProtoLogGroupReader::class.java.classLoader)
- }
-
- private fun getEnumValues(clazz: Class<*>): List<Enum<*>> {
- val valuesMethod = clazz.getMethod(ENUM_VALUES_METHOD)
- @Suppress("UNCHECKED_CAST")
- return (valuesMethod.invoke(null) as Array<Enum<*>>).toList()
- }
-
- private fun getLogGroupFromEnumValue(group: Any, clazz: Class<*>): LogGroup {
- val enabled = clazz.getMethod(IS_ENABLED_METHOD).invoke(group) as Boolean
- val textEnabled = clazz.getMethod(IS_LOG_TO_LOGCAT_METHOD).invoke(group) as Boolean
- val tag = clazz.getMethod(GET_TAG_METHOD).invoke(group) as String
- val name = (group as Enum<*>).name
- return LogGroup(name, enabled, textEnabled, tag)
- }
-
- fun loadFromJar(jarPath: String, className: String): Map<String, LogGroup> {
- try {
- val classLoader = getClassloaderForJar(jarPath)
- val clazz = classLoader.loadClass(className)
- val values = getEnumValues(clazz)
- return values.map { group ->
- group.name to getLogGroupFromEnumValue(group, clazz)
- }.toMap()
- } catch (ex: ReflectiveOperationException) {
- throw RuntimeException("Unable to load ProtoLogGroup enum class", ex)
- }
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ProtoLogTool.kt b/tools/protologtool/src/com/android/protologtool/ProtoLogTool.kt
deleted file mode 100644
index 618e4b1..0000000
--- a/tools/protologtool/src/com/android/protologtool/ProtoLogTool.kt
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.protologtool.CommandOptions.Companion.USAGE
-import com.github.javaparser.StaticJavaParser
-import java.io.File
-import java.io.FileInputStream
-import java.io.FileOutputStream
-import java.util.jar.JarOutputStream
-import java.util.zip.ZipEntry
-import kotlin.system.exitProcess
-
-object ProtoLogTool {
- private fun showHelpAndExit() {
- println(USAGE)
- exitProcess(-1)
- }
-
- private fun processClasses(command: CommandOptions) {
- val groups = ProtoLogGroupReader()
- .loadFromJar(command.protoLogGroupsJarArg, command.protoLogGroupsClassNameArg)
- val out = FileOutputStream(command.outputSourceJarArg)
- val outJar = JarOutputStream(out)
- val processor = ProtoLogCallProcessor(command.protoLogClassNameArg,
- command.protoLogGroupsClassNameArg, groups)
- val transformer = SourceTransformer(command.protoLogImplClassNameArg, processor)
-
- command.javaSourceArgs.forEach { path ->
- val file = File(path)
- val text = file.readText()
- val code = StaticJavaParser.parse(text)
- val outSrc = transformer.processClass(text, code)
- val pack = if (code.packageDeclaration.isPresent) code.packageDeclaration
- .get().nameAsString else ""
- val newPath = pack.replace('.', '/') + '/' + file.name
- outJar.putNextEntry(ZipEntry(newPath))
- outJar.write(outSrc.toByteArray())
- outJar.closeEntry()
- }
-
- outJar.close()
- out.close()
- }
-
- private fun viewerConf(command: CommandOptions) {
- val groups = ProtoLogGroupReader()
- .loadFromJar(command.protoLogGroupsJarArg, command.protoLogGroupsClassNameArg)
- val processor = ProtoLogCallProcessor(command.protoLogClassNameArg,
- command.protoLogGroupsClassNameArg, groups)
- val builder = ViewerConfigBuilder(processor)
- command.javaSourceArgs.forEach { path ->
- val file = File(path)
- builder.processClass(StaticJavaParser.parse(file))
- }
- val out = FileOutputStream(command.viewerConfigJsonArg)
- out.write(builder.build().toByteArray())
- out.close()
- }
-
- fun read(command: CommandOptions) {
- LogParser(ViewerConfigParser())
- .parse(FileInputStream(command.logProtofileArg),
- FileInputStream(command.viewerConfigJsonArg), System.out)
- }
-
- @JvmStatic
- fun main(args: Array<String>) {
- try {
- val command = CommandOptions(args)
- when (command.command) {
- CommandOptions.TRANSFORM_CALLS_CMD -> processClasses(command)
- CommandOptions.GENERATE_CONFIG_CMD -> viewerConf(command)
- CommandOptions.READ_LOG_CMD -> read(command)
- }
- } catch (ex: InvalidCommandException) {
- println(ex.message)
- showHelpAndExit()
- }
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/SourceTransformer.kt b/tools/protologtool/src/com/android/protologtool/SourceTransformer.kt
deleted file mode 100644
index f915ea6..0000000
--- a/tools/protologtool/src/com/android/protologtool/SourceTransformer.kt
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.protologtool.Constants.IS_LOG_TO_ANY_METHOD
-import com.github.javaparser.StaticJavaParser
-import com.github.javaparser.ast.CompilationUnit
-import com.github.javaparser.ast.NodeList
-import com.github.javaparser.ast.body.VariableDeclarator
-import com.github.javaparser.ast.expr.BooleanLiteralExpr
-import com.github.javaparser.ast.expr.CastExpr
-import com.github.javaparser.ast.expr.FieldAccessExpr
-import com.github.javaparser.ast.expr.IntegerLiteralExpr
-import com.github.javaparser.ast.expr.MethodCallExpr
-import com.github.javaparser.ast.expr.NameExpr
-import com.github.javaparser.ast.expr.NullLiteralExpr
-import com.github.javaparser.ast.expr.SimpleName
-import com.github.javaparser.ast.expr.VariableDeclarationExpr
-import com.github.javaparser.ast.stmt.BlockStmt
-import com.github.javaparser.ast.stmt.ExpressionStmt
-import com.github.javaparser.ast.stmt.IfStmt
-import com.github.javaparser.ast.type.ArrayType
-import com.github.javaparser.printer.PrettyPrinter
-import com.github.javaparser.printer.PrettyPrinterConfiguration
-import com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter
-
-class SourceTransformer(
- protoLogImplClassName: String,
- private val protoLogCallProcessor: ProtoLogCallProcessor
-) : ProtoLogCallVisitor {
- override fun processCall(
- call: MethodCallExpr,
- messageString: String,
- level: LogLevel,
- group: LogGroup
- ) {
- // Input format: ProtoLog.e(GROUP, "msg %d", arg)
- if (!call.parentNode.isPresent) {
- // Should never happen
- throw RuntimeException("Unable to process log call $call " +
- "- no parent node in AST")
- }
- if (call.parentNode.get() !is ExpressionStmt) {
- // Should never happen
- throw RuntimeException("Unable to process log call $call " +
- "- parent node in AST is not an ExpressionStmt")
- }
- val parentStmt = call.parentNode.get() as ExpressionStmt
- if (!parentStmt.parentNode.isPresent) {
- // Should never happen
- throw RuntimeException("Unable to process log call $call " +
- "- no grandparent node in AST")
- }
- val ifStmt: IfStmt
- if (group.enabled) {
- val hash = CodeUtils.hash(messageString, level)
- val newCall = call.clone()
- if (!group.textEnabled) {
- // Remove message string if text logging is not enabled by default.
- // Out: ProtoLog.e(GROUP, null, arg)
- newCall.arguments[1].replace(NameExpr("null"))
- }
- // Insert message string hash as a second argument.
- // Out: ProtoLog.e(GROUP, 1234, null, arg)
- newCall.arguments.add(1, IntegerLiteralExpr(hash))
- val argTypes = CodeUtils.parseFormatString(messageString)
- val typeMask = CodeUtils.logDataTypesToBitMask(argTypes)
- // Insert bitmap representing which Number parameters are to be considered as
- // floating point numbers.
- // Out: ProtoLog.e(GROUP, 1234, 0, null, arg)
- newCall.arguments.add(2, IntegerLiteralExpr(typeMask))
- // Replace call to a stub method with an actual implementation.
- // Out: com.android.server.wm.ProtoLogImpl.e(GROUP, 1234, null, arg)
- newCall.setScope(protoLogImplClassNode)
- // Create a call to GROUP.isLogAny()
- // Out: GROUP.isLogAny()
- val isLogAnyExpr = MethodCallExpr(newCall.arguments[0].clone(),
- SimpleName(IS_LOG_TO_ANY_METHOD))
- if (argTypes.size != call.arguments.size - 2) {
- throw InvalidProtoLogCallException(
- "Number of arguments does not mach format string", call)
- }
- val blockStmt = BlockStmt()
- if (argTypes.isNotEmpty()) {
- // Assign every argument to a variable to check its type in compile time
- // (this is assignment is optimized-out by dex tool, there is no runtime impact)/
- // Out: long protoLogParam0 = arg
- argTypes.forEachIndexed { idx, type ->
- val varName = "protoLogParam$idx"
- val declaration = VariableDeclarator(type.type, varName,
- type.toType(newCall.arguments[idx + 4].clone()))
- blockStmt.addStatement(ExpressionStmt(VariableDeclarationExpr(declaration)))
- newCall.setArgument(idx + 4, NameExpr(SimpleName(varName)))
- }
- } else {
- // Assign (Object[])null as the vararg parameter to prevent allocating an empty
- // object array.
- val nullArray = CastExpr(ArrayType(objectType), NullLiteralExpr())
- newCall.addArgument(nullArray)
- }
- blockStmt.addStatement(ExpressionStmt(newCall))
- // Create an IF-statement with the previously created condition.
- // Out: if (GROUP.isLogAny()) {
- // long protoLogParam0 = arg;
- // com.android.server.wm.ProtoLogImpl.e(GROUP, 1234, 0, null, protoLogParam0);
- // }
- ifStmt = IfStmt(isLogAnyExpr, blockStmt, null)
- } else {
- // Surround with if (false).
- val newCall = parentStmt.clone()
- ifStmt = IfStmt(BooleanLiteralExpr(false), BlockStmt(NodeList(newCall)), null)
- newCall.setBlockComment(" ${group.name} is disabled ")
- }
- // Inline the new statement.
- val printedIfStmt = inlinePrinter.print(ifStmt)
- // Append blank lines to preserve line numbering in file (to allow debugging)
- val newLines = LexicalPreservingPrinter.print(parentStmt).count { c -> c == '\n' }
- val newStmt = printedIfStmt.substringBeforeLast('}') + ("\n".repeat(newLines)) + '}'
- // pre-workaround code, see explanation below
- /*
- val inlinedIfStmt = StaticJavaParser.parseStatement(newStmt)
- LexicalPreservingPrinter.setup(inlinedIfStmt)
- // Replace the original call.
- if (!parentStmt.replace(inlinedIfStmt)) {
- // Should never happen
- throw RuntimeException("Unable to process log call $call " +
- "- unable to replace the call.")
- }
- */
- /** Workaround for a bug in JavaParser (AST tree invalid after replacing a node when using
- * LexicalPreservingPrinter (https://github.com/javaparser/javaparser/issues/2290).
- * Replace the code below with the one commended-out above one the issue is resolved. */
- if (!parentStmt.range.isPresent) {
- // Should never happen
- throw RuntimeException("Unable to process log call $call " +
- "- unable to replace the call.")
- }
- val range = parentStmt.range.get()
- val begin = range.begin.line - 1
- val oldLines = processedCode.subList(begin, range.end.line)
- val oldCode = oldLines.joinToString("\n")
- val newCode = oldCode.replaceRange(
- offsets[begin] + range.begin.column - 1,
- oldCode.length - oldLines.lastOrNull()!!.length +
- range.end.column + offsets[range.end.line - 1], newStmt)
- newCode.split("\n").forEachIndexed { idx, line ->
- offsets[begin + idx] += line.length - processedCode[begin + idx].length
- processedCode[begin + idx] = line
- }
- }
-
- private val inlinePrinter: PrettyPrinter
- private val objectType = StaticJavaParser.parseClassOrInterfaceType("Object")
-
- init {
- val config = PrettyPrinterConfiguration()
- config.endOfLineCharacter = " "
- config.indentSize = 0
- config.tabWidth = 1
- inlinePrinter = PrettyPrinter(config)
- }
-
- private val protoLogImplClassNode =
- StaticJavaParser.parseExpression<FieldAccessExpr>(protoLogImplClassName)
- private var processedCode: MutableList<String> = mutableListOf()
- private var offsets: IntArray = IntArray(0)
-
- fun processClass(
- code: String,
- compilationUnit: CompilationUnit =
- StaticJavaParser.parse(code)
- ): String {
- processedCode = code.split('\n').toMutableList()
- offsets = IntArray(processedCode.size)
- LexicalPreservingPrinter.setup(compilationUnit)
- protoLogCallProcessor.process(compilationUnit, this)
- // return LexicalPreservingPrinter.print(compilationUnit)
- return processedCode.joinToString("\n")
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ViewerConfigBuilder.kt b/tools/protologtool/src/com/android/protologtool/ViewerConfigBuilder.kt
deleted file mode 100644
index 8ce9a49..0000000
--- a/tools/protologtool/src/com/android/protologtool/ViewerConfigBuilder.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonWriter
-import com.github.javaparser.ast.CompilationUnit
-import com.android.protologtool.Constants.VERSION
-import com.github.javaparser.ast.expr.MethodCallExpr
-import java.io.StringWriter
-
-class ViewerConfigBuilder(
- private val protoLogCallVisitor: ProtoLogCallProcessor
-) : ProtoLogCallVisitor {
- override fun processCall(
- call: MethodCallExpr,
- messageString: String,
- level: LogLevel,
- group: LogGroup
- ) {
- if (group.enabled) {
- val key = CodeUtils.hash(messageString, level)
- if (statements.containsKey(key)) {
- if (statements[key] != Triple(messageString, level, group)) {
- throw HashCollisionException(
- "Please modify the log message \"$messageString\" " +
- "or \"${statements[key]}\" - their hashes are equal.")
- }
- } else {
- groups.add(group)
- statements[key] = Triple(messageString, level, group)
- }
- }
- }
-
- private val statements: MutableMap<Int, Triple<String, LogLevel, LogGroup>> = mutableMapOf()
- private val groups: MutableSet<LogGroup> = mutableSetOf()
-
- fun processClass(unit: CompilationUnit) {
- protoLogCallVisitor.process(unit, this)
- }
-
- fun build(): String {
- val stringWriter = StringWriter()
- val writer = JsonWriter(stringWriter)
- writer.setIndent(" ")
- writer.beginObject()
- writer.name("version")
- writer.value(VERSION)
- writer.name("messages")
- writer.beginObject()
- statements.toSortedMap().forEach { (key, value) ->
- writer.name(key.toString())
- writer.beginObject()
- writer.name("message")
- writer.value(value.first)
- writer.name("level")
- writer.value(value.second.name)
- writer.name("group")
- writer.value(value.third.name)
- writer.endObject()
- }
- writer.endObject()
- writer.name("groups")
- writer.beginObject()
- groups.toSortedSet(Comparator { o1, o2 -> o1.name.compareTo(o2.name) }).forEach { group ->
- writer.name(group.name)
- writer.beginObject()
- writer.name("tag")
- writer.value(group.tag)
- writer.endObject()
- }
- writer.endObject()
- writer.endObject()
- stringWriter.buffer.append('\n')
- return stringWriter.toString()
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/ViewerConfigParser.kt b/tools/protologtool/src/com/android/protologtool/ViewerConfigParser.kt
deleted file mode 100644
index 69cf92d..0000000
--- a/tools/protologtool/src/com/android/protologtool/ViewerConfigParser.kt
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonReader
-
-open class ViewerConfigParser {
- data class MessageEntry(
- val messageString: String,
- val level: String,
- val groupName: String
- )
-
- fun parseMessage(jsonReader: JsonReader): MessageEntry {
- jsonReader.beginObject()
- var message: String? = null
- var level: String? = null
- var groupName: String? = null
- while (jsonReader.hasNext()) {
- val key = jsonReader.nextName()
- when (key) {
- "message" -> message = jsonReader.nextString()
- "level" -> level = jsonReader.nextString()
- "group" -> groupName = jsonReader.nextString()
- else -> jsonReader.skipValue()
- }
- }
- jsonReader.endObject()
- if (message.isNullOrBlank() || level.isNullOrBlank() || groupName.isNullOrBlank()) {
- throw InvalidViewerConfigException("Invalid message entry in viewer config")
- }
- return MessageEntry(message, level, groupName)
- }
-
- data class GroupEntry(val tag: String)
-
- fun parseGroup(jsonReader: JsonReader): GroupEntry {
- jsonReader.beginObject()
- var tag: String? = null
- while (jsonReader.hasNext()) {
- val key = jsonReader.nextName()
- when (key) {
- "tag" -> tag = jsonReader.nextString()
- else -> jsonReader.skipValue()
- }
- }
- jsonReader.endObject()
- if (tag.isNullOrBlank()) {
- throw InvalidViewerConfigException("Invalid group entry in viewer config")
- }
- return GroupEntry(tag)
- }
-
- fun parseMessages(jsonReader: JsonReader): Map<Int, MessageEntry> {
- val config: MutableMap<Int, MessageEntry> = mutableMapOf()
- jsonReader.beginObject()
- while (jsonReader.hasNext()) {
- val key = jsonReader.nextName()
- val hash = key.toIntOrNull()
- ?: throw InvalidViewerConfigException("Invalid key in messages viewer config")
- config[hash] = parseMessage(jsonReader)
- }
- jsonReader.endObject()
- return config
- }
-
- fun parseGroups(jsonReader: JsonReader): Map<String, GroupEntry> {
- val config: MutableMap<String, GroupEntry> = mutableMapOf()
- jsonReader.beginObject()
- while (jsonReader.hasNext()) {
- val key = jsonReader.nextName()
- config[key] = parseGroup(jsonReader)
- }
- jsonReader.endObject()
- return config
- }
-
- data class ConfigEntry(val messageString: String, val level: String, val tag: String)
-
- open fun parseConfig(jsonReader: JsonReader): Map<Int, ConfigEntry> {
- var messages: Map<Int, MessageEntry>? = null
- var groups: Map<String, GroupEntry>? = null
- var version: String? = null
-
- jsonReader.beginObject()
- while (jsonReader.hasNext()) {
- val key = jsonReader.nextName()
- when (key) {
- "messages" -> messages = parseMessages(jsonReader)
- "groups" -> groups = parseGroups(jsonReader)
- "version" -> version = jsonReader.nextString()
-
- else -> jsonReader.skipValue()
- }
- }
- jsonReader.endObject()
- if (messages == null || groups == null || version == null) {
- throw InvalidViewerConfigException("Invalid config - definitions missing")
- }
- if (version != Constants.VERSION) {
- throw InvalidViewerConfigException("Viewer config version not supported by this tool," +
- " config version $version, viewer version ${Constants.VERSION}")
- }
- return messages.map { msg ->
- msg.key to ConfigEntry(
- msg.value.messageString, msg.value.level, groups[msg.value.groupName]?.tag
- ?: throw InvalidViewerConfigException(
- "Group definition missing for ${msg.value.groupName}"))
- }.toMap()
- }
-}
diff --git a/tools/protologtool/src/com/android/protologtool/exceptions.kt b/tools/protologtool/src/com/android/protologtool/exceptions.kt
deleted file mode 100644
index 2199785..0000000
--- a/tools/protologtool/src/com/android/protologtool/exceptions.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.ast.Node
-import java.lang.Exception
-import java.lang.RuntimeException
-
-class HashCollisionException(message: String) : RuntimeException(message)
-
-class IllegalImportException(message: String) : Exception(message)
-
-class InvalidProtoLogCallException(message: String, node: Node)
- : RuntimeException("$message\nAt: $node")
-
-class InvalidViewerConfigException : Exception {
- constructor(message: String) : super(message)
-
- constructor(message: String, ex: Exception) : super(message, ex)
-}
-
-class InvalidFormatStringException : Exception {
- constructor(message: String) : super(message)
-
- constructor(message: String, ex: Exception) : super(message, ex)
-}
-
-class InvalidInputException(message: String) : Exception(message)
-
-class InvalidCommandException(message: String) : Exception(message)
diff --git a/tools/protologtool/tests/com/android/protolog/tool/CodeUtilsTest.kt b/tools/protologtool/tests/com/android/protolog/tool/CodeUtilsTest.kt
new file mode 100644
index 0000000..337ed99
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/CodeUtilsTest.kt
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.StaticJavaParser
+import com.github.javaparser.ast.expr.BinaryExpr
+import com.github.javaparser.ast.expr.StringLiteralExpr
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class CodeUtilsTest {
+ @Test
+ fun hash() {
+ assertEquals(-1704685243, CodeUtils.hash("test", LogLevel.DEBUG))
+ }
+
+ @Test
+ fun hash_changeLevel() {
+ assertEquals(-1176900998, CodeUtils.hash("test", LogLevel.ERROR))
+ }
+
+ @Test
+ fun hash_changeMessage() {
+ assertEquals(-1305634931, CodeUtils.hash("test2", LogLevel.DEBUG))
+ }
+
+ @Test
+ fun isWildcardStaticImported_true() {
+ val code = """package org.example.test;
+ import static org.example.Test.*;
+ """
+ assertTrue(CodeUtils.isWildcardStaticImported(
+ StaticJavaParser.parse(code), "org.example.Test"))
+ }
+
+ @Test
+ fun isWildcardStaticImported_notStatic() {
+ val code = """package org.example.test;
+ import org.example.Test.*;
+ """
+ assertFalse(CodeUtils.isWildcardStaticImported(
+ StaticJavaParser.parse(code), "org.example.Test"))
+ }
+
+ @Test
+ fun isWildcardStaticImported_differentClass() {
+ val code = """package org.example.test;
+ import static org.example.Test2.*;
+ """
+ assertFalse(CodeUtils.isWildcardStaticImported(
+ StaticJavaParser.parse(code), "org.example.Test"))
+ }
+
+ @Test
+ fun isWildcardStaticImported_notWildcard() {
+ val code = """package org.example.test;
+ import org.example.Test.test;
+ """
+ assertFalse(CodeUtils.isWildcardStaticImported(
+ StaticJavaParser.parse(code), "org.example.Test"))
+ }
+
+ @Test
+ fun isClassImportedOrSamePackage_imported() {
+ val code = """package org.example.test;
+ import org.example.Test;
+ """
+ assertTrue(CodeUtils.isClassImportedOrSamePackage(
+ StaticJavaParser.parse(code), "org.example.Test"))
+ }
+
+ @Test
+ fun isClassImportedOrSamePackage_samePackage() {
+ val code = """package org.example.test;
+ """
+ assertTrue(CodeUtils.isClassImportedOrSamePackage(
+ StaticJavaParser.parse(code), "org.example.test.Test"))
+ }
+
+ @Test
+ fun isClassImportedOrSamePackage_false() {
+ val code = """package org.example.test;
+ import org.example.Test;
+ """
+ assertFalse(CodeUtils.isClassImportedOrSamePackage(
+ StaticJavaParser.parse(code), "org.example.Test2"))
+ }
+
+ @Test
+ fun staticallyImportedMethods_ab() {
+ val code = """
+ import static org.example.Test.a;
+ import static org.example.Test.b;
+ """
+ val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
+ "org.example.Test")
+ assertTrue(imported.containsAll(listOf("a", "b")))
+ assertEquals(2, imported.size)
+ }
+
+ @Test
+ fun staticallyImportedMethods_differentClass() {
+ val code = """
+ import static org.example.Test.a;
+ import static org.example.Test2.b;
+ """
+ val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
+ "org.example.Test")
+ assertTrue(imported.containsAll(listOf("a")))
+ assertEquals(1, imported.size)
+ }
+
+ @Test
+ fun staticallyImportedMethods_notStatic() {
+ val code = """
+ import static org.example.Test.a;
+ import org.example.Test.b;
+ """
+ val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
+ "org.example.Test")
+ assertTrue(imported.containsAll(listOf("a")))
+ assertEquals(1, imported.size)
+ }
+
+ @Test
+ fun concatMultilineString_single() {
+ val str = StringLiteralExpr("test")
+ val out = CodeUtils.concatMultilineString(str)
+ assertEquals("test", out)
+ }
+
+ @Test
+ fun concatMultilineString_double() {
+ val str = """
+ "test" + "abc"
+ """
+ val code = StaticJavaParser.parseExpression<BinaryExpr>(str)
+ val out = CodeUtils.concatMultilineString(code)
+ assertEquals("testabc", out)
+ }
+
+ @Test
+ fun concatMultilineString_multiple() {
+ val str = """
+ "test" + "abc" + "1234" + "test"
+ """
+ val code = StaticJavaParser.parseExpression<BinaryExpr>(str)
+ val out = CodeUtils.concatMultilineString(code)
+ assertEquals("testabc1234test", out)
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/CommandOptionsTest.kt b/tools/protologtool/tests/com/android/protolog/tool/CommandOptionsTest.kt
new file mode 100644
index 0000000..615712e
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/CommandOptionsTest.kt
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+class CommandOptionsTest {
+ companion object {
+ val TEST_JAVA_SRC = listOf(
+ "frameworks/base/services/core/java/com/android/server/wm/" +
+ "AccessibilityController.java",
+ "frameworks/base/services/core/java/com/android/server/wm/ActivityDisplay.java",
+ "frameworks/base/services/core/java/com/android/server/wm/" +
+ "ActivityMetricsLaunchObserver.java"
+ )
+ private const val TEST_PROTOLOG_CLASS = "com.android.server.wm.ProtoLog"
+ private const val TEST_PROTOLOGIMPL_CLASS = "com.android.server.wm.ProtoLogImpl"
+ private const val TEST_PROTOLOGGROUP_CLASS = "com.android.server.wm.ProtoLogGroup"
+ private const val TEST_PROTOLOGGROUP_JAR = "out/soong/.intermediates/frameworks/base/" +
+ "services/core/services.core.wm.protologgroups/android_common/javac/" +
+ "services.core.wm.protologgroups.jar"
+ private const val TEST_SRC_JAR = "out/soong/.temp/sbox175955373/" +
+ "services.core.wm.protolog.srcjar"
+ private const val TEST_VIEWER_JSON = "out/soong/.temp/sbox175955373/" +
+ "services.core.wm.protolog.json"
+ private const val TEST_LOG = "./test_log.pb"
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun noCommand() {
+ CommandOptions(arrayOf())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun invalidCommand() {
+ val testLine = "invalid"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test
+ fun transformClasses() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ val cmd = CommandOptions(testLine.split(' ').toTypedArray())
+ assertEquals(CommandOptions.TRANSFORM_CALLS_CMD, cmd.command)
+ assertEquals(TEST_PROTOLOG_CLASS, cmd.protoLogClassNameArg)
+ assertEquals(TEST_PROTOLOGIMPL_CLASS, cmd.protoLogImplClassNameArg)
+ assertEquals(TEST_PROTOLOGGROUP_CLASS, cmd.protoLogGroupsClassNameArg)
+ assertEquals(TEST_PROTOLOGGROUP_JAR, cmd.protoLogGroupsJarArg)
+ assertEquals(TEST_SRC_JAR, cmd.outputSourceJarArg)
+ assertEquals(TEST_JAVA_SRC, cmd.javaSourceArgs)
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noProtoLogClass() {
+ val testLine = "transform-protolog-calls " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noProtoLogImplClass() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noProtoLogGroupClass() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noProtoLogGroupJar() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noOutJar() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ TEST_JAVA_SRC.joinToString(" ")
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noJavaInput() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidProtoLogClass() {
+ val testLine = "transform-protolog-calls --protolog-class invalid " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidProtoLogImplClass() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class invalid " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidProtoLogGroupClass() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class invalid " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidProtoLogGroupJar() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar invalid.txt " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidOutJar() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar invalid.db ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_invalidJavaInput() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR invalid.py"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_unknownParam() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--unknown test --protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun transformClasses_noValue() {
+ val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--protolog-impl-class " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test
+ fun generateConfig() {
+ val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--viewer-conf $TEST_VIEWER_JSON ${TEST_JAVA_SRC.joinToString(" ")}"
+ val cmd = CommandOptions(testLine.split(' ').toTypedArray())
+ assertEquals(CommandOptions.GENERATE_CONFIG_CMD, cmd.command)
+ assertEquals(TEST_PROTOLOG_CLASS, cmd.protoLogClassNameArg)
+ assertEquals(TEST_PROTOLOGGROUP_CLASS, cmd.protoLogGroupsClassNameArg)
+ assertEquals(TEST_PROTOLOGGROUP_JAR, cmd.protoLogGroupsJarArg)
+ assertEquals(TEST_VIEWER_JSON, cmd.viewerConfigJsonArg)
+ assertEquals(TEST_JAVA_SRC, cmd.javaSourceArgs)
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun generateConfig_noViewerConfig() {
+ val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ TEST_JAVA_SRC.joinToString(" ")
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test(expected = InvalidCommandException::class)
+ fun generateConfig_invalidViewerConfig() {
+ val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
+ "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
+ "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
+ "--viewer-conf invalid.yaml ${TEST_JAVA_SRC.joinToString(" ")}"
+ CommandOptions(testLine.split(' ').toTypedArray())
+ }
+
+ @Test
+ fun readLog() {
+ val testLine = "read-log --viewer-conf $TEST_VIEWER_JSON $TEST_LOG"
+ val cmd = CommandOptions(testLine.split(' ').toTypedArray())
+ assertEquals(CommandOptions.READ_LOG_CMD, cmd.command)
+ assertEquals(TEST_VIEWER_JSON, cmd.viewerConfigJsonArg)
+ assertEquals(TEST_LOG, cmd.logProtofileArg)
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/LogParserTest.kt b/tools/protologtool/tests/com/android/protolog/tool/LogParserTest.kt
new file mode 100644
index 0000000..04a3bfa
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/LogParserTest.kt
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonReader
+import com.android.server.protolog.ProtoLogMessage
+import com.android.server.protolog.ProtoLogFileProto
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Test
+import org.mockito.Mockito
+import org.mockito.Mockito.mock
+import java.io.ByteArrayOutputStream
+import java.io.InputStream
+import java.io.OutputStream
+import java.io.PrintStream
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+
+class LogParserTest {
+ private val configParser: ViewerConfigParser = mock(ViewerConfigParser::class.java)
+ private val parser = LogParser(configParser)
+ private var config: MutableMap<Int, ViewerConfigParser.ConfigEntry> = mutableMapOf()
+ private var outStream: OutputStream = ByteArrayOutputStream()
+ private var printStream: PrintStream = PrintStream(outStream)
+ private val dateFormat = SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.US)
+
+ @Before
+ fun init() {
+ Mockito.`when`(configParser.parseConfig(any(JsonReader::class.java))).thenReturn(config)
+ }
+
+ private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
+
+ private fun getConfigDummyStream(): InputStream {
+ return "".byteInputStream()
+ }
+
+ private fun buildProtoInput(logBuilder: ProtoLogFileProto.Builder): InputStream {
+ logBuilder.setVersion(Constants.VERSION)
+ logBuilder.magicNumber =
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
+ return logBuilder.build().toByteArray().inputStream()
+ }
+
+ private fun testDate(timeMS: Long): String {
+ return dateFormat.format(Date(timeMS))
+ }
+
+ @Test
+ fun parse() {
+ config[70933285] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b",
+ "ERROR", "WindowManager")
+
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ val logMessageBuilder = ProtoLogMessage.newBuilder()
+ logMessageBuilder
+ .setMessageHash(70933285)
+ .setElapsedRealtimeNanos(0)
+ .addBooleanParams(true)
+ logBuilder.addLog(logMessageBuilder.build())
+
+ parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
+
+ assertEquals("${testDate(0)} ERROR WindowManager: Test completed successfully: true\n",
+ outStream.toString())
+ }
+
+ @Test
+ fun parse_formatting() {
+ config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o" +
+ " %x %e %g %s %f", "ERROR", "WindowManager")
+
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ val logMessageBuilder = ProtoLogMessage.newBuilder()
+ logMessageBuilder
+ .setMessageHash(123)
+ .setElapsedRealtimeNanos(0)
+ .addBooleanParams(true)
+ .addAllSint64Params(listOf(1000, 20000, 300000))
+ .addAllDoubleParams(listOf(0.1, 0.00001, 1000.1))
+ .addStrParams("test")
+ logBuilder.addLog(logMessageBuilder.build())
+
+ parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
+
+ assertEquals("${testDate(0)} ERROR WindowManager: Test completed successfully: " +
+ "true 1000 % 47040 493e0 1.000000e-01 1.00000e-05 test 1000.100000\n",
+ outStream.toString())
+ }
+
+ @Test
+ fun parse_invalidParamsTooMany() {
+ config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o",
+ "ERROR", "WindowManager")
+
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ val logMessageBuilder = ProtoLogMessage.newBuilder()
+ logMessageBuilder
+ .setMessageHash(123)
+ .setElapsedRealtimeNanos(0)
+ .addBooleanParams(true)
+ .addAllSint64Params(listOf(1000, 20000, 300000))
+ .addAllDoubleParams(listOf(0.1, 0.00001, 1000.1))
+ .addStrParams("test")
+ logBuilder.addLog(logMessageBuilder.build())
+
+ parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
+
+ assertEquals("${testDate(0)} INVALID: 123 - [test] [1000, 20000, 300000] " +
+ "[0.1, 1.0E-5, 1000.1] [true]\n", outStream.toString())
+ }
+
+ @Test
+ fun parse_invalidParamsNotEnough() {
+ config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o" +
+ " %x %e %g %s %f", "ERROR", "WindowManager")
+
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ val logMessageBuilder = ProtoLogMessage.newBuilder()
+ logMessageBuilder
+ .setMessageHash(123)
+ .setElapsedRealtimeNanos(0)
+ .addBooleanParams(true)
+ .addStrParams("test")
+ logBuilder.addLog(logMessageBuilder.build())
+
+ parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
+
+ assertEquals("${testDate(0)} INVALID: 123 - [test] [] [] [true]\n",
+ outStream.toString())
+ }
+
+ @Test(expected = InvalidInputException::class)
+ fun parse_invalidMagicNumber() {
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ logBuilder.setVersion(Constants.VERSION)
+ logBuilder.magicNumber = 0
+ val stream = logBuilder.build().toByteArray().inputStream()
+
+ parser.parse(stream, getConfigDummyStream(), printStream)
+ }
+
+ @Test(expected = InvalidInputException::class)
+ fun parse_invalidVersion() {
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ logBuilder.setVersion("invalid")
+ logBuilder.magicNumber =
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
+ ProtoLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
+ val stream = logBuilder.build().toByteArray().inputStream()
+
+ parser.parse(stream, getConfigDummyStream(), printStream)
+ }
+
+ @Test
+ fun parse_noConfig() {
+ val logBuilder = ProtoLogFileProto.newBuilder()
+ val logMessageBuilder = ProtoLogMessage.newBuilder()
+ logMessageBuilder
+ .setMessageHash(70933285)
+ .setElapsedRealtimeNanos(0)
+ .addBooleanParams(true)
+ logBuilder.addLog(logMessageBuilder.build())
+
+ parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
+
+ assertEquals("${testDate(0)} UNKNOWN: 70933285 - [] [] [] [true]\n",
+ outStream.toString())
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/ProtoLogCallProcessorTest.kt b/tools/protologtool/tests/com/android/protolog/tool/ProtoLogCallProcessorTest.kt
new file mode 100644
index 0000000..d20ce7e
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/ProtoLogCallProcessorTest.kt
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.StaticJavaParser
+import com.github.javaparser.ast.expr.MethodCallExpr
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+class ProtoLogCallProcessorTest {
+ private data class LogCall(
+ val call: MethodCallExpr,
+ val messageString: String,
+ val level: LogLevel,
+ val group: LogGroup
+ )
+
+ private val groupMap: MutableMap<String, LogGroup> = mutableMapOf()
+ private val calls: MutableList<LogCall> = mutableListOf()
+ private val visitor = ProtoLogCallProcessor("org.example.ProtoLog", "org.example.ProtoLogGroup",
+ groupMap)
+ private val processor = object : ProtoLogCallVisitor {
+ override fun processCall(
+ call: MethodCallExpr,
+ messageString: String,
+ level: LogLevel,
+ group: LogGroup
+ ) {
+ calls.add(LogCall(call, messageString, level, group))
+ }
+ }
+
+ private fun checkCalls() {
+ assertEquals(1, calls.size)
+ val c = calls[0]
+ assertEquals("test %b", c.messageString)
+ assertEquals(groupMap["TEST"], c.group)
+ assertEquals(LogLevel.DEBUG, c.level)
+ }
+
+ @Test
+ fun process_samePackage() {
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ ProtoLog.e(ProtoLogGroup.ERROR, "error %d", 1);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", true, false, "WindowManager")
+ groupMap["ERROR"] = LogGroup("ERROR", true, true, "WindowManagerERROR")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ assertEquals(2, calls.size)
+ var c = calls[0]
+ assertEquals("test %b", c.messageString)
+ assertEquals(groupMap["TEST"], c.group)
+ assertEquals(LogLevel.DEBUG, c.level)
+ c = calls[1]
+ assertEquals("error %d", c.messageString)
+ assertEquals(groupMap["ERROR"], c.group)
+ assertEquals(LogLevel.ERROR, c.level)
+ }
+
+ @Test
+ fun process_imported() {
+ val code = """
+ package org.example2;
+
+ import org.example.ProtoLog;
+ import org.example.ProtoLogGroup;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ checkCalls()
+ }
+
+ @Test
+ fun process_importedStatic() {
+ val code = """
+ package org.example2;
+
+ import static org.example.ProtoLog.d;
+ import static org.example.ProtoLogGroup.TEST;
+
+ class Test {
+ void test() {
+ d(TEST, "test %b", true);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ checkCalls()
+ }
+
+ @Test(expected = InvalidProtoLogCallException::class)
+ fun process_groupNotImported() {
+ val code = """
+ package org.example2;
+
+ import org.example.ProtoLog;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ }
+
+ @Test
+ fun process_protoLogNotImported() {
+ val code = """
+ package org.example2;
+
+ import org.example.ProtoLogGroup;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ assertEquals(0, calls.size)
+ }
+
+ @Test(expected = InvalidProtoLogCallException::class)
+ fun process_unknownGroup() {
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ }
+ }
+ """
+ visitor.process(StaticJavaParser.parse(code), processor)
+ }
+
+ @Test(expected = InvalidProtoLogCallException::class)
+ fun process_staticGroup() {
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d(TEST, "test %b", true);
+ }
+ }
+ """
+ visitor.process(StaticJavaParser.parse(code), processor)
+ }
+
+ @Test(expected = InvalidProtoLogCallException::class)
+ fun process_badGroup() {
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d(0, "test %b", true);
+ }
+ }
+ """
+ visitor.process(StaticJavaParser.parse(code), processor)
+ }
+
+ @Test(expected = InvalidProtoLogCallException::class)
+ fun process_invalidSignature() {
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d("test");
+ }
+ }
+ """
+ visitor.process(StaticJavaParser.parse(code), processor)
+ }
+
+ @Test
+ fun process_disabled() {
+ // Disabled groups are also processed.
+ val code = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
+ }
+ }
+ """
+ groupMap["TEST"] = LogGroup("TEST", false, true, "WindowManager")
+ visitor.process(StaticJavaParser.parse(code), processor)
+ checkCalls()
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/SourceTransformerTest.kt b/tools/protologtool/tests/com/android/protolog/tool/SourceTransformerTest.kt
new file mode 100644
index 0000000..d6e4a36
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/SourceTransformerTest.kt
@@ -0,0 +1,445 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.github.javaparser.StaticJavaParser
+import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.expr.MethodCallExpr
+import com.github.javaparser.ast.stmt.IfStmt
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Test
+import org.mockito.Mockito
+
+class SourceTransformerTest {
+ companion object {
+ private const val PROTO_LOG_IMPL_PATH = "org.example.ProtoLogImpl"
+
+ /* ktlint-disable max-line-length */
+ private val TEST_CODE = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
+ }
+ }
+ """.trimIndent()
+
+ private val TEST_CODE_MULTILINE = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.w(TEST_GROUP, "test %d %f " +
+ "abc %s\n test", 100,
+ 0.1, "test");
+ }
+ }
+ """.trimIndent()
+
+ private val TEST_CODE_MULTICALLS = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); /* ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); */ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
+ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
+ }
+ }
+ """.trimIndent()
+
+ private val TEST_CODE_NO_PARAMS = """
+ package org.example;
+
+ class Test {
+ void test() {
+ ProtoLog.w(TEST_GROUP, "test");
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_TEXT_ENABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_MULTILINE_TEXT_ENABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; String protoLogParam2 = String.valueOf("test"); org.example.ProtoLogImpl.w(TEST_GROUP, -986393606, 9, "test %d %f " + "abc %s\n test", protoLogParam0, protoLogParam1, protoLogParam2);
+
+ }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_MULTICALL_TEXT_ENABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); } /* ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); */ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_NO_PARAMS = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { org.example.ProtoLogImpl.w(TEST_GROUP, 1282022424, 0, "test", (Object[]) null); }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_TEXT_DISABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, null, protoLogParam0, protoLogParam1); }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_MULTILINE_TEXT_DISABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; String protoLogParam2 = String.valueOf("test"); org.example.ProtoLogImpl.w(TEST_GROUP, -986393606, 9, null, protoLogParam0, protoLogParam1, protoLogParam2);
+
+ }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_DISABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (false) { /* TEST_GROUP is disabled */ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); }
+ }
+ }
+ """.trimIndent()
+
+ private val TRANSFORMED_CODE_MULTILINE_DISABLED = """
+ package org.example;
+
+ class Test {
+ void test() {
+ if (false) { /* TEST_GROUP is disabled */ ProtoLog.w(TEST_GROUP, "test %d %f " + "abc %s\n test", 100, 0.1, "test");
+
+ }
+ }
+ }
+ """.trimIndent()
+ /* ktlint-enable max-line-length */
+ }
+
+ private val processor: ProtoLogCallProcessor = Mockito.mock(ProtoLogCallProcessor::class.java)
+ private val sourceJarWriter = SourceTransformer("org.example.ProtoLogImpl", processor)
+
+ private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
+
+ @Test
+ fun processClass_textEnabled() {
+ var code = StaticJavaParser.parse(TEST_CODE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(3, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(6, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("835524026", methodCall.arguments[1].toString())
+ assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
+ assertEquals("\"test %d %f\"", methodCall.arguments[3].toString())
+ assertEquals("protoLogParam0", methodCall.arguments[4].toString())
+ assertEquals("protoLogParam1", methodCall.arguments[5].toString())
+ assertEquals(TRANSFORMED_CODE_TEXT_ENABLED, out)
+ }
+
+ @Test
+ fun processClass_textEnabledMulticalls() {
+ var code = StaticJavaParser.parse(TEST_CODE_MULTICALLS)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ val calls = code.findAll(MethodCallExpr::class.java)
+ visitor.processCall(calls[0], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
+ visitor.processCall(calls[1], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
+ visitor.processCall(calls[2], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE_MULTICALLS, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(3, ifStmts.size)
+ val ifStmt = ifStmts[1]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(3, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(6, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("835524026", methodCall.arguments[1].toString())
+ assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
+ assertEquals("\"test %d %f\"", methodCall.arguments[3].toString())
+ assertEquals("protoLogParam0", methodCall.arguments[4].toString())
+ assertEquals("protoLogParam1", methodCall.arguments[5].toString())
+ assertEquals(TRANSFORMED_CODE_MULTICALL_TEXT_ENABLED, out)
+ }
+
+ @Test
+ fun processClass_textEnabledMultiline() {
+ var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
+ "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
+ true, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(4, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[1] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(7, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("-986393606", methodCall.arguments[1].toString())
+ assertEquals(0b001001.toString(), methodCall.arguments[2].toString())
+ assertEquals("protoLogParam0", methodCall.arguments[4].toString())
+ assertEquals("protoLogParam1", methodCall.arguments[5].toString())
+ assertEquals("protoLogParam2", methodCall.arguments[6].toString())
+ assertEquals(TRANSFORMED_CODE_MULTILINE_TEXT_ENABLED, out)
+ }
+
+ @Test
+ fun processClass_noParams() {
+ var code = StaticJavaParser.parse(TEST_CODE_NO_PARAMS)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE_NO_PARAMS, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(1, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(5, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("1282022424", methodCall.arguments[1].toString())
+ assertEquals(0.toString(), methodCall.arguments[2].toString())
+ assertEquals(TRANSFORMED_CODE_NO_PARAMS, out)
+ }
+
+ @Test
+ fun processClass_textDisabled() {
+ var code = StaticJavaParser.parse(TEST_CODE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", true, false, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(3, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(6, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("835524026", methodCall.arguments[1].toString())
+ assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
+ assertEquals("null", methodCall.arguments[3].toString())
+ assertEquals("protoLogParam0", methodCall.arguments[4].toString())
+ assertEquals("protoLogParam1", methodCall.arguments[5].toString())
+ assertEquals(TRANSFORMED_CODE_TEXT_DISABLED, out)
+ }
+
+ @Test
+ fun processClass_textDisabledMultiline() {
+ var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
+ "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
+ true, false, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
+ ifStmt.condition.toString())
+ assertFalse(ifStmt.elseStmt.isPresent)
+ assertEquals(4, ifStmt.thenStmt.childNodes.size)
+ val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[1] as MethodCallExpr
+ assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
+ assertEquals("w", methodCall.name.asString())
+ assertEquals(7, methodCall.arguments.size)
+ assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
+ assertEquals("-986393606", methodCall.arguments[1].toString())
+ assertEquals(0b001001.toString(), methodCall.arguments[2].toString())
+ assertEquals("null", methodCall.arguments[3].toString())
+ assertEquals("protoLogParam0", methodCall.arguments[4].toString())
+ assertEquals("protoLogParam1", methodCall.arguments[5].toString())
+ assertEquals("protoLogParam2", methodCall.arguments[6].toString())
+ assertEquals(TRANSFORMED_CODE_MULTILINE_TEXT_DISABLED, out)
+ }
+
+ @Test
+ fun processClass_disabled() {
+ var code = StaticJavaParser.parse(TEST_CODE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
+ LogLevel.WARN, LogGroup("TEST_GROUP", false, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("false", ifStmt.condition.toString())
+ assertEquals(TRANSFORMED_CODE_DISABLED, out)
+ }
+
+ @Test
+ fun processClass_disabledMultiline() {
+ var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
+
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
+ "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
+ false, true, "WM_TEST"))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
+ code = StaticJavaParser.parse(out)
+
+ val ifStmts = code.findAll(IfStmt::class.java)
+ assertEquals(1, ifStmts.size)
+ val ifStmt = ifStmts[0]
+ assertEquals("false", ifStmt.condition.toString())
+ assertEquals(TRANSFORMED_CODE_MULTILINE_DISABLED, out)
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigBuilderTest.kt b/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigBuilderTest.kt
new file mode 100644
index 0000000..f435d40
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigBuilderTest.kt
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonReader
+import com.github.javaparser.ast.CompilationUnit
+import com.github.javaparser.ast.expr.MethodCallExpr
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.mockito.Mockito
+import java.io.StringReader
+
+class ViewerConfigBuilderTest {
+ companion object {
+ private val TAG1 = "WM_TEST"
+ private val TAG2 = "WM_DEBUG"
+ private val TEST1 = ViewerConfigParser.ConfigEntry("test1", LogLevel.INFO.name, TAG1)
+ private val TEST2 = ViewerConfigParser.ConfigEntry("test2", LogLevel.DEBUG.name, TAG2)
+ private val TEST3 = ViewerConfigParser.ConfigEntry("test3", LogLevel.ERROR.name, TAG2)
+ }
+
+ private val processor: ProtoLogCallProcessor = Mockito.mock(ProtoLogCallProcessor::class.java)
+ private val configBuilder = ViewerConfigBuilder(processor)
+ private val dummyCompilationUnit = CompilationUnit()
+
+ private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
+
+ private fun parseConfig(json: String): Map<Int, ViewerConfigParser.ConfigEntry> {
+ return ViewerConfigParser().parseConfig(JsonReader(StringReader(json)))
+ }
+
+ @Test
+ fun processClass() {
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
+ LogGroup("TEST_GROUP", true, true, TAG1))
+ visitor.processCall(MethodCallExpr(), TEST2.messageString, LogLevel.DEBUG,
+ LogGroup("DEBUG_GROUP", true, true, TAG2))
+ visitor.processCall(MethodCallExpr(), TEST3.messageString, LogLevel.ERROR,
+ LogGroup("DEBUG_GROUP", true, true, TAG2))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ configBuilder.processClass(dummyCompilationUnit)
+
+ val parsedConfig = parseConfig(configBuilder.build())
+ assertEquals(3, parsedConfig.size)
+ assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString,
+ LogLevel.INFO)])
+ assertEquals(TEST2, parsedConfig[CodeUtils.hash(TEST2.messageString,
+ LogLevel.DEBUG)])
+ assertEquals(TEST3, parsedConfig[CodeUtils.hash(TEST3.messageString,
+ LogLevel.ERROR)])
+ }
+
+ @Test
+ fun processClass_nonUnique() {
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
+ LogGroup("TEST_GROUP", true, true, TAG1))
+ visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
+ LogGroup("TEST_GROUP", true, true, TAG1))
+ visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
+ LogGroup("TEST_GROUP", true, true, TAG1))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ configBuilder.processClass(dummyCompilationUnit)
+
+ val parsedConfig = parseConfig(configBuilder.build())
+ assertEquals(1, parsedConfig.size)
+ assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString, LogLevel.INFO)])
+ }
+
+ @Test
+ fun processClass_disabled() {
+ Mockito.`when`(processor.process(any(CompilationUnit::class.java),
+ any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
+ val visitor = invocation.arguments[1] as ProtoLogCallVisitor
+
+ visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
+ LogGroup("TEST_GROUP", true, true, TAG1))
+ visitor.processCall(MethodCallExpr(), TEST2.messageString, LogLevel.DEBUG,
+ LogGroup("DEBUG_GROUP", false, true, TAG2))
+ visitor.processCall(MethodCallExpr(), TEST3.messageString, LogLevel.ERROR,
+ LogGroup("DEBUG_GROUP", true, false, TAG2))
+
+ invocation.arguments[0] as CompilationUnit
+ }
+
+ configBuilder.processClass(dummyCompilationUnit)
+
+ val parsedConfig = parseConfig(configBuilder.build())
+ assertEquals(2, parsedConfig.size)
+ assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString, LogLevel.INFO)])
+ assertEquals(TEST3, parsedConfig[CodeUtils.hash(TEST3.messageString, LogLevel.ERROR)])
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigParserTest.kt b/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigParserTest.kt
new file mode 100644
index 0000000..dc3ef7c
--- /dev/null
+++ b/tools/protologtool/tests/com/android/protolog/tool/ViewerConfigParserTest.kt
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2019 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.protolog.tool
+
+import com.android.json.stream.JsonReader
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import java.io.StringReader
+
+class ViewerConfigParserTest {
+ private val parser = ViewerConfigParser()
+
+ private fun getJSONReader(str: String): JsonReader {
+ return JsonReader(StringReader(str))
+ }
+
+ @Test
+ fun parseMessage() {
+ val json = """
+ {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ """
+ val msg = parser.parseMessage(getJSONReader(json))
+ assertEquals("Test completed successfully: %b", msg.messageString)
+ assertEquals("ERROR", msg.level)
+ assertEquals("GENERIC_WM", msg.groupName)
+ }
+
+ @Test
+ fun parseMessage_reorder() {
+ val json = """
+ {
+ "group": "GENERIC_WM",
+ "level": "ERROR",
+ "message": "Test completed successfully: %b"
+ }
+ """
+ val msg = parser.parseMessage(getJSONReader(json))
+ assertEquals("Test completed successfully: %b", msg.messageString)
+ assertEquals("ERROR", msg.level)
+ assertEquals("GENERIC_WM", msg.groupName)
+ }
+
+ @Test
+ fun parseMessage_unknownEntry() {
+ val json = """
+ {
+ "unknown": "unknown entries should not block parsing",
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ """
+ val msg = parser.parseMessage(getJSONReader(json))
+ assertEquals("Test completed successfully: %b", msg.messageString)
+ assertEquals("ERROR", msg.level)
+ assertEquals("GENERIC_WM", msg.groupName)
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseMessage_noMessage() {
+ val json = """
+ {
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ """
+ parser.parseMessage(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseMessage_noLevel() {
+ val json = """
+ {
+ "message": "Test completed successfully: %b",
+ "group": "GENERIC_WM"
+ }
+ """
+ parser.parseMessage(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseMessage_noGroup() {
+ val json = """
+ {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR"
+ }
+ """
+ parser.parseMessage(getJSONReader(json))
+ }
+
+ @Test
+ fun parseGroup() {
+ val json = """
+ {
+ "tag": "WindowManager"
+ }
+ """
+ val group = parser.parseGroup(getJSONReader(json))
+ assertEquals("WindowManager", group.tag)
+ }
+
+ @Test
+ fun parseGroup_unknownEntry() {
+ val json = """
+ {
+ "unknown": "unknown entries should not block parsing",
+ "tag": "WindowManager"
+ }
+ """
+ val group = parser.parseGroup(getJSONReader(json))
+ assertEquals("WindowManager", group.tag)
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseGroup_noTag() {
+ val json = """
+ {
+ }
+ """
+ parser.parseGroup(getJSONReader(json))
+ }
+
+ @Test
+ fun parseMessages() {
+ val json = """
+ {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ },
+ "1792430067": {
+ "message": "Attempted to add window to a display that does not exist: %d. Aborting.",
+ "level": "WARN",
+ "group": "ERROR_WM"
+ }
+ }
+ """
+ val messages = parser.parseMessages(getJSONReader(json))
+ assertEquals(2, messages.size)
+ val msg1 =
+ ViewerConfigParser.MessageEntry("Test completed successfully: %b",
+ "ERROR", "GENERIC_WM")
+ val msg2 =
+ ViewerConfigParser.MessageEntry("Attempted to add window to a display that " +
+ "does not exist: %d. Aborting.", "WARN", "ERROR_WM")
+
+ assertEquals(msg1, messages[70933285])
+ assertEquals(msg2, messages[1792430067])
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseMessages_invalidHash() {
+ val json = """
+ {
+ "invalid": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ }
+ """
+ parser.parseMessages(getJSONReader(json))
+ }
+
+ @Test
+ fun parseGroups() {
+ val json = """
+ {
+ "GENERIC_WM": {
+ "tag": "WindowManager"
+ },
+ "ERROR_WM": {
+ "tag": "WindowManagerError"
+ }
+ }
+ """
+ val groups = parser.parseGroups(getJSONReader(json))
+ assertEquals(2, groups.size)
+ val grp1 = ViewerConfigParser.GroupEntry("WindowManager")
+ val grp2 = ViewerConfigParser.GroupEntry("WindowManagerError")
+ assertEquals(grp1, groups["GENERIC_WM"])
+ assertEquals(grp2, groups["ERROR_WM"])
+ }
+
+ @Test
+ fun parseConfig() {
+ val json = """
+ {
+ "version": "${Constants.VERSION}",
+ "messages": {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ },
+ "groups": {
+ "GENERIC_WM": {
+ "tag": "WindowManager"
+ }
+ }
+ }
+ """
+ val config = parser.parseConfig(getJSONReader(json))
+ assertEquals(1, config.size)
+ val cfg1 = ViewerConfigParser.ConfigEntry("Test completed successfully: %b",
+ "ERROR", "WindowManager")
+ assertEquals(cfg1, config[70933285])
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseConfig_invalidVersion() {
+ val json = """
+ {
+ "version": "invalid",
+ "messages": {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ },
+ "groups": {
+ "GENERIC_WM": {
+ "tag": "WindowManager"
+ }
+ }
+ }
+ """
+ parser.parseConfig(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseConfig_noVersion() {
+ val json = """
+ {
+ "messages": {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ },
+ "groups": {
+ "GENERIC_WM": {
+ "tag": "WindowManager"
+ }
+ }
+ }
+ """
+ parser.parseConfig(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseConfig_noMessages() {
+ val json = """
+ {
+ "version": "${Constants.VERSION}",
+ "groups": {
+ "GENERIC_WM": {
+ "tag": "WindowManager"
+ }
+ }
+ }
+ """
+ parser.parseConfig(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseConfig_noGroups() {
+ val json = """
+ {
+ "version": "${Constants.VERSION}",
+ "messages": {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ }
+ }
+ """
+ parser.parseConfig(getJSONReader(json))
+ }
+
+ @Test(expected = InvalidViewerConfigException::class)
+ fun parseConfig_missingGroup() {
+ val json = """
+ {
+ "version": "${Constants.VERSION}",
+ "messages": {
+ "70933285": {
+ "message": "Test completed successfully: %b",
+ "level": "ERROR",
+ "group": "GENERIC_WM"
+ }
+ },
+ "groups": {
+ "ERROR_WM": {
+ "tag": "WindowManager"
+ }
+ }
+ }
+ """
+ parser.parseConfig(getJSONReader(json))
+ }
+}
diff --git a/tools/protologtool/tests/com/android/protologtool/CodeUtilsTest.kt b/tools/protologtool/tests/com/android/protologtool/CodeUtilsTest.kt
deleted file mode 100644
index 82daa73..0000000
--- a/tools/protologtool/tests/com/android/protologtool/CodeUtilsTest.kt
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.StaticJavaParser
-import com.github.javaparser.ast.expr.BinaryExpr
-import com.github.javaparser.ast.expr.StringLiteralExpr
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertFalse
-import org.junit.Assert.assertTrue
-import org.junit.Test
-
-class CodeUtilsTest {
- @Test
- fun hash() {
- assertEquals(-1704685243, CodeUtils.hash("test", LogLevel.DEBUG))
- }
-
- @Test
- fun hash_changeLevel() {
- assertEquals(-1176900998, CodeUtils.hash("test", LogLevel.ERROR))
- }
-
- @Test
- fun hash_changeMessage() {
- assertEquals(-1305634931, CodeUtils.hash("test2", LogLevel.DEBUG))
- }
-
- @Test
- fun isWildcardStaticImported_true() {
- val code = """package org.example.test;
- import static org.example.Test.*;
- """
- assertTrue(CodeUtils.isWildcardStaticImported(
- StaticJavaParser.parse(code), "org.example.Test"))
- }
-
- @Test
- fun isWildcardStaticImported_notStatic() {
- val code = """package org.example.test;
- import org.example.Test.*;
- """
- assertFalse(CodeUtils.isWildcardStaticImported(
- StaticJavaParser.parse(code), "org.example.Test"))
- }
-
- @Test
- fun isWildcardStaticImported_differentClass() {
- val code = """package org.example.test;
- import static org.example.Test2.*;
- """
- assertFalse(CodeUtils.isWildcardStaticImported(
- StaticJavaParser.parse(code), "org.example.Test"))
- }
-
- @Test
- fun isWildcardStaticImported_notWildcard() {
- val code = """package org.example.test;
- import org.example.Test.test;
- """
- assertFalse(CodeUtils.isWildcardStaticImported(
- StaticJavaParser.parse(code), "org.example.Test"))
- }
-
- @Test
- fun isClassImportedOrSamePackage_imported() {
- val code = """package org.example.test;
- import org.example.Test;
- """
- assertTrue(CodeUtils.isClassImportedOrSamePackage(
- StaticJavaParser.parse(code), "org.example.Test"))
- }
-
- @Test
- fun isClassImportedOrSamePackage_samePackage() {
- val code = """package org.example.test;
- """
- assertTrue(CodeUtils.isClassImportedOrSamePackage(
- StaticJavaParser.parse(code), "org.example.test.Test"))
- }
-
- @Test
- fun isClassImportedOrSamePackage_false() {
- val code = """package org.example.test;
- import org.example.Test;
- """
- assertFalse(CodeUtils.isClassImportedOrSamePackage(
- StaticJavaParser.parse(code), "org.example.Test2"))
- }
-
- @Test
- fun staticallyImportedMethods_ab() {
- val code = """
- import static org.example.Test.a;
- import static org.example.Test.b;
- """
- val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
- "org.example.Test")
- assertTrue(imported.containsAll(listOf("a", "b")))
- assertEquals(2, imported.size)
- }
-
- @Test
- fun staticallyImportedMethods_differentClass() {
- val code = """
- import static org.example.Test.a;
- import static org.example.Test2.b;
- """
- val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
- "org.example.Test")
- assertTrue(imported.containsAll(listOf("a")))
- assertEquals(1, imported.size)
- }
-
- @Test
- fun staticallyImportedMethods_notStatic() {
- val code = """
- import static org.example.Test.a;
- import org.example.Test.b;
- """
- val imported = CodeUtils.staticallyImportedMethods(StaticJavaParser.parse(code),
- "org.example.Test")
- assertTrue(imported.containsAll(listOf("a")))
- assertEquals(1, imported.size)
- }
-
- @Test
- fun concatMultilineString_single() {
- val str = StringLiteralExpr("test")
- val out = CodeUtils.concatMultilineString(str)
- assertEquals("test", out)
- }
-
- @Test
- fun concatMultilineString_double() {
- val str = """
- "test" + "abc"
- """
- val code = StaticJavaParser.parseExpression<BinaryExpr>(str)
- val out = CodeUtils.concatMultilineString(code)
- assertEquals("testabc", out)
- }
-
- @Test
- fun concatMultilineString_multiple() {
- val str = """
- "test" + "abc" + "1234" + "test"
- """
- val code = StaticJavaParser.parseExpression<BinaryExpr>(str)
- val out = CodeUtils.concatMultilineString(code)
- assertEquals("testabc1234test", out)
- }
-
- @Test
- fun parseFormatString() {
- val str = "%b %d %o %x %f %e %g %s %%"
- val out = CodeUtils.parseFormatString(str)
- assertEquals(listOf(
- CodeUtils.LogDataTypes.BOOLEAN,
- CodeUtils.LogDataTypes.LONG,
- CodeUtils.LogDataTypes.LONG,
- CodeUtils.LogDataTypes.LONG,
- CodeUtils.LogDataTypes.DOUBLE,
- CodeUtils.LogDataTypes.DOUBLE,
- CodeUtils.LogDataTypes.DOUBLE,
- CodeUtils.LogDataTypes.STRING
- ), out)
- }
-
- @Test(expected = InvalidFormatStringException::class)
- fun parseFormatString_invalid() {
- val str = "%q"
- CodeUtils.parseFormatString(str)
- }
-
- @Test
- fun logDataTypesToBitMask() {
- val types = listOf(CodeUtils.LogDataTypes.STRING, CodeUtils.LogDataTypes.DOUBLE,
- CodeUtils.LogDataTypes.LONG, CodeUtils.LogDataTypes.BOOLEAN)
- val mask = CodeUtils.logDataTypesToBitMask(types)
- assertEquals(0b11011000, mask)
- }
-
- @Test(expected = InvalidFormatStringException::class)
- fun logDataTypesToBitMask_toManyParams() {
- val types = mutableListOf<CodeUtils.LogDataTypes>()
- for (i in 0..16) {
- types.add(CodeUtils.LogDataTypes.STRING)
- }
- CodeUtils.logDataTypesToBitMask(types)
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/CommandOptionsTest.kt b/tools/protologtool/tests/com/android/protologtool/CommandOptionsTest.kt
deleted file mode 100644
index c1cd473..0000000
--- a/tools/protologtool/tests/com/android/protologtool/CommandOptionsTest.kt
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import org.junit.Assert.assertEquals
-import org.junit.Test
-
-class CommandOptionsTest {
- companion object {
- val TEST_JAVA_SRC = listOf(
- "frameworks/base/services/core/java/com/android/server/wm/" +
- "AccessibilityController.java",
- "frameworks/base/services/core/java/com/android/server/wm/ActivityDisplay.java",
- "frameworks/base/services/core/java/com/android/server/wm/" +
- "ActivityMetricsLaunchObserver.java"
- )
- private const val TEST_PROTOLOG_CLASS = "com.android.server.wm.ProtoLog"
- private const val TEST_PROTOLOGIMPL_CLASS = "com.android.server.wm.ProtoLogImpl"
- private const val TEST_PROTOLOGGROUP_CLASS = "com.android.server.wm.ProtoLogGroup"
- private const val TEST_PROTOLOGGROUP_JAR = "out/soong/.intermediates/frameworks/base/" +
- "services/core/services.core.wm.protologgroups/android_common/javac/" +
- "services.core.wm.protologgroups.jar"
- private const val TEST_SRC_JAR = "out/soong/.temp/sbox175955373/" +
- "services.core.wm.protolog.srcjar"
- private const val TEST_VIEWER_JSON = "out/soong/.temp/sbox175955373/" +
- "services.core.wm.protolog.json"
- private const val TEST_LOG = "./test_log.pb"
- }
-
- @Test(expected = InvalidCommandException::class)
- fun noCommand() {
- CommandOptions(arrayOf())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun invalidCommand() {
- val testLine = "invalid"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test
- fun transformClasses() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- val cmd = CommandOptions(testLine.split(' ').toTypedArray())
- assertEquals(CommandOptions.TRANSFORM_CALLS_CMD, cmd.command)
- assertEquals(TEST_PROTOLOG_CLASS, cmd.protoLogClassNameArg)
- assertEquals(TEST_PROTOLOGIMPL_CLASS, cmd.protoLogImplClassNameArg)
- assertEquals(TEST_PROTOLOGGROUP_CLASS, cmd.protoLogGroupsClassNameArg)
- assertEquals(TEST_PROTOLOGGROUP_JAR, cmd.protoLogGroupsJarArg)
- assertEquals(TEST_SRC_JAR, cmd.outputSourceJarArg)
- assertEquals(TEST_JAVA_SRC, cmd.javaSourceArgs)
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noProtoLogClass() {
- val testLine = "transform-protolog-calls " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noProtoLogImplClass() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noProtoLogGroupClass() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noProtoLogGroupJar() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noOutJar() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- TEST_JAVA_SRC.joinToString(" ")
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noJavaInput() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidProtoLogClass() {
- val testLine = "transform-protolog-calls --protolog-class invalid " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidProtoLogImplClass() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class invalid " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidProtoLogGroupClass() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class invalid " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidProtoLogGroupJar() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar invalid.txt " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidOutJar() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar invalid.db ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_invalidJavaInput() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR invalid.py"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_unknownParam() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--unknown test --protolog-impl-class $TEST_PROTOLOGIMPL_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun transformClasses_noValue() {
- val testLine = "transform-protolog-calls --protolog-class $TEST_PROTOLOG_CLASS " +
- "--protolog-impl-class " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--output-srcjar $TEST_SRC_JAR ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test
- fun generateConfig() {
- val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--viewer-conf $TEST_VIEWER_JSON ${TEST_JAVA_SRC.joinToString(" ")}"
- val cmd = CommandOptions(testLine.split(' ').toTypedArray())
- assertEquals(CommandOptions.GENERATE_CONFIG_CMD, cmd.command)
- assertEquals(TEST_PROTOLOG_CLASS, cmd.protoLogClassNameArg)
- assertEquals(TEST_PROTOLOGGROUP_CLASS, cmd.protoLogGroupsClassNameArg)
- assertEquals(TEST_PROTOLOGGROUP_JAR, cmd.protoLogGroupsJarArg)
- assertEquals(TEST_VIEWER_JSON, cmd.viewerConfigJsonArg)
- assertEquals(TEST_JAVA_SRC, cmd.javaSourceArgs)
- }
-
- @Test(expected = InvalidCommandException::class)
- fun generateConfig_noViewerConfig() {
- val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- TEST_JAVA_SRC.joinToString(" ")
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test(expected = InvalidCommandException::class)
- fun generateConfig_invalidViewerConfig() {
- val testLine = "generate-viewer-config --protolog-class $TEST_PROTOLOG_CLASS " +
- "--loggroups-class $TEST_PROTOLOGGROUP_CLASS " +
- "--loggroups-jar $TEST_PROTOLOGGROUP_JAR " +
- "--viewer-conf invalid.yaml ${TEST_JAVA_SRC.joinToString(" ")}"
- CommandOptions(testLine.split(' ').toTypedArray())
- }
-
- @Test
- fun readLog() {
- val testLine = "read-log --viewer-conf $TEST_VIEWER_JSON $TEST_LOG"
- val cmd = CommandOptions(testLine.split(' ').toTypedArray())
- assertEquals(CommandOptions.READ_LOG_CMD, cmd.command)
- assertEquals(TEST_VIEWER_JSON, cmd.viewerConfigJsonArg)
- assertEquals(TEST_LOG, cmd.logProtofileArg)
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/LogParserTest.kt b/tools/protologtool/tests/com/android/protologtool/LogParserTest.kt
deleted file mode 100644
index 7106ea6..0000000
--- a/tools/protologtool/tests/com/android/protologtool/LogParserTest.kt
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonReader
-import com.android.server.wm.ProtoLogMessage
-import com.android.server.wm.WindowManagerLogFileProto
-import org.junit.Assert.assertEquals
-import org.junit.Before
-import org.junit.Test
-import org.mockito.Mockito
-import org.mockito.Mockito.mock
-import java.io.ByteArrayOutputStream
-import java.io.InputStream
-import java.io.OutputStream
-import java.io.PrintStream
-import java.text.SimpleDateFormat
-import java.util.Date
-import java.util.Locale
-
-class LogParserTest {
- private val configParser: ViewerConfigParser = mock(ViewerConfigParser::class.java)
- private val parser = LogParser(configParser)
- private var config: MutableMap<Int, ViewerConfigParser.ConfigEntry> = mutableMapOf()
- private var outStream: OutputStream = ByteArrayOutputStream()
- private var printStream: PrintStream = PrintStream(outStream)
- private val dateFormat = SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.US)
-
- @Before
- fun init() {
- Mockito.`when`(configParser.parseConfig(any(JsonReader::class.java))).thenReturn(config)
- }
-
- private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
-
- private fun getConfigDummyStream(): InputStream {
- return "".byteInputStream()
- }
-
- private fun buildProtoInput(logBuilder: WindowManagerLogFileProto.Builder): InputStream {
- logBuilder.setVersion(Constants.VERSION)
- logBuilder.magicNumber =
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
- return logBuilder.build().toByteArray().inputStream()
- }
-
- private fun testDate(timeMS: Long): String {
- return dateFormat.format(Date(timeMS))
- }
-
- @Test
- fun parse() {
- config[70933285] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b",
- "ERROR", "WindowManager")
-
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- val logMessageBuilder = ProtoLogMessage.newBuilder()
- logMessageBuilder
- .setMessageHash(70933285)
- .setElapsedRealtimeNanos(0)
- .addBooleanParams(true)
- logBuilder.addLog(logMessageBuilder.build())
-
- parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
-
- assertEquals("${testDate(0)} ERROR WindowManager: Test completed successfully: true\n",
- outStream.toString())
- }
-
- @Test
- fun parse_formatting() {
- config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o" +
- " %x %e %g %s %f", "ERROR", "WindowManager")
-
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- val logMessageBuilder = ProtoLogMessage.newBuilder()
- logMessageBuilder
- .setMessageHash(123)
- .setElapsedRealtimeNanos(0)
- .addBooleanParams(true)
- .addAllSint64Params(listOf(1000, 20000, 300000))
- .addAllDoubleParams(listOf(0.1, 0.00001, 1000.1))
- .addStrParams("test")
- logBuilder.addLog(logMessageBuilder.build())
-
- parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
-
- assertEquals("${testDate(0)} ERROR WindowManager: Test completed successfully: " +
- "true 1000 % 47040 493e0 1.000000e-01 1.00000e-05 test 1000.100000\n",
- outStream.toString())
- }
-
- @Test
- fun parse_invalidParamsTooMany() {
- config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o",
- "ERROR", "WindowManager")
-
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- val logMessageBuilder = ProtoLogMessage.newBuilder()
- logMessageBuilder
- .setMessageHash(123)
- .setElapsedRealtimeNanos(0)
- .addBooleanParams(true)
- .addAllSint64Params(listOf(1000, 20000, 300000))
- .addAllDoubleParams(listOf(0.1, 0.00001, 1000.1))
- .addStrParams("test")
- logBuilder.addLog(logMessageBuilder.build())
-
- parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
-
- assertEquals("${testDate(0)} INVALID: 123 - [test] [1000, 20000, 300000] " +
- "[0.1, 1.0E-5, 1000.1] [true]\n", outStream.toString())
- }
-
- @Test
- fun parse_invalidParamsNotEnough() {
- config[123] = ViewerConfigParser.ConfigEntry("Test completed successfully: %b %d %% %o" +
- " %x %e %g %s %f", "ERROR", "WindowManager")
-
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- val logMessageBuilder = ProtoLogMessage.newBuilder()
- logMessageBuilder
- .setMessageHash(123)
- .setElapsedRealtimeNanos(0)
- .addBooleanParams(true)
- .addStrParams("test")
- logBuilder.addLog(logMessageBuilder.build())
-
- parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
-
- assertEquals("${testDate(0)} INVALID: 123 - [test] [] [] [true]\n",
- outStream.toString())
- }
-
- @Test(expected = InvalidInputException::class)
- fun parse_invalidMagicNumber() {
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- logBuilder.setVersion(Constants.VERSION)
- logBuilder.magicNumber = 0
- val stream = logBuilder.build().toByteArray().inputStream()
-
- parser.parse(stream, getConfigDummyStream(), printStream)
- }
-
- @Test(expected = InvalidInputException::class)
- fun parse_invalidVersion() {
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- logBuilder.setVersion("invalid")
- logBuilder.magicNumber =
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_H.number.toLong() shl 32 or
- WindowManagerLogFileProto.MagicNumber.MAGIC_NUMBER_L.number.toLong()
- val stream = logBuilder.build().toByteArray().inputStream()
-
- parser.parse(stream, getConfigDummyStream(), printStream)
- }
-
- @Test
- fun parse_noConfig() {
- val logBuilder = WindowManagerLogFileProto.newBuilder()
- val logMessageBuilder = ProtoLogMessage.newBuilder()
- logMessageBuilder
- .setMessageHash(70933285)
- .setElapsedRealtimeNanos(0)
- .addBooleanParams(true)
- logBuilder.addLog(logMessageBuilder.build())
-
- parser.parse(buildProtoInput(logBuilder), getConfigDummyStream(), printStream)
-
- assertEquals("${testDate(0)} UNKNOWN: 70933285 - [] [] [] [true]\n",
- outStream.toString())
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/ProtoLogCallProcessorTest.kt b/tools/protologtool/tests/com/android/protologtool/ProtoLogCallProcessorTest.kt
deleted file mode 100644
index dcb1f7f..0000000
--- a/tools/protologtool/tests/com/android/protologtool/ProtoLogCallProcessorTest.kt
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.StaticJavaParser
-import com.github.javaparser.ast.expr.MethodCallExpr
-import org.junit.Assert.assertEquals
-import org.junit.Test
-
-class ProtoLogCallProcessorTest {
- private data class LogCall(
- val call: MethodCallExpr,
- val messageString: String,
- val level: LogLevel,
- val group: LogGroup
- )
-
- private val groupMap: MutableMap<String, LogGroup> = mutableMapOf()
- private val calls: MutableList<LogCall> = mutableListOf()
- private val visitor = ProtoLogCallProcessor("org.example.ProtoLog", "org.example.ProtoLogGroup",
- groupMap)
- private val processor = object : ProtoLogCallVisitor {
- override fun processCall(
- call: MethodCallExpr,
- messageString: String,
- level: LogLevel,
- group: LogGroup
- ) {
- calls.add(LogCall(call, messageString, level, group))
- }
- }
-
- private fun checkCalls() {
- assertEquals(1, calls.size)
- val c = calls[0]
- assertEquals("test %b", c.messageString)
- assertEquals(groupMap["TEST"], c.group)
- assertEquals(LogLevel.DEBUG, c.level)
- }
-
- @Test
- fun process_samePackage() {
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- ProtoLog.e(ProtoLogGroup.ERROR, "error %d", 1);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", true, false, "WindowManager")
- groupMap["ERROR"] = LogGroup("ERROR", true, true, "WindowManagerERROR")
- visitor.process(StaticJavaParser.parse(code), processor)
- assertEquals(2, calls.size)
- var c = calls[0]
- assertEquals("test %b", c.messageString)
- assertEquals(groupMap["TEST"], c.group)
- assertEquals(LogLevel.DEBUG, c.level)
- c = calls[1]
- assertEquals("error %d", c.messageString)
- assertEquals(groupMap["ERROR"], c.group)
- assertEquals(LogLevel.ERROR, c.level)
- }
-
- @Test
- fun process_imported() {
- val code = """
- package org.example2;
-
- import org.example.ProtoLog;
- import org.example.ProtoLogGroup;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
- visitor.process(StaticJavaParser.parse(code), processor)
- checkCalls()
- }
-
- @Test
- fun process_importedStatic() {
- val code = """
- package org.example2;
-
- import static org.example.ProtoLog.d;
- import static org.example.ProtoLogGroup.TEST;
-
- class Test {
- void test() {
- d(TEST, "test %b", true);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
- visitor.process(StaticJavaParser.parse(code), processor)
- checkCalls()
- }
-
- @Test(expected = InvalidProtoLogCallException::class)
- fun process_groupNotImported() {
- val code = """
- package org.example2;
-
- import org.example.ProtoLog;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
- visitor.process(StaticJavaParser.parse(code), processor)
- }
-
- @Test
- fun process_protoLogNotImported() {
- val code = """
- package org.example2;
-
- import org.example.ProtoLogGroup;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", true, true, "WindowManager")
- visitor.process(StaticJavaParser.parse(code), processor)
- assertEquals(0, calls.size)
- }
-
- @Test(expected = InvalidProtoLogCallException::class)
- fun process_unknownGroup() {
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- }
- }
- """
- visitor.process(StaticJavaParser.parse(code), processor)
- }
-
- @Test(expected = InvalidProtoLogCallException::class)
- fun process_staticGroup() {
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d(TEST, "test %b", true);
- }
- }
- """
- visitor.process(StaticJavaParser.parse(code), processor)
- }
-
- @Test(expected = InvalidProtoLogCallException::class)
- fun process_badGroup() {
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d(0, "test %b", true);
- }
- }
- """
- visitor.process(StaticJavaParser.parse(code), processor)
- }
-
- @Test(expected = InvalidProtoLogCallException::class)
- fun process_invalidSignature() {
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d("test");
- }
- }
- """
- visitor.process(StaticJavaParser.parse(code), processor)
- }
-
- @Test
- fun process_disabled() {
- // Disabled groups are also processed.
- val code = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.d(ProtoLogGroup.TEST, "test %b", true);
- }
- }
- """
- groupMap["TEST"] = LogGroup("TEST", false, true, "WindowManager")
- visitor.process(StaticJavaParser.parse(code), processor)
- checkCalls()
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/SourceTransformerTest.kt b/tools/protologtool/tests/com/android/protologtool/SourceTransformerTest.kt
deleted file mode 100644
index 2cd8562..0000000
--- a/tools/protologtool/tests/com/android/protologtool/SourceTransformerTest.kt
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.github.javaparser.StaticJavaParser
-import com.github.javaparser.ast.CompilationUnit
-import com.github.javaparser.ast.expr.MethodCallExpr
-import com.github.javaparser.ast.stmt.IfStmt
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertFalse
-import org.junit.Test
-import org.mockito.Mockito
-
-class SourceTransformerTest {
- companion object {
- private const val PROTO_LOG_IMPL_PATH = "org.example.ProtoLogImpl"
-
- /* ktlint-disable max-line-length */
- private val TEST_CODE = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
- }
- }
- """.trimIndent()
-
- private val TEST_CODE_MULTILINE = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.w(TEST_GROUP, "test %d %f " +
- "abc %s\n test", 100,
- 0.1, "test");
- }
- }
- """.trimIndent()
-
- private val TEST_CODE_MULTICALLS = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); /* ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); */ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
- ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1);
- }
- }
- """.trimIndent()
-
- private val TEST_CODE_NO_PARAMS = """
- package org.example;
-
- class Test {
- void test() {
- ProtoLog.w(TEST_GROUP, "test");
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_TEXT_ENABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_MULTILINE_TEXT_ENABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; String protoLogParam2 = String.valueOf("test"); org.example.ProtoLogImpl.w(TEST_GROUP, -986393606, 9, "test %d %f " + "abc %s\n test", protoLogParam0, protoLogParam1, protoLogParam2);
-
- }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_MULTICALL_TEXT_ENABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); } /* ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); */ if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, "test %d %f", protoLogParam0, protoLogParam1); }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_NO_PARAMS = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { org.example.ProtoLogImpl.w(TEST_GROUP, 1282022424, 0, "test", (Object[]) null); }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_TEXT_DISABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; org.example.ProtoLogImpl.w(TEST_GROUP, 835524026, 9, null, protoLogParam0, protoLogParam1); }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_MULTILINE_TEXT_DISABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (TEST_GROUP.isLogToAny()) { long protoLogParam0 = 100; double protoLogParam1 = 0.1; String protoLogParam2 = String.valueOf("test"); org.example.ProtoLogImpl.w(TEST_GROUP, -986393606, 9, null, protoLogParam0, protoLogParam1, protoLogParam2);
-
- }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_DISABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (false) { /* TEST_GROUP is disabled */ ProtoLog.w(TEST_GROUP, "test %d %f", 100, 0.1); }
- }
- }
- """.trimIndent()
-
- private val TRANSFORMED_CODE_MULTILINE_DISABLED = """
- package org.example;
-
- class Test {
- void test() {
- if (false) { /* TEST_GROUP is disabled */ ProtoLog.w(TEST_GROUP, "test %d %f " + "abc %s\n test", 100, 0.1, "test");
-
- }
- }
- }
- """.trimIndent()
- /* ktlint-enable max-line-length */
- }
-
- private val processor: ProtoLogCallProcessor = Mockito.mock(ProtoLogCallProcessor::class.java)
- private val sourceJarWriter = SourceTransformer("org.example.ProtoLogImpl", processor)
-
- private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
-
- @Test
- fun processClass_textEnabled() {
- var code = StaticJavaParser.parse(TEST_CODE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(3, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(6, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("835524026", methodCall.arguments[1].toString())
- assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
- assertEquals("\"test %d %f\"", methodCall.arguments[3].toString())
- assertEquals("protoLogParam0", methodCall.arguments[4].toString())
- assertEquals("protoLogParam1", methodCall.arguments[5].toString())
- assertEquals(TRANSFORMED_CODE_TEXT_ENABLED, out)
- }
-
- @Test
- fun processClass_textEnabledMulticalls() {
- var code = StaticJavaParser.parse(TEST_CODE_MULTICALLS)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- val calls = code.findAll(MethodCallExpr::class.java)
- visitor.processCall(calls[0], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
- visitor.processCall(calls[1], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
- visitor.processCall(calls[2], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE_MULTICALLS, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(3, ifStmts.size)
- val ifStmt = ifStmts[1]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(3, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(6, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("835524026", methodCall.arguments[1].toString())
- assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
- assertEquals("\"test %d %f\"", methodCall.arguments[3].toString())
- assertEquals("protoLogParam0", methodCall.arguments[4].toString())
- assertEquals("protoLogParam1", methodCall.arguments[5].toString())
- assertEquals(TRANSFORMED_CODE_MULTICALL_TEXT_ENABLED, out)
- }
-
- @Test
- fun processClass_textEnabledMultiline() {
- var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
- "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
- true, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(4, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[1] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(7, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("-986393606", methodCall.arguments[1].toString())
- assertEquals(0b001001.toString(), methodCall.arguments[2].toString())
- assertEquals("protoLogParam0", methodCall.arguments[4].toString())
- assertEquals("protoLogParam1", methodCall.arguments[5].toString())
- assertEquals("protoLogParam2", methodCall.arguments[6].toString())
- assertEquals(TRANSFORMED_CODE_MULTILINE_TEXT_ENABLED, out)
- }
-
- @Test
- fun processClass_noParams() {
- var code = StaticJavaParser.parse(TEST_CODE_NO_PARAMS)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE_NO_PARAMS, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(1, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(5, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("1282022424", methodCall.arguments[1].toString())
- assertEquals(0.toString(), methodCall.arguments[2].toString())
- assertEquals(TRANSFORMED_CODE_NO_PARAMS, out)
- }
-
- @Test
- fun processClass_textDisabled() {
- var code = StaticJavaParser.parse(TEST_CODE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", true, false, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(3, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[0] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(6, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("835524026", methodCall.arguments[1].toString())
- assertEquals(0b1001.toString(), methodCall.arguments[2].toString())
- assertEquals("null", methodCall.arguments[3].toString())
- assertEquals("protoLogParam0", methodCall.arguments[4].toString())
- assertEquals("protoLogParam1", methodCall.arguments[5].toString())
- assertEquals(TRANSFORMED_CODE_TEXT_DISABLED, out)
- }
-
- @Test
- fun processClass_textDisabledMultiline() {
- var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
- "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
- true, false, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("TEST_GROUP.${Constants.IS_LOG_TO_ANY_METHOD}()",
- ifStmt.condition.toString())
- assertFalse(ifStmt.elseStmt.isPresent)
- assertEquals(4, ifStmt.thenStmt.childNodes.size)
- val methodCall = ifStmt.thenStmt.findAll(MethodCallExpr::class.java)[1] as MethodCallExpr
- assertEquals(PROTO_LOG_IMPL_PATH, methodCall.scope.get().toString())
- assertEquals("w", methodCall.name.asString())
- assertEquals(7, methodCall.arguments.size)
- assertEquals("TEST_GROUP", methodCall.arguments[0].toString())
- assertEquals("-986393606", methodCall.arguments[1].toString())
- assertEquals(0b001001.toString(), methodCall.arguments[2].toString())
- assertEquals("null", methodCall.arguments[3].toString())
- assertEquals("protoLogParam0", methodCall.arguments[4].toString())
- assertEquals("protoLogParam1", methodCall.arguments[5].toString())
- assertEquals("protoLogParam2", methodCall.arguments[6].toString())
- assertEquals(TRANSFORMED_CODE_MULTILINE_TEXT_DISABLED, out)
- }
-
- @Test
- fun processClass_disabled() {
- var code = StaticJavaParser.parse(TEST_CODE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0], "test %d %f",
- LogLevel.WARN, LogGroup("TEST_GROUP", false, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("false", ifStmt.condition.toString())
- assertEquals(TRANSFORMED_CODE_DISABLED, out)
- }
-
- @Test
- fun processClass_disabledMultiline() {
- var code = StaticJavaParser.parse(TEST_CODE_MULTILINE)
-
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(code.findAll(MethodCallExpr::class.java)[0],
- "test %d %f abc %s\n test", LogLevel.WARN, LogGroup("TEST_GROUP",
- false, true, "WM_TEST"))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- val out = sourceJarWriter.processClass(TEST_CODE_MULTILINE, code)
- code = StaticJavaParser.parse(out)
-
- val ifStmts = code.findAll(IfStmt::class.java)
- assertEquals(1, ifStmts.size)
- val ifStmt = ifStmts[0]
- assertEquals("false", ifStmt.condition.toString())
- assertEquals(TRANSFORMED_CODE_MULTILINE_DISABLED, out)
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/ViewerConfigBuilderTest.kt b/tools/protologtool/tests/com/android/protologtool/ViewerConfigBuilderTest.kt
deleted file mode 100644
index 53d2e8b..0000000
--- a/tools/protologtool/tests/com/android/protologtool/ViewerConfigBuilderTest.kt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonReader
-import com.github.javaparser.ast.CompilationUnit
-import com.github.javaparser.ast.expr.MethodCallExpr
-import org.junit.Assert.assertEquals
-import org.junit.Test
-import org.mockito.Mockito
-import java.io.StringReader
-
-class ViewerConfigBuilderTest {
- companion object {
- private val TAG1 = "WM_TEST"
- private val TAG2 = "WM_DEBUG"
- private val TEST1 = ViewerConfigParser.ConfigEntry("test1", LogLevel.INFO.name, TAG1)
- private val TEST2 = ViewerConfigParser.ConfigEntry("test2", LogLevel.DEBUG.name, TAG2)
- private val TEST3 = ViewerConfigParser.ConfigEntry("test3", LogLevel.ERROR.name, TAG2)
- }
-
- private val processor: ProtoLogCallProcessor = Mockito.mock(ProtoLogCallProcessor::class.java)
- private val configBuilder = ViewerConfigBuilder(processor)
- private val dummyCompilationUnit = CompilationUnit()
-
- private fun <T> any(type: Class<T>): T = Mockito.any<T>(type)
-
- private fun parseConfig(json: String): Map<Int, ViewerConfigParser.ConfigEntry> {
- return ViewerConfigParser().parseConfig(JsonReader(StringReader(json)))
- }
-
- @Test
- fun processClass() {
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
- LogGroup("TEST_GROUP", true, true, TAG1))
- visitor.processCall(MethodCallExpr(), TEST2.messageString, LogLevel.DEBUG,
- LogGroup("DEBUG_GROUP", true, true, TAG2))
- visitor.processCall(MethodCallExpr(), TEST3.messageString, LogLevel.ERROR,
- LogGroup("DEBUG_GROUP", true, true, TAG2))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- configBuilder.processClass(dummyCompilationUnit)
-
- val parsedConfig = parseConfig(configBuilder.build())
- assertEquals(3, parsedConfig.size)
- assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString,
- LogLevel.INFO)])
- assertEquals(TEST2, parsedConfig[CodeUtils.hash(TEST2.messageString,
- LogLevel.DEBUG)])
- assertEquals(TEST3, parsedConfig[CodeUtils.hash(TEST3.messageString,
- LogLevel.ERROR)])
- }
-
- @Test
- fun processClass_nonUnique() {
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
- LogGroup("TEST_GROUP", true, true, TAG1))
- visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
- LogGroup("TEST_GROUP", true, true, TAG1))
- visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
- LogGroup("TEST_GROUP", true, true, TAG1))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- configBuilder.processClass(dummyCompilationUnit)
-
- val parsedConfig = parseConfig(configBuilder.build())
- assertEquals(1, parsedConfig.size)
- assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString, LogLevel.INFO)])
- }
-
- @Test
- fun processClass_disabled() {
- Mockito.`when`(processor.process(any(CompilationUnit::class.java),
- any(ProtoLogCallVisitor::class.java))).thenAnswer { invocation ->
- val visitor = invocation.arguments[1] as ProtoLogCallVisitor
-
- visitor.processCall(MethodCallExpr(), TEST1.messageString, LogLevel.INFO,
- LogGroup("TEST_GROUP", true, true, TAG1))
- visitor.processCall(MethodCallExpr(), TEST2.messageString, LogLevel.DEBUG,
- LogGroup("DEBUG_GROUP", false, true, TAG2))
- visitor.processCall(MethodCallExpr(), TEST3.messageString, LogLevel.ERROR,
- LogGroup("DEBUG_GROUP", true, false, TAG2))
-
- invocation.arguments[0] as CompilationUnit
- }
-
- configBuilder.processClass(dummyCompilationUnit)
-
- val parsedConfig = parseConfig(configBuilder.build())
- assertEquals(2, parsedConfig.size)
- assertEquals(TEST1, parsedConfig[CodeUtils.hash(TEST1.messageString, LogLevel.INFO)])
- assertEquals(TEST3, parsedConfig[CodeUtils.hash(TEST3.messageString, LogLevel.ERROR)])
- }
-}
diff --git a/tools/protologtool/tests/com/android/protologtool/ViewerConfigParserTest.kt b/tools/protologtool/tests/com/android/protologtool/ViewerConfigParserTest.kt
deleted file mode 100644
index c0cea73..0000000
--- a/tools/protologtool/tests/com/android/protologtool/ViewerConfigParserTest.kt
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright (C) 2019 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.protologtool
-
-import com.android.json.stream.JsonReader
-import org.junit.Test
-import java.io.StringReader
-import org.junit.Assert.assertEquals
-
-class ViewerConfigParserTest {
- private val parser = ViewerConfigParser()
-
- private fun getJSONReader(str: String): JsonReader {
- return JsonReader(StringReader(str))
- }
-
- @Test
- fun parseMessage() {
- val json = """
- {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- """
- val msg = parser.parseMessage(getJSONReader(json))
- assertEquals("Test completed successfully: %b", msg.messageString)
- assertEquals("ERROR", msg.level)
- assertEquals("GENERIC_WM", msg.groupName)
- }
-
- @Test
- fun parseMessage_reorder() {
- val json = """
- {
- "group": "GENERIC_WM",
- "level": "ERROR",
- "message": "Test completed successfully: %b"
- }
- """
- val msg = parser.parseMessage(getJSONReader(json))
- assertEquals("Test completed successfully: %b", msg.messageString)
- assertEquals("ERROR", msg.level)
- assertEquals("GENERIC_WM", msg.groupName)
- }
-
- @Test
- fun parseMessage_unknownEntry() {
- val json = """
- {
- "unknown": "unknown entries should not block parsing",
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- """
- val msg = parser.parseMessage(getJSONReader(json))
- assertEquals("Test completed successfully: %b", msg.messageString)
- assertEquals("ERROR", msg.level)
- assertEquals("GENERIC_WM", msg.groupName)
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseMessage_noMessage() {
- val json = """
- {
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- """
- parser.parseMessage(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseMessage_noLevel() {
- val json = """
- {
- "message": "Test completed successfully: %b",
- "group": "GENERIC_WM"
- }
- """
- parser.parseMessage(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseMessage_noGroup() {
- val json = """
- {
- "message": "Test completed successfully: %b",
- "level": "ERROR"
- }
- """
- parser.parseMessage(getJSONReader(json))
- }
-
- @Test
- fun parseGroup() {
- val json = """
- {
- "tag": "WindowManager"
- }
- """
- val group = parser.parseGroup(getJSONReader(json))
- assertEquals("WindowManager", group.tag)
- }
-
- @Test
- fun parseGroup_unknownEntry() {
- val json = """
- {
- "unknown": "unknown entries should not block parsing",
- "tag": "WindowManager"
- }
- """
- val group = parser.parseGroup(getJSONReader(json))
- assertEquals("WindowManager", group.tag)
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseGroup_noTag() {
- val json = """
- {
- }
- """
- parser.parseGroup(getJSONReader(json))
- }
-
- @Test
- fun parseMessages() {
- val json = """
- {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- },
- "1792430067": {
- "message": "Attempted to add window to a display that does not exist: %d. Aborting.",
- "level": "WARN",
- "group": "ERROR_WM"
- }
- }
- """
- val messages = parser.parseMessages(getJSONReader(json))
- assertEquals(2, messages.size)
- val msg1 =
- ViewerConfigParser.MessageEntry("Test completed successfully: %b",
- "ERROR", "GENERIC_WM")
- val msg2 =
- ViewerConfigParser.MessageEntry("Attempted to add window to a display that " +
- "does not exist: %d. Aborting.", "WARN", "ERROR_WM")
-
- assertEquals(msg1, messages[70933285])
- assertEquals(msg2, messages[1792430067])
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseMessages_invalidHash() {
- val json = """
- {
- "invalid": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- }
- """
- parser.parseMessages(getJSONReader(json))
- }
-
- @Test
- fun parseGroups() {
- val json = """
- {
- "GENERIC_WM": {
- "tag": "WindowManager"
- },
- "ERROR_WM": {
- "tag": "WindowManagerError"
- }
- }
- """
- val groups = parser.parseGroups(getJSONReader(json))
- assertEquals(2, groups.size)
- val grp1 = ViewerConfigParser.GroupEntry("WindowManager")
- val grp2 = ViewerConfigParser.GroupEntry("WindowManagerError")
- assertEquals(grp1, groups["GENERIC_WM"])
- assertEquals(grp2, groups["ERROR_WM"])
- }
-
- @Test
- fun parseConfig() {
- val json = """
- {
- "version": "${Constants.VERSION}",
- "messages": {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- },
- "groups": {
- "GENERIC_WM": {
- "tag": "WindowManager"
- }
- }
- }
- """
- val config = parser.parseConfig(getJSONReader(json))
- assertEquals(1, config.size)
- val cfg1 = ViewerConfigParser.ConfigEntry("Test completed successfully: %b",
- "ERROR", "WindowManager")
- assertEquals(cfg1, config[70933285])
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseConfig_invalidVersion() {
- val json = """
- {
- "version": "invalid",
- "messages": {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- },
- "groups": {
- "GENERIC_WM": {
- "tag": "WindowManager"
- }
- }
- }
- """
- parser.parseConfig(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseConfig_noVersion() {
- val json = """
- {
- "messages": {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- },
- "groups": {
- "GENERIC_WM": {
- "tag": "WindowManager"
- }
- }
- }
- """
- parser.parseConfig(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseConfig_noMessages() {
- val json = """
- {
- "version": "${Constants.VERSION}",
- "groups": {
- "GENERIC_WM": {
- "tag": "WindowManager"
- }
- }
- }
- """
- parser.parseConfig(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseConfig_noGroups() {
- val json = """
- {
- "version": "${Constants.VERSION}",
- "messages": {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- }
- }
- """
- parser.parseConfig(getJSONReader(json))
- }
-
- @Test(expected = InvalidViewerConfigException::class)
- fun parseConfig_missingGroup() {
- val json = """
- {
- "version": "${Constants.VERSION}",
- "messages": {
- "70933285": {
- "message": "Test completed successfully: %b",
- "level": "ERROR",
- "group": "GENERIC_WM"
- }
- },
- "groups": {
- "ERROR_WM": {
- "tag": "WindowManager"
- }
- }
- }
- """
- val config = parser.parseConfig(getJSONReader(json))
- }
-}
diff --git a/wifi/java/android/net/wifi/IActionListener.aidl b/wifi/java/android/net/wifi/IActionListener.aidl
new file mode 100644
index 0000000..faa0901
--- /dev/null
+++ b/wifi/java/android/net/wifi/IActionListener.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 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 android.net.wifi;
+
+/**
+ * Interface for generic wifi callbacks.
+ * @hide
+ */
+oneway interface IActionListener
+{
+ void onSuccess();
+ void onFailure(int reason);
+}
diff --git a/wifi/java/android/net/wifi/ITxPacketCountListener.aidl b/wifi/java/android/net/wifi/ITxPacketCountListener.aidl
new file mode 100644
index 0000000..8606ab5
--- /dev/null
+++ b/wifi/java/android/net/wifi/ITxPacketCountListener.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 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 android.net.wifi;
+
+/**
+ * Interface for tx packet counter callback.
+ * @hide
+ */
+oneway interface ITxPacketCountListener
+{
+ void onSuccess(int count);
+ void onFailure(int reason);
+}
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 931e5dd..a97a5a5 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -24,10 +24,12 @@
import android.net.DhcpInfo;
import android.net.Network;
+import android.net.wifi.IActionListener;
import android.net.wifi.IDppCallback;
import android.net.wifi.INetworkRequestMatchCallback;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ITrafficStateCallback;
+import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiActivityEnergyInfo;
@@ -106,8 +108,6 @@
int getWifiEnabledState();
- void setCountryCode(String country);
-
String getCountryCode();
boolean isDualBandSupported();
@@ -156,8 +156,6 @@
void notifyUserOfApBandConversion(String packageName);
- Messenger getWifiServiceMessenger(String packageName);
-
void enableTdls(String remoteIPAddress, boolean enable);
void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable);
@@ -220,4 +218,12 @@
void stopDppSession();
void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec);
+
+ oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
+
+ oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier);
+
+ oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
+
+ oneway void getTxPacketCount(String packageName, in IBinder binder, in ITxPacketCountListener listener, int callbackIdentifier);
}
diff --git a/wifi/java/android/net/wifi/RssiPacketCountInfo.java b/wifi/java/android/net/wifi/RssiPacketCountInfo.java
deleted file mode 100644
index 4301165..0000000
--- a/wifi/java/android/net/wifi/RssiPacketCountInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 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 android.net.wifi;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * Bundle of RSSI and packet count information, for WiFi watchdog
- *
- * @see WifiWatchdogStateMachine
- *
- * @hide
- */
-public class RssiPacketCountInfo implements Parcelable {
-
- public int rssi;
-
- public int txgood;
-
- public int txbad;
-
- public int rxgood;
-
- public RssiPacketCountInfo() {
- rssi = txgood = txbad = rxgood = 0;
- }
-
- private RssiPacketCountInfo(Parcel in) {
- rssi = in.readInt();
- txgood = in.readInt();
- txbad = in.readInt();
- rxgood = in.readInt();
- }
-
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeInt(rssi);
- out.writeInt(txgood);
- out.writeInt(txbad);
- out.writeInt(rxgood);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- public static final @android.annotation.NonNull Parcelable.Creator<RssiPacketCountInfo> CREATOR =
- new Parcelable.Creator<RssiPacketCountInfo>() {
- @Override
- public RssiPacketCountInfo createFromParcel(Parcel in) {
- return new RssiPacketCountInfo(in);
- }
-
- @Override
- public RssiPacketCountInfo[] newArray(int size) {
- return new RssiPacketCountInfo[size];
- }
- };
-}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 0fa0ec7..00895e8 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -55,13 +55,10 @@
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
-import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
-import com.android.internal.util.AsyncChannel;
-import com.android.internal.util.Protocol;
import com.android.server.net.NetworkPinner;
import dalvik.system.CloseGuard;
@@ -75,7 +72,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
/**
@@ -1128,13 +1124,6 @@
IWifiManager mService;
private final int mTargetSdkVersion;
- private static final int INVALID_KEY = 0;
- private int mListenerKey = 1;
- private final SparseArray mListenerMap = new SparseArray();
- private final Object mListenerMapLock = new Object();
-
- private AsyncChannel mAsyncChannel;
- private CountDownLatch mConnected;
private Looper mLooper;
private boolean mVerboseLoggingEnabled = false;
@@ -2501,25 +2490,6 @@
}
/**
- * Set the country code.
- * @param countryCode country code in ISO 3166 format.
- *
- * @hide
- */
- public void setCountryCode(@NonNull String country) {
- try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (TextUtils.isEmpty(country)) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.setCountryCode(country);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
* get the country code.
* @return the country code in ISO 3166 format.
*
@@ -2644,8 +2614,23 @@
*
* @hide for CTS test only
*/
- public void getTxPacketCount(TxPacketCountListener listener) {
- getChannel().sendMessage(RSSI_PKTCNT_FETCH, 0, putListener(listener));
+ public void getTxPacketCount(@NonNull TxPacketCountListener listener) {
+ if (listener == null) throw new IllegalArgumentException("listener cannot be null");
+ Binder binder = new Binder();
+ TxPacketCountListenerProxy listenerProxy =
+ new TxPacketCountListenerProxy(mLooper, listener);
+ try {
+ IWifiManager iWifiManager = getIWifiManager();
+ if (iWifiManager == null) {
+ throw new RemoteException("Wifi service is not running");
+ }
+ iWifiManager.getTxPacketCount(mContext.getOpPackageName(), binder, listenerProxy,
+ listener.hashCode());
+ } catch (RemoteException e) {
+ listenerProxy.onFailure(ERROR);
+ } catch (SecurityException e) {
+ listenerProxy.onFailure(NOT_AUTHORIZED);
+ }
}
/**
@@ -3080,76 +3065,6 @@
}
}
- /* TODO: deprecate synchronous API and open up the following API */
-
- private static final int BASE = Protocol.BASE_WIFI_MANAGER;
-
- /* Commands to WifiService */
- /** @hide */
- public static final int CONNECT_NETWORK = BASE + 1;
- /** @hide */
- public static final int CONNECT_NETWORK_FAILED = BASE + 2;
- /** @hide */
- public static final int CONNECT_NETWORK_SUCCEEDED = BASE + 3;
-
- /** @hide */
- public static final int FORGET_NETWORK = BASE + 4;
- /** @hide */
- public static final int FORGET_NETWORK_FAILED = BASE + 5;
- /** @hide */
- public static final int FORGET_NETWORK_SUCCEEDED = BASE + 6;
-
- /** @hide */
- public static final int SAVE_NETWORK = BASE + 7;
- /** @hide */
- public static final int SAVE_NETWORK_FAILED = BASE + 8;
- /** @hide */
- public static final int SAVE_NETWORK_SUCCEEDED = BASE + 9;
-
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int START_WPS = BASE + 10;
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int START_WPS_SUCCEEDED = BASE + 11;
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int WPS_FAILED = BASE + 12;
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int WPS_COMPLETED = BASE + 13;
-
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int CANCEL_WPS = BASE + 14;
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int CANCEL_WPS_FAILED = BASE + 15;
- /** @hide
- * @deprecated This is deprecated
- */
- public static final int CANCEL_WPS_SUCCEDED = BASE + 16;
-
- /** @hide */
- public static final int DISABLE_NETWORK = BASE + 17;
- /** @hide */
- public static final int DISABLE_NETWORK_FAILED = BASE + 18;
- /** @hide */
- public static final int DISABLE_NETWORK_SUCCEEDED = BASE + 19;
-
- /** @hide */
- public static final int RSSI_PKTCNT_FETCH = BASE + 20;
- /** @hide */
- public static final int RSSI_PKTCNT_FETCH_SUCCEEDED = BASE + 21;
- /** @hide */
- public static final int RSSI_PKTCNT_FETCH_FAILED = BASE + 22;
-
/**
* Passed with {@link ActionListener#onFailure}.
* Indicates that the operation failed due to an internal error.
@@ -3172,6 +3087,11 @@
*/
public static final int BUSY = 2;
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({ERROR, IN_PROGRESS, BUSY})
+ public @interface ActionListenerFailureReason {}
+
/* WPS specific errors */
/** WPS overlap detected
* @deprecated This is deprecated
@@ -3216,20 +3136,13 @@
public interface ActionListener {
/**
* The operation succeeded.
- * This is called when the scan request has been validated and ready
- * to sent to driver.
*/
- public void onSuccess();
+ void onSuccess();
/**
* The operation failed.
- * This is called when the scan request failed.
- * @param reason The reason for failure could be one of the following:
- * {@link #REASON_INVALID_REQUEST}} is specified when scan request parameters are invalid.
- * {@link #REASON_NOT_AUTHORIZED} is specified when requesting app doesn't have the required
- * permission to request a scan.
- * {@link #REASON_UNSPECIFIED} is specified when driver reports a scan failure.
+ * @param reason The reason for failure depends on the operation.
*/
- public void onFailure(int reason);
+ void onFailure(@ActionListenerFailureReason int reason);
}
/** Interface for callback invocation on a start WPS action
@@ -3274,6 +3187,41 @@
}
/**
+ * Callback proxy for TxPacketCountListener objects.
+ *
+ * @hide
+ */
+ private class TxPacketCountListenerProxy extends ITxPacketCountListener.Stub {
+ private final Handler mHandler;
+ private final TxPacketCountListener mCallback;
+
+ TxPacketCountListenerProxy(Looper looper, TxPacketCountListener callback) {
+ mHandler = new Handler(looper);
+ mCallback = callback;
+ }
+
+ @Override
+ public void onSuccess(int count) {
+ if (mVerboseLoggingEnabled) {
+ Log.v(TAG, "TxPacketCounterProxy: onSuccess: count=" + count);
+ }
+ mHandler.post(() -> {
+ mCallback.onSuccess(count);
+ });
+ }
+
+ @Override
+ public void onFailure(int reason) {
+ if (mVerboseLoggingEnabled) {
+ Log.v(TAG, "TxPacketCounterProxy: onFailure: reason=" + reason);
+ }
+ mHandler.post(() -> {
+ mCallback.onFailure(reason);
+ });
+ }
+ }
+
+ /**
* Base class for soft AP callback. Should be extended by applications and set when calling
* {@link WifiManager#registerSoftApCallback(SoftApCallback, Handler)}.
*
@@ -3707,125 +3655,61 @@
}
}
- // Ensure that multiple ServiceHandler threads do not interleave message dispatch.
- private static final Object sServiceHandlerDispatchLock = new Object();
+ /**
+ * Callback proxy for ActionListener objects.
+ */
+ private class ActionListenerProxy extends IActionListener.Stub {
+ private final String mActionTag;
+ private final Handler mHandler;
+ private final ActionListener mCallback;
- private class ServiceHandler extends Handler {
- ServiceHandler(Looper looper) {
- super(looper);
+ ActionListenerProxy(String actionTag, Looper looper, ActionListener callback) {
+ mActionTag = actionTag;
+ mHandler = new Handler(looper);
+ mCallback = callback;
}
@Override
- public void handleMessage(Message message) {
- synchronized (sServiceHandlerDispatchLock) {
- dispatchMessageToListeners(message);
+ public void onSuccess() {
+ if (mVerboseLoggingEnabled) {
+ Log.v(TAG, "ActionListenerProxy:" + mActionTag + ": onSuccess");
}
+ mHandler.post(() -> {
+ mCallback.onSuccess();
+ });
}
- private void dispatchMessageToListeners(Message message) {
- Object listener = removeListener(message.arg2);
- switch (message.what) {
- case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
- if (message.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
- mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
- } else {
- Log.e(TAG, "Failed to set up channel connection");
- // This will cause all further async API calls on the WifiManager
- // to fail and throw an exception
- mAsyncChannel = null;
- }
- mConnected.countDown();
- break;
- case AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED:
- // Ignore
- break;
- case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
- Log.e(TAG, "Channel connection lost");
- // This will cause all further async API calls on the WifiManager
- // to fail and throw an exception
- mAsyncChannel = null;
- getLooper().quit();
- break;
- /* ActionListeners grouped together */
- case WifiManager.CONNECT_NETWORK_FAILED:
- case WifiManager.FORGET_NETWORK_FAILED:
- case WifiManager.SAVE_NETWORK_FAILED:
- case WifiManager.DISABLE_NETWORK_FAILED:
- if (listener != null) {
- ((ActionListener) listener).onFailure(message.arg1);
- }
- break;
- /* ActionListeners grouped together */
- case WifiManager.CONNECT_NETWORK_SUCCEEDED:
- case WifiManager.FORGET_NETWORK_SUCCEEDED:
- case WifiManager.SAVE_NETWORK_SUCCEEDED:
- case WifiManager.DISABLE_NETWORK_SUCCEEDED:
- if (listener != null) {
- ((ActionListener) listener).onSuccess();
- }
- break;
- case WifiManager.RSSI_PKTCNT_FETCH_SUCCEEDED:
- if (listener != null) {
- RssiPacketCountInfo info = (RssiPacketCountInfo) message.obj;
- if (info != null)
- ((TxPacketCountListener) listener).onSuccess(info.txgood + info.txbad);
- else
- ((TxPacketCountListener) listener).onFailure(ERROR);
- }
- break;
- case WifiManager.RSSI_PKTCNT_FETCH_FAILED:
- if (listener != null) {
- ((TxPacketCountListener) listener).onFailure(message.arg1);
- }
- break;
- default:
- //ignore
- break;
+ @Override
+ public void onFailure(@ActionListenerFailureReason int reason) {
+ if (mVerboseLoggingEnabled) {
+ Log.v(TAG, "ActionListenerProxy:" + mActionTag + ": onFailure=" + reason);
}
+ mHandler.post(() -> {
+ mCallback.onFailure(reason);
+ });
}
}
- private int putListener(Object listener) {
- if (listener == null) return INVALID_KEY;
- int key;
- synchronized (mListenerMapLock) {
- do {
- key = mListenerKey++;
- } while (key == INVALID_KEY);
- mListenerMap.put(key, listener);
+ private void connectInternal(@Nullable WifiConfiguration config, int networkId,
+ @Nullable ActionListener listener) {
+ ActionListenerProxy listenerProxy = null;
+ Binder binder = null;
+ if (listener != null) {
+ listenerProxy = new ActionListenerProxy("connect", mLooper, listener);
+ binder = new Binder();
}
- return key;
- }
-
- private Object removeListener(int key) {
- if (key == INVALID_KEY) return null;
- synchronized (mListenerMapLock) {
- Object listener = mListenerMap.get(key);
- mListenerMap.remove(key);
- return listener;
- }
- }
-
- private synchronized AsyncChannel getChannel() {
- if (mAsyncChannel == null) {
- Messenger messenger = getWifiServiceMessenger();
- if (messenger == null) {
- throw new IllegalStateException(
- "getWifiServiceMessenger() returned null! This is invalid.");
+ try {
+ IWifiManager iWifiManager = getIWifiManager();
+ if (iWifiManager == null) {
+ throw new RemoteException("Wifi service is not running");
}
-
- mAsyncChannel = new AsyncChannel();
- mConnected = new CountDownLatch(1);
-
- Handler handler = new ServiceHandler(mLooper);
- mAsyncChannel.connect(mContext, handler, messenger);
- try {
- mConnected.await();
- } catch (InterruptedException e) {
- Log.e(TAG, "interrupted wait at init");
- }
+ iWifiManager.connect(config, networkId, binder, listenerProxy,
+ listener == null ? 0 : listener.hashCode());
+ } catch (RemoteException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(ERROR);
+ } catch (SecurityException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(NOT_AUTHORIZED);
}
- return mAsyncChannel;
}
/**
@@ -3851,10 +3735,7 @@
})
public void connect(@NonNull WifiConfiguration config, @Nullable ActionListener listener) {
if (config == null) throw new IllegalArgumentException("config cannot be null");
- // Use INVALID_NETWORK_ID for arg1 when passing a config object
- // arg1 is used to pass network id when the network already exists
- getChannel().sendMessage(CONNECT_NETWORK, WifiConfiguration.INVALID_NETWORK_ID,
- putListener(listener), config);
+ connectInternal(config, WifiConfiguration.INVALID_NETWORK_ID, listener);
}
/**
@@ -3877,7 +3758,7 @@
})
public void connect(int networkId, @Nullable ActionListener listener) {
if (networkId < 0) throw new IllegalArgumentException("Network id cannot be negative");
- getChannel().sendMessage(CONNECT_NETWORK, networkId, putListener(listener));
+ connectInternal(null, networkId, listener);
}
/**
@@ -3908,7 +3789,24 @@
})
public void save(@NonNull WifiConfiguration config, @Nullable ActionListener listener) {
if (config == null) throw new IllegalArgumentException("config cannot be null");
- getChannel().sendMessage(SAVE_NETWORK, 0, putListener(listener), config);
+ ActionListenerProxy listenerProxy = null;
+ Binder binder = null;
+ if (listener != null) {
+ listenerProxy = new ActionListenerProxy("save", mLooper, listener);
+ binder = new Binder();
+ }
+ try {
+ IWifiManager iWifiManager = getIWifiManager();
+ if (iWifiManager == null) {
+ throw new RemoteException("Wifi service is not running");
+ }
+ iWifiManager.save(config, binder, listenerProxy,
+ listener == null ? 0 : listener.hashCode());
+ } catch (RemoteException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(ERROR);
+ } catch (SecurityException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(NOT_AUTHORIZED);
+ }
}
/**
@@ -3932,7 +3830,24 @@
})
public void forget(int netId, @Nullable ActionListener listener) {
if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
- getChannel().sendMessage(FORGET_NETWORK, netId, putListener(listener));
+ ActionListenerProxy listenerProxy = null;
+ Binder binder = null;
+ if (listener != null) {
+ listenerProxy = new ActionListenerProxy("forget", mLooper, listener);
+ binder = new Binder();
+ }
+ try {
+ IWifiManager iWifiManager = getIWifiManager();
+ if (iWifiManager == null) {
+ throw new RemoteException("Wifi service is not running");
+ }
+ iWifiManager.forget(netId, binder, listenerProxy,
+ listener == null ? 0 : listener.hashCode());
+ } catch (RemoteException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(ERROR);
+ } catch (SecurityException e) {
+ if (listenerProxy != null) listenerProxy.onFailure(NOT_AUTHORIZED);
+ }
}
/**
@@ -3942,6 +3857,7 @@
* @param listener for callbacks on success or failure. Can be null.
* @throws IllegalStateException if the WifiManager instance needs to be
* initialized again
+ * @deprecated This API is deprecated. Use {@link #disableNetwork(int)} instead.
* @hide
*/
@SystemApi
@@ -3950,9 +3866,19 @@
android.Manifest.permission.NETWORK_SETUP_WIZARD,
android.Manifest.permission.NETWORK_STACK
})
+ @Deprecated
public void disable(int netId, @Nullable ActionListener listener) {
if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
- getChannel().sendMessage(DISABLE_NETWORK, netId, putListener(listener));
+ // Simple wrapper which forwards the call to disableNetwork. This is a temporary
+ // implementation until we can remove this API completely.
+ boolean status = disableNetwork(netId);
+ if (listener != null) {
+ if (status) {
+ listener.onSuccess();
+ } else {
+ listener.onFailure(ERROR);
+ }
+ }
}
/**
@@ -4008,24 +3934,6 @@
}
/**
- * Get a reference to WifiService handler. This is used by a client to establish
- * an AsyncChannel communication with WifiService
- *
- * @return Messenger pointing to the WifiService handler
- */
- @UnsupportedAppUsage
- private Messenger getWifiServiceMessenger() {
- try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getWifiServiceMessenger(mContext.getOpPackageName());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
-
- /**
* Allows an application to keep the Wi-Fi radio awake.
* Normally the Wi-Fi radio may turn off when the user has not used the device in a while.
* Acquiring a WifiLock will keep the radio on until the lock is released. Multiple
@@ -4485,16 +4393,6 @@
}
}
- protected void finalize() throws Throwable {
- try {
- if (mAsyncChannel != null) {
- mAsyncChannel.disconnect();
- }
- } finally {
- super.finalize();
- }
- }
-
/**
* Set wifi verbose log. Called from developer settings.
* @hide
diff --git a/wifi/java/com/android/server/wifi/BaseWifiService.java b/wifi/java/com/android/server/wifi/BaseWifiService.java
index bc06e7d..2e82f4e 100644
--- a/wifi/java/com/android/server/wifi/BaseWifiService.java
+++ b/wifi/java/com/android/server/wifi/BaseWifiService.java
@@ -21,11 +21,13 @@
import android.content.pm.ParceledListSlice;
import android.net.DhcpInfo;
import android.net.Network;
+import android.net.wifi.IActionListener;
import android.net.wifi.IDppCallback;
import android.net.wifi.INetworkRequestMatchCallback;
import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ITrafficStateCallback;
+import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.IWifiManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiActivityEnergyInfo;
@@ -203,7 +205,7 @@
throw new UnsupportedOperationException();
}
- @Override
+ /** @removed */
public void setCountryCode(String country) {
throw new UnsupportedOperationException();
}
@@ -323,7 +325,7 @@
throw new UnsupportedOperationException();
}
- @Override
+ /** @removed */
public Messenger getWifiServiceMessenger(String packageName) {
throw new UnsupportedOperationException();
}
@@ -486,4 +488,28 @@
public void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public void connect(WifiConfiguration config, int netId, IBinder binder,
+ IActionListener callback, int callbackIdentifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void save(WifiConfiguration config, IBinder binder, IActionListener callback,
+ int callbackIdentifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void forget(int netId, IBinder binder, IActionListener callback,
+ int callbackIdentifier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void getTxPacketCount(String packageName, IBinder binder,
+ ITxPacketCountListener callback, int callbackIdentifier) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index e478f38..7e7f002 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -64,11 +64,13 @@
import android.net.wifi.WifiManager.OnWifiUsabilityStatsListener;
import android.net.wifi.WifiManager.SoftApCallback;
import android.net.wifi.WifiManager.TrafficStateCallback;
+import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
+import android.os.RemoteException;
import android.os.test.TestLooper;
import androidx.test.filters.SmallTest;
@@ -971,25 +973,6 @@
}
/**
- * Verify that calls WifiServiceImpl to set country code when no exception happens.
- */
- @Test
- public void testSetWifiCountryCode() throws Exception {
- mWifiManager.setCountryCode(TEST_COUNTRY_CODE);
- verify(mWifiService).setCountryCode(TEST_COUNTRY_CODE);
- }
-
- /**
- * Verify that WifiManager.setCountryCode() rethrows exceptions if caller does not
- * have necessary permissions.
- */
- @Test(expected = SecurityException.class)
- public void testSetWifiCountryCodeFailedOnSecurityException() throws Exception {
- doThrow(new SecurityException()).when(mWifiService).setCountryCode(anyString());
- mWifiManager.setCountryCode(TEST_COUNTRY_CODE);
- }
-
- /**
* Test that calls to get the current WPS config token return null and do not have any
* interactions with WifiServiceImpl.
*/
@@ -1646,4 +1629,97 @@
assertTrue(mWifiManager.setWifiEnabled(false));
verify(mWifiService).setWifiEnabled(mContext.getOpPackageName(), false);
}
+
+ /**
+ * Test behavior of {@link WifiManager#connect(int, WifiManager.ActionListener)}
+ */
+ @Test
+ public void testConnectWithListener() throws Exception {
+ WifiManager.ActionListener externalListener = mock(WifiManager.ActionListener.class);
+ mWifiManager.connect(TEST_NETWORK_ID, externalListener);
+
+ ArgumentCaptor<IActionListener> binderListenerCaptor =
+ ArgumentCaptor.forClass(IActionListener.class);
+ verify(mWifiService).connect(eq(null), eq(TEST_NETWORK_ID), any(Binder.class),
+ binderListenerCaptor.capture(), anyInt());
+ assertNotNull(binderListenerCaptor.getValue());
+
+ // Trigger on success.
+ binderListenerCaptor.getValue().onSuccess();
+ mLooper.dispatchAll();
+ verify(externalListener).onSuccess();
+
+ // Trigger on failure.
+ binderListenerCaptor.getValue().onFailure(WifiManager.BUSY);
+ mLooper.dispatchAll();
+ verify(externalListener).onFailure(WifiManager.BUSY);
+ }
+
+ /**
+ * Test behavior of {@link WifiManager#connect(int, WifiManager.ActionListener)}
+ */
+ @Test
+ public void testConnectWithListenerHandleSecurityException() throws Exception {
+ doThrow(new SecurityException()).when(mWifiService)
+ .connect(eq(null), anyInt(), any(IBinder.class),
+ any(IActionListener.class), anyInt());
+ WifiManager.ActionListener externalListener = mock(WifiManager.ActionListener.class);
+ mWifiManager.connect(TEST_NETWORK_ID, externalListener);
+
+ mLooper.dispatchAll();
+ verify(externalListener).onFailure(WifiManager.NOT_AUTHORIZED);
+ }
+
+ /**
+ * Test behavior of {@link WifiManager#connect(int, WifiManager.ActionListener)}
+ */
+ @Test
+ public void testConnectWithListenerHandleRemoteException() throws Exception {
+ doThrow(new RemoteException()).when(mWifiService)
+ .connect(eq(null), anyInt(), any(IBinder.class),
+ any(IActionListener.class), anyInt());
+ WifiManager.ActionListener externalListener = mock(WifiManager.ActionListener.class);
+ mWifiManager.connect(TEST_NETWORK_ID, externalListener);
+
+ mLooper.dispatchAll();
+ verify(externalListener).onFailure(WifiManager.ERROR);
+ }
+
+ /**
+ * Test behavior of {@link WifiManager#connect(int, WifiManager.ActionListener)}
+ */
+ @Test
+ public void testConnectWithoutListener() throws Exception {
+ WifiConfiguration configuration = new WifiConfiguration();
+ mWifiManager.connect(configuration, null);
+
+ verify(mWifiService).connect(configuration, WifiConfiguration.INVALID_NETWORK_ID, null,
+ null, 0);
+ }
+
+ /**
+ * Test behavior of {@link WifiManager#getTxPacketCount(WifiManager.TxPacketCountListener)}
+ */
+ @Test
+ public void testGetTxPacketCount() throws Exception {
+ WifiManager.TxPacketCountListener externalListener =
+ mock(WifiManager.TxPacketCountListener.class);
+ mWifiManager.getTxPacketCount(externalListener);
+
+ ArgumentCaptor<ITxPacketCountListener> binderListenerCaptor =
+ ArgumentCaptor.forClass(ITxPacketCountListener.class);
+ verify(mWifiService).getTxPacketCount(anyString(), any(Binder.class),
+ binderListenerCaptor.capture(), anyInt());
+ assertNotNull(binderListenerCaptor.getValue());
+
+ // Trigger on success.
+ binderListenerCaptor.getValue().onSuccess(6);
+ mLooper.dispatchAll();
+ verify(externalListener).onSuccess(6);
+
+ // Trigger on failure.
+ binderListenerCaptor.getValue().onFailure(WifiManager.BUSY);
+ mLooper.dispatchAll();
+ verify(externalListener).onFailure(WifiManager.BUSY);
+ }
}