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

Commit eafbbb0c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6799200 from b9a7e3ae to rvc-qpr1-release

Change-Id: Ifa0d872dab2a7bdadd4d9cd7dc97e03d76fe5583
parents aec8ca1d b9a7e3ae
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -684,4 +684,14 @@ interface IActivityManager {
     * Kills uid with the reason of permission change.
     */
    void killUidForPermissionChange(int appId, int userId, String reason);

    /**
     * Control the app freezer state. Returns true in case of success, false if the operation
     * didn't succeed (for example, when the app freezer isn't supported). 
     * Handling the freezer state via this method is reentrant, that is it can be 
     * disabled and re-enabled multiple times in parallel. As long as there's a 1:1 disable to
     * enable match, the freezer is re-enabled at last enable only.
     * @param enable set it to true to enable the app freezer, false to disable it.
     */
    boolean enableAppFreezer(in boolean enable);
}
+2 −3
Original line number Diff line number Diff line
@@ -1291,8 +1291,7 @@ public class PackageInstaller {
         *
         * @throws PackageManager.NameNotFoundException if the new owner could not be found.
         * @throws SecurityException if called after the session has been committed or abandoned.
         * @throws SecurityException if the session does not update the original installer
         * @throws SecurityException if streams opened through
         * @throws IllegalArgumentException if streams opened through
         *                                  {@link #openWrite(String, long, long) are still open.
         */
        public void transfer(@NonNull String packageName)
+12 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.os;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.util.Log;
import android.util.SparseIntArray;
@@ -255,7 +256,12 @@ public final class BinderProxy implements IBinder {
            // out of system_server to all processes hosting binder objects it holds a reference to;
            // since some of those processes might be frozen, we don't want to block here
            // forever. Disable the freezer.
            Process.enableFreezer(false);
            try {
                ActivityManager.getService().enableAppFreezer(false);
            } catch (RemoteException e) {
                Log.e(Binder.TAG, "RemoteException while disabling app freezer");
            }

            for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
                BinderProxy bp = weakRef.get();
                String key;
@@ -278,7 +284,11 @@ public final class BinderProxy implements IBinder {
                    counts.put(key, i + 1);
                }
            }
            Process.enableFreezer(true);
            try {
                ActivityManager.getService().enableAppFreezer(true);
            } catch (RemoteException e) {
                Log.e(Binder.TAG, "RemoteException while re-enabling app freezer");
            }
            Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
                    new Map.Entry[counts.size()]);

+1 −1
Original line number Diff line number Diff line
@@ -947,7 +947,7 @@ public class Process {

    /**
     * Enable or disable the freezer. When enable == false all frozen processes are unfrozen,
     * but aren't removed from the freezer. Processes can still be added or removed
     * but aren't removed from the freezer. While in this state, processes can be added or removed
     * by using setProcessFrozen, but they won't actually be frozen until the freezer is enabled
     * again. If enable == true the freezer is enabled again, and all processes
     * in the freezer (including the ones added while the freezer was disabled) are frozen.
+0 −17
Original line number Diff line number Diff line
@@ -346,22 +346,6 @@ void android_os_Process_setProcessFrozen(
    }
}

void android_os_Process_enableFreezer(
        JNIEnv *env, jobject clazz, jboolean enable)
{
    bool success = true;

    if (enable) {
        success = SetTaskProfiles(0, {"FreezerFrozen"}, true);
    } else {
        success = SetTaskProfiles(0, {"FreezerThawed"}, true);
    }

    if (!success) {
        jniThrowException(env, "java/lang/RuntimeException", "Unknown error");
    }
}

jint android_os_Process_getProcessGroup(JNIEnv* env, jobject clazz, jint pid)
{
    SchedPolicy sp;
@@ -1360,7 +1344,6 @@ static const JNINativeMethod methods[] = {
        {"sendSignal", "(II)V", (void*)android_os_Process_sendSignal},
        {"sendSignalQuiet", "(II)V", (void*)android_os_Process_sendSignalQuiet},
        {"setProcessFrozen", "(IIZ)V", (void*)android_os_Process_setProcessFrozen},
        {"enableFreezer", "(Z)V", (void*)android_os_Process_enableFreezer},
        {"getFreeMemory", "()J", (void*)android_os_Process_getFreeMemory},
        {"getTotalMemory", "()J", (void*)android_os_Process_getTotalMemory},
        {"readProcLines", "(Ljava/lang/String;[Ljava/lang/String;[J)V",
Loading