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

Commit c6bced2a authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7599941 from bafe3db8 to sc-release

Change-Id: If0753a6ec31d64d1d7f5ca46046193a41dd0b856
parents 14d686d3 bafe3db8
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.appwidget;
import android.annotation.Nullable;
import android.util.ArraySet;

import java.util.Set;

/**
 * App widget manager local system service interface.
 *
@@ -42,4 +44,16 @@ public abstract class AppWidgetManagerInternal {
     * @param userId The user that is being unlocked.
     */
    public abstract void unlockUser(int userId);

    /**
     * Updates all widgets, applying changes to Runtime Resource Overlay affecting the specified
     * target packages.
     *
     * @param packageNames The names of all target packages for which an overlay was modified
     * @param userId The user for which overlay modifications occurred.
     * @param updateFrameworkRes Whether or not an overlay affected the values of framework
     *                           resources.
     */
    public abstract void applyResourceOverlaysToWidgets(Set<String> packageNames, int userId,
            boolean updateFrameworkRes);
}
+23 −1
Original line number Diff line number Diff line
@@ -168,6 +168,15 @@ public final class ScanFilter implements Parcelable {
                dest.writeByteArray(mManufacturerDataMask);
            }
        }

        // IRK
        if (mDeviceAddress != null) {
            dest.writeInt(mAddressType);
            dest.writeInt(mIrk == null ? 0 : 1);
            if (mIrk != null) {
                dest.writeByteArray(mIrk);
            }
        }
    }

    /**
@@ -187,8 +196,10 @@ public final class ScanFilter implements Parcelable {
            if (in.readInt() == 1) {
                builder.setDeviceName(in.readString());
            }
            String address = null;
            // If we have a non-null address
            if (in.readInt() == 1) {
                builder.setDeviceAddress(in.readString());
                address = in.readString();
            }
            if (in.readInt() == 1) {
                ParcelUuid uuid = in.readParcelable(ParcelUuid.class.getClassLoader());
@@ -245,6 +256,17 @@ public final class ScanFilter implements Parcelable {
                }
            }

            // IRK
            if (address != null) {
                final int addressType = in.readInt();
                if (in.readInt() == 1) {
                    final byte[] irk = new byte[16];
                    in.readByteArray(irk);
                    builder.setDeviceAddress(address, addressType, irk);
                } else {
                    builder.setDeviceAddress(address, addressType);
                }
            }
            return builder.build();
        }
    };
+5 −13
Original line number Diff line number Diff line
@@ -24,12 +24,12 @@ import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.service.SensorPrivacyIndividualEnabledSensorProto;
import android.service.SensorPrivacyToggleSourceProto;
import android.util.ArrayMap;
@@ -379,7 +379,7 @@ public final class SensorPrivacyManager {
    @SystemApi
    @RequiresPermission(Manifest.permission.OBSERVE_SENSOR_PRIVACY)
    public boolean isSensorPrivacyEnabled(@Sensors.Sensor int sensor) {
        return isSensorPrivacyEnabled(sensor, getCurrentUserId());
        return isSensorPrivacyEnabled(sensor, UserHandle.USER_CURRENT);
    }

    /**
@@ -410,7 +410,7 @@ public final class SensorPrivacyManager {
    @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
    public void setSensorPrivacy(@Sources.Source int source, @Sensors.Sensor int sensor,
            boolean enable) {
        setSensorPrivacy(source, sensor, enable, getCurrentUserId());
        setSensorPrivacy(source, sensor, enable, UserHandle.USER_CURRENT);
    }

    /**
@@ -446,7 +446,7 @@ public final class SensorPrivacyManager {
    @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
    public void setSensorPrivacyForProfileGroup(@Sources.Source int source,
            @Sensors.Sensor int sensor, boolean enable) {
        setSensorPrivacyForProfileGroup(source , sensor, enable, getCurrentUserId());
        setSensorPrivacyForProfileGroup(source , sensor, enable, UserHandle.USER_CURRENT);
    }

    /**
@@ -481,7 +481,7 @@ public final class SensorPrivacyManager {
    @RequiresPermission(Manifest.permission.MANAGE_SENSOR_PRIVACY)
    public void suppressSensorPrivacyReminders(int sensor,
            boolean suppress) {
        suppressSensorPrivacyReminders(sensor, suppress, getCurrentUserId());
        suppressSensorPrivacyReminders(sensor, suppress, UserHandle.USER_CURRENT);
    }

    /**
@@ -609,12 +609,4 @@ public final class SensorPrivacyManager {
        }
    }

    private int getCurrentUserId() {
        try {
            return ActivityManager.getService().getCurrentUserId();
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
        return 0;
    }
}
+9 −9
Original line number Diff line number Diff line
@@ -1460,15 +1460,15 @@ public final class FileUtils {
    /** {@hide} */
    @VisibleForTesting
    public static ParcelFileDescriptor convertToModernFd(FileDescriptor fd) {
        try {
        Context context = AppGlobals.getInitialApplication();
        if (UserHandle.getAppId(Process.myUid()) == getMediaProviderAppId(context)) {
            // Never convert modern fd for MediaProvider, because this requires
            // MediaStore#scanFile and can cause infinite loops when MediaProvider scans
            return null;
        }
            return MediaStore.getOriginalMediaFormatFileDescriptor(context,
                    ParcelFileDescriptor.dup(fd));

        try (ParcelFileDescriptor dupFd = ParcelFileDescriptor.dup(fd)) {
            return MediaStore.getOriginalMediaFormatFileDescriptor(context, dupFd);
        } catch (Exception e) {
            Log.d(TAG, "Failed to convert to modern format file descriptor", e);
            return null;
+0 −42
Original line number Diff line number Diff line
@@ -34,12 +34,9 @@ import dalvik.system.VMRuntime;

import libcore.io.IoUtils;

import java.io.BufferedReader;
import java.io.FileDescriptor;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.TimeoutException;

/**
@@ -1472,43 +1469,4 @@ public class Process {
    }

    private static native int nativePidFdOpen(int pid, int flags) throws ErrnoException;

    /**
     * Checks if a process corresponding to a specific pid owns any file locks.
     * @param pid The process ID for which we want to know the existence of file locks.
     * @return true If the process holds any file locks, false otherwise.
     * @throws IOException if /proc/locks can't be accessed.
     *
     * @hide
     */
    public static boolean hasFileLocks(int pid) throws Exception {
        BufferedReader br = null;

        try {
            br = new BufferedReader(new FileReader("/proc/locks"));
            String line;

            while ((line = br.readLine()) != null) {
                StringTokenizer st = new StringTokenizer(line);

                for (int i = 0; i < 5 && st.hasMoreTokens(); i++) {
                    String str = st.nextToken();
                    try {
                        if (i == 4 && Integer.parseInt(str) == pid) {
                            return true;
                        }
                    } catch (NumberFormatException nfe) {
                        throw new Exception("Exception parsing /proc/locks at \" "
                                + line +  " \", token #" + i);
                    }
                }
            }

            return false;
        } finally {
            if (br != null) {
                br.close();
            }
        }
    }
}
Loading