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

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

Make change and version bump to r_aml_300802000 for mainline module file:...

Make change and version bump to r_aml_300802000 for mainline module file: packages/Tethering/apex/manifest.json

Change-Id: I6601ad32346eec33bef7dde00ae7d744c86aa8e4
parents df5e0f5b 49f60f39
Loading
Loading
Loading
Loading
+51 −44
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import static android.app.blob.XmlTags.TAG_COMMITTER;
import static android.app.blob.XmlTags.TAG_LEASEE;
import static android.os.Process.INVALID_UID;
import static android.system.OsConstants.O_RDONLY;
import static android.text.format.Formatter.FLAG_IEC_UNITS;
import static android.text.format.Formatter.formatFileSize;

import static com.android.server.blob.BlobStoreConfig.TAG;
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_COMMIT_TIME;
@@ -335,8 +337,10 @@ class BlobMetadata {
    }

    void forEachLeasee(Consumer<Leasee> consumer) {
        synchronized (mMetadataLock) {
            mLeasees.forEach(consumer);
        }
    }

    File getBlobFile() {
        if (mBlobFile == null) {
@@ -460,10 +464,12 @@ class BlobMetadata {
    }

    void dump(IndentingPrintWriter fout, DumpArgs dumpArgs) {
        synchronized (mMetadataLock) {
            fout.println("blobHandle:");
            fout.increaseIndent();
            mBlobHandle.dump(fout, dumpArgs.shouldDumpFull());
            fout.decreaseIndent();
            fout.println("size: " + formatFileSize(mContext, getSize(), FLAG_IEC_UNITS));

            fout.println("Committers:");
            fout.increaseIndent();
@@ -509,6 +515,7 @@ class BlobMetadata {
            }
            fout.decreaseIndent();
        }
    }

    void writeToXml(XmlSerializer out) throws IOException {
        synchronized (mMetadataLock) {
+2 −4
Original line number Diff line number Diff line
@@ -1070,10 +1070,8 @@ public class BlobStoreManagerService extends SystemService {
                return shouldRemove;
            });
        }
        if (LOGV) {
            Slog.v(TAG, "Completed idle maintenance; deleted "
        Slog.d(TAG, "Completed idle maintenance; deleted "
                + Arrays.toString(deletedBlobIds.toArray()));
        }
        writeBlobSessionsAsync();
    }

+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import static android.system.OsConstants.O_CREAT;
import static android.system.OsConstants.O_RDONLY;
import static android.system.OsConstants.O_RDWR;
import static android.system.OsConstants.SEEK_SET;
import static android.text.format.Formatter.FLAG_IEC_UNITS;
import static android.text.format.Formatter.formatFileSize;

import static com.android.server.blob.BlobStoreConfig.TAG;
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_SESSION_CREATION_TIME;
@@ -533,6 +535,7 @@ class BlobStoreSession extends IBlobStoreSession.Stub {
            fout.println("ownerUid: " + mOwnerUid);
            fout.println("ownerPkg: " + mOwnerPackageName);
            fout.println("creation time: " + BlobStoreUtils.formatTime(mCreationTimeMs));
            fout.println("size: " + formatFileSize(mContext, getSize(), FLAG_IEC_UNITS));

            fout.println("blobHandle:");
            fout.increaseIndent();
+1 −1
Original line number Diff line number Diff line
{
  "name": "com.android.extservices",
  "version": 300801900
  "version": 300802000
}
+81 −29
Original line number Diff line number Diff line
@@ -82,10 +82,10 @@ import android.os.BatteryStats;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.IDeviceIdleController;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerWhitelistManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -93,7 +93,6 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings.Global;
import android.telephony.TelephonyManager;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.KeyValueListParser;
import android.util.Slog;
@@ -205,6 +204,10 @@ public class AppStandbyController implements AppStandbyInternal {
     */
    private static final long WAIT_FOR_ADMIN_DATA_TIMEOUT_MS = 10_000;

    private static final int HEADLESS_APP_CHECK_FLAGS =
            PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
                    | PackageManager.GET_ACTIVITIES | PackageManager.MATCH_DISABLED_COMPONENTS;

    // To name the lock for stack traces
    static class Lock {}

@@ -234,7 +237,7 @@ public class AppStandbyController implements AppStandbyInternal {
     * disabled). Presence in this map indicates that the app is a headless system app.
     */
    @GuardedBy("mHeadlessSystemApps")
    private final ArrayMap<String, Boolean> mHeadlessSystemApps = new ArrayMap<>();
    private final ArraySet<String> mHeadlessSystemApps = new ArraySet<>();

    private final CountDownLatch mAdminDataAvailableLatch = new CountDownLatch(1);

@@ -387,6 +390,7 @@ public class AppStandbyController implements AppStandbyInternal {
        DeviceStateReceiver deviceStateReceiver = new DeviceStateReceiver();
        IntentFilter deviceStates = new IntentFilter(BatteryManager.ACTION_CHARGING);
        deviceStates.addAction(BatteryManager.ACTION_DISCHARGING);
        deviceStates.addAction(PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED);
        mContext.registerReceiver(deviceStateReceiver, deviceStates);

        synchronized (mAppIdleLock) {
@@ -442,6 +446,9 @@ public class AppStandbyController implements AppStandbyInternal {

            mSystemServicesReady = true;

            // Offload to handler thread to avoid boot time impact.
            mHandler.post(mInjector::updatePowerWhitelistCache);

            boolean userFileExists;
            synchronized (mAppIdleLock) {
                userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
@@ -1080,16 +1087,12 @@ public class AppStandbyController implements AppStandbyInternal {
            return STANDBY_BUCKET_EXEMPTED;
        }
        if (mSystemServicesReady) {
            try {
            // We allow all whitelisted apps, including those that don't want to be whitelisted
            // for idle mode, because app idle (aka app standby) is really not as big an issue
            // for controlling who participates vs. doze mode.
            if (mInjector.isNonIdleWhitelisted(packageName)) {
                return STANDBY_BUCKET_EXEMPTED;
            }
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }

            if (isActiveDeviceAdmin(packageName, userId)) {
                return STANDBY_BUCKET_EXEMPTED;
@@ -1123,7 +1126,7 @@ public class AppStandbyController implements AppStandbyInternal {

    private boolean isHeadlessSystemApp(String packageName) {
        synchronized (mHeadlessSystemApps) {
            return mHeadlessSystemApps.containsKey(packageName);
            return mHeadlessSystemApps.contains(packageName);
        }
    }

@@ -1695,9 +1698,8 @@ public class AppStandbyController implements AppStandbyInternal {
            return;
        }
        try {
            PackageInfo pi = mPackageManager.getPackageInfoAsUser(packageName,
                    PackageManager.GET_ACTIVITIES | PackageManager.MATCH_DISABLED_COMPONENTS,
                    userId);
            PackageInfo pi = mPackageManager.getPackageInfoAsUser(
                    packageName, HEADLESS_APP_CHECK_FLAGS, userId);
            evaluateSystemAppException(pi);
        } catch (PackageManager.NameNotFoundException e) {
            synchronized (mHeadlessSystemApps) {
@@ -1709,15 +1711,16 @@ public class AppStandbyController implements AppStandbyInternal {
    /** Returns true if the exception status changed. */
    private boolean evaluateSystemAppException(@Nullable PackageInfo pkgInfo) {
        if (pkgInfo == null || pkgInfo.applicationInfo == null
                || !pkgInfo.applicationInfo.isSystemApp()) {
                || (!pkgInfo.applicationInfo.isSystemApp()
                        && !pkgInfo.applicationInfo.isUpdatedSystemApp())) {
            return false;
        }
        synchronized (mHeadlessSystemApps) {
            if (pkgInfo.activities == null || pkgInfo.activities.length == 0) {
                // Headless system app.
                return mHeadlessSystemApps.put(pkgInfo.packageName, true) == null;
                return mHeadlessSystemApps.add(pkgInfo.packageName);
            } else {
                return mHeadlessSystemApps.remove(pkgInfo.packageName) != null;
                return mHeadlessSystemApps.remove(pkgInfo.packageName);
            }
        }
    }
@@ -1754,12 +1757,11 @@ public class AppStandbyController implements AppStandbyInternal {
        }
    }

    /** Call on a system update to temporarily reset system app buckets. */
    /** Call on system boot to get the initial set of headless system apps. */
    private void loadHeadlessSystemAppCache() {
        Slog.d(TAG, "Loading headless system app cache. appIdleEnabled=" + mAppIdleEnabled);
        final List<PackageInfo> packages = mPackageManager.getInstalledPackagesAsUser(
                PackageManager.GET_ACTIVITIES | PackageManager.MATCH_DISABLED_COMPONENTS,
                UserHandle.USER_SYSTEM);
                HEADLESS_APP_CHECK_FLAGS, UserHandle.USER_SYSTEM);
        final int packageCount = packages.size();
        for (int i = 0; i < packageCount; i++) {
            PackageInfo pkgInfo = packages.get(i);
@@ -1807,8 +1809,6 @@ public class AppStandbyController implements AppStandbyInternal {
                    + "): " + mCarrierPrivilegedApps);
        }

        final long now = System.currentTimeMillis();

        pw.println();
        pw.println("Settings:");

@@ -1868,12 +1868,14 @@ public class AppStandbyController implements AppStandbyInternal {
        synchronized (mHeadlessSystemApps) {
            for (int i = mHeadlessSystemApps.size() - 1; i >= 0; --i) {
                pw.print("  ");
                pw.print(mHeadlessSystemApps.keyAt(i));
                pw.print(mHeadlessSystemApps.valueAt(i));
                pw.println(",");
            }
        }
        pw.println("]");
        pw.println();

        mInjector.dump(pw);
    }

    /**
@@ -1890,7 +1892,7 @@ public class AppStandbyController implements AppStandbyInternal {
        private PackageManagerInternal mPackageManagerInternal;
        private DisplayManager mDisplayManager;
        private PowerManager mPowerManager;
        private PowerWhitelistManager mPowerWhitelistManager;
        private IDeviceIdleController mDeviceIdleController;
        private CrossProfileAppsInternal mCrossProfileAppsInternal;
        int mBootPhase;
        /**
@@ -1898,6 +1900,11 @@ public class AppStandbyController implements AppStandbyInternal {
         * automatically placed in the RESTRICTED bucket.
         */
        long mAutoRestrictedBucketDelayMs = ONE_DAY;
        /**
         * Cached set of apps that are power whitelisted, including those not whitelisted from idle.
         */
        @GuardedBy("mPowerWhitelistedApps")
        private final ArraySet<String> mPowerWhitelistedApps = new ArraySet<>();

        Injector(Context context, Looper looper) {
            mContext = context;
@@ -1914,7 +1921,8 @@ public class AppStandbyController implements AppStandbyInternal {

        void onBootPhase(int phase) {
            if (phase == PHASE_SYSTEM_SERVICES_READY) {
                mPowerWhitelistManager = mContext.getSystemService(PowerWhitelistManager.class);
                mDeviceIdleController = IDeviceIdleController.Stub.asInterface(
                        ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER));
                mBatteryStats = IBatteryStats.Stub.asInterface(
                        ServiceManager.getService(BatteryStats.SERVICE_NAME));
                mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class);
@@ -1965,8 +1973,34 @@ public class AppStandbyController implements AppStandbyInternal {
            return mBatteryManager.isCharging();
        }

        boolean isNonIdleWhitelisted(String packageName) throws RemoteException {
            return mPowerWhitelistManager.isWhitelisted(packageName, false);
        boolean isNonIdleWhitelisted(String packageName) {
            if (mBootPhase < PHASE_SYSTEM_SERVICES_READY) {
                return false;
            }
            synchronized (mPowerWhitelistedApps) {
                return mPowerWhitelistedApps.contains(packageName);
            }
        }

        private void updatePowerWhitelistCache() {
            if (mBootPhase < PHASE_SYSTEM_SERVICES_READY) {
                return;
            }
            try {
                // Don't call out to DeviceIdleController with the lock held.
                final String[] whitelistedPkgs =
                        mDeviceIdleController.getFullPowerWhitelistExceptIdle();
                synchronized (mPowerWhitelistedApps) {
                    mPowerWhitelistedApps.clear();
                    final int len = whitelistedPkgs.length;
                    for (int i = 0; i < len; ++i) {
                        mPowerWhitelistedApps.add(whitelistedPkgs[i]);
                    }
                }
            } catch (RemoteException e) {
                // Should not happen.
                Slog.wtf(TAG, "Failed to get power whitelist", e);
            }
        }

        boolean isRestrictedBucketEnabled() {
@@ -2053,6 +2087,19 @@ public class AppStandbyController implements AppStandbyInternal {
            }
            return mCrossProfileAppsInternal.getTargetUserProfiles(pkg, userId);
        }

        void dump(PrintWriter pw) {
            pw.println("mPowerWhitelistedApps=[");
            synchronized (mPowerWhitelistedApps) {
                for (int i = mPowerWhitelistedApps.size() - 1; i >= 0; --i) {
                    pw.print("  ");
                    pw.print(mPowerWhitelistedApps.valueAt(i));
                    pw.println(",");
                }
            }
            pw.println("]");
            pw.println();
        }
    }

    class AppStandbyHandler extends Handler {
@@ -2138,6 +2185,11 @@ public class AppStandbyController implements AppStandbyInternal {
                case BatteryManager.ACTION_DISCHARGING:
                    setChargingState(false);
                    break;
                case PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED:
                    if (mSystemServicesReady) {
                        mHandler.post(mInjector::updatePowerWhitelistCache);
                    }
                    break;
            }
        }
    }
Loading