Loading apex/jobscheduler/OWNERS +2 −0 Original line number Diff line number Diff line ctate@android.com ctate@google.com dplotnikov@google.com jji@google.com kwekua@google.com omakoto@google.com suprabh@google.com varunshah@google.com yamasani@google.com apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,16 @@ public class PowerExemptionManager { * @hide */ public static final int REASON_CARRIER_PRIVILEGED_APP = 321; /** * Device/Profile owner protected apps. * @hide */ public static final int REASON_DPO_PROTECTED_APP = 322; /** * Apps control is disallowed for the user. * @hide */ public static final int REASON_DISALLOW_APPS_CONTROL = 323; /** @hide The app requests out-out. */ public static final int REASON_OPT_OUT_REQUESTED = 1000; Loading Loading @@ -447,6 +457,8 @@ public class PowerExemptionManager { REASON_SYSTEM_MODULE, REASON_CARRIER_PRIVILEGED_APP, REASON_OPT_OUT_REQUESTED, REASON_DPO_PROTECTED_APP, REASON_DISALLOW_APPS_CONTROL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReasonCode {} Loading Loading @@ -653,6 +665,10 @@ public class PowerExemptionManager { return AppBackgroundRestrictionsInfo.REASON_ROLE_DIALER; case REASON_ROLE_EMERGENCY: return AppBackgroundRestrictionsInfo.REASON_ROLE_EMERGENCY; case REASON_DPO_PROTECTED_APP: return AppBackgroundRestrictionsInfo.REASON_DPO_PROTECTED_APP; case REASON_DISALLOW_APPS_CONTROL: return AppBackgroundRestrictionsInfo.REASON_DISALLOW_APPS_CONTROL; default: return AppBackgroundRestrictionsInfo.REASON_DENIED; } Loading Loading @@ -798,6 +814,10 @@ public class PowerExemptionManager { return "SYSTEM_MODULE"; case REASON_CARRIER_PRIVILEGED_APP: return "CARRIER_PRIVILEGED_APP"; case REASON_DPO_PROTECTED_APP: return "DPO_PROTECTED_APP"; case REASON_DISALLOW_APPS_CONTROL: return "DISALLOW_APPS_CONTROL"; case REASON_OPT_OUT_REQUESTED: return "REASON_OPT_OUT_REQUESTED"; default: Loading apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java +53 −20 Original line number Diff line number Diff line Loading @@ -385,6 +385,22 @@ public class AppStandbyController */ private final Map<String, String> mAppStandbyProperties = new ArrayMap<>(); /** * List of app-ids of system packages, populated on boot, when system services are ready. */ private final ArrayList<Integer> mSystemPackagesAppIds = new ArrayList<>(); /** * PackageManager flags to query for all system packages, including those that are disabled * and hidden. */ private static final int SYSTEM_PACKAGE_FLAGS = PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_SYSTEM_ONLY | PackageManager.MATCH_ANY_USER | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; /** * Whether we should allow apps into the * {@link android.app.usage.UsageStatsManager#STANDBY_BUCKET_RESTRICTED} bucket or not. Loading Loading @@ -585,6 +601,14 @@ public class AppStandbyController if (mPendingOneTimeCheckIdleStates) { postOneTimeCheckIdleStates(); } // Populate list of system packages and their app-ids. final List<ApplicationInfo> systemApps = mPackageManager.getInstalledApplications( SYSTEM_PACKAGE_FLAGS); for (int i = 0, size = systemApps.size(); i < size; i++) { final ApplicationInfo appInfo = systemApps.get(i); mSystemPackagesAppIds.add(UserHandle.getAppId(appInfo.uid)); } } else if (phase == PHASE_BOOT_COMPLETED) { setChargingState(mInjector.isCharging()); Loading @@ -602,17 +626,18 @@ public class AppStandbyController // Get sync adapters for the authority String[] packages = ContentResolver.getSyncAdapterPackagesForAuthorityAsUser( authority, userId); final PackageManagerInternal pmi = mInjector.getPackageManagerInternal(); final long elapsedRealtime = mInjector.elapsedRealtime(); for (String packageName : packages) { // Only force the sync adapters to active if the provider is not in the same package and // the sync adapter is a system package. try { PackageInfo pi = mPackageManager.getPackageInfoAsUser( packageName, PackageManager.MATCH_SYSTEM_ONLY, userId); if (pi == null || pi.applicationInfo == null) { // Don't force the sync adapter to active if the provider is in the same APK. if (packageName.equals(providerPkgName)) { continue; } if (!packageName.equals(providerPkgName)) { final int appId = UserHandle.getAppId(pmi.getPackageUid(packageName, 0, userId)); // Elevate the sync adapter to active if it's a system app or // is a non-system app and shares its app id with a system app. if (mSystemPackagesAppIds.contains(appId)) { final List<UserHandle> linkedProfiles = getCrossProfileTargets(packageName, userId); synchronized (mAppIdleLock) { Loading @@ -621,9 +646,6 @@ public class AppStandbyController elapsedRealtime, mSyncAdapterTimeoutMillis, linkedProfiles); } } } catch (PackageManager.NameNotFoundException e) { // Shouldn't happen } } } Loading Loading @@ -2190,7 +2212,18 @@ public class AppStandbyController for (int i = mHeadlessSystemApps.size() - 1; i >= 0; --i) { pw.print(" "); pw.print(mHeadlessSystemApps.valueAt(i)); pw.println(","); if (i != 0) pw.println(","); } } pw.println("]"); pw.println(); pw.println("mSystemPackagesAppIds=["); synchronized (mSystemPackagesAppIds) { for (int i = mSystemPackagesAppIds.size() - 1; i >= 0; --i) { pw.print(" "); pw.print(mSystemPackagesAppIds.get(i)); if (i != 0) pw.println(","); } } pw.println("]"); Loading cmds/bootanimation/BootAnimation.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -577,8 +577,8 @@ status_t BootAnimation::readyToRun() { mDisplay = display; mContext = context; mSurface = surface; mWidth = w; mHeight = h; mInitWidth = mWidth = w; mInitHeight = mHeight = h; mFlingerSurfaceControl = control; mFlingerSurface = s; mTargetInset = -1; Loading Loading @@ -611,6 +611,7 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) { eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroySurface(mDisplay, mSurface); mFlingerSurfaceControl->updateDefaultBufferSize(newWidth, newHeight); const auto limitedSize = limitSurfaceSize(newWidth, newHeight); mWidth = limitedSize.width; mHeight = limitedSize.height; Loading Loading @@ -1515,8 +1516,10 @@ bool BootAnimation::playAnimation(const Animation& animation) { processDisplayEvents(); const int animationX = (mWidth - animation.width) / 2; const int animationY = (mHeight - animation.height) / 2; const double ratio_w = static_cast<double>(mWidth) / mInitWidth; const double ratio_h = static_cast<double>(mHeight) / mInitHeight; const int animationX = (mWidth - animation.width * ratio_w) / 2; const int animationY = (mHeight - animation.height * ratio_h) / 2; const Animation::Frame& frame(part.frames[j]); nsecs_t lastFrame = systemTime(); Loading @@ -1532,12 +1535,16 @@ bool BootAnimation::playAnimation(const Animation& animation) { initTexture(frame.map, &w, &h, false /* don't premultiply alpha */); } const int xc = animationX + frame.trimX; const int yc = animationY + frame.trimY; const int trimWidth = frame.trimWidth * ratio_w; const int trimHeight = frame.trimHeight * ratio_h; const int trimX = frame.trimX * ratio_w; const int trimY = frame.trimY * ratio_h; const int xc = animationX + trimX; const int yc = animationY + trimY; glClear(GL_COLOR_BUFFER_BIT); // specify the y center as ceiling((mHeight - frame.trimHeight) / 2) // which is equivalent to mHeight - (yc + frame.trimHeight) const int frameDrawY = mHeight - (yc + frame.trimHeight); const int frameDrawY = mHeight - (yc + trimHeight); float fade = 0; // if the part hasn't been stopped yet then continue fading if necessary Loading @@ -1554,7 +1561,7 @@ bool BootAnimation::playAnimation(const Animation& animation) { glUniform1f(mImageColorProgressLocation, colorProgress); } glEnable(GL_BLEND); drawTexturedQuad(xc, frameDrawY, frame.trimWidth, frame.trimHeight); drawTexturedQuad(xc, frameDrawY, trimWidth, trimHeight); glDisable(GL_BLEND); if (mClockEnabled && mTimeIsAccurate && validClock(part)) { Loading cmds/bootanimation/BootAnimation.h +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,8 @@ private: Texture mAndroid[2]; int mWidth; int mHeight; int mInitWidth; int mInitHeight; int mMaxWidth = 0; int mMaxHeight = 0; int mCurrentInset; Loading Loading
apex/jobscheduler/OWNERS +2 −0 Original line number Diff line number Diff line ctate@android.com ctate@google.com dplotnikov@google.com jji@google.com kwekua@google.com omakoto@google.com suprabh@google.com varunshah@google.com yamasani@google.com
apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -369,6 +369,16 @@ public class PowerExemptionManager { * @hide */ public static final int REASON_CARRIER_PRIVILEGED_APP = 321; /** * Device/Profile owner protected apps. * @hide */ public static final int REASON_DPO_PROTECTED_APP = 322; /** * Apps control is disallowed for the user. * @hide */ public static final int REASON_DISALLOW_APPS_CONTROL = 323; /** @hide The app requests out-out. */ public static final int REASON_OPT_OUT_REQUESTED = 1000; Loading Loading @@ -447,6 +457,8 @@ public class PowerExemptionManager { REASON_SYSTEM_MODULE, REASON_CARRIER_PRIVILEGED_APP, REASON_OPT_OUT_REQUESTED, REASON_DPO_PROTECTED_APP, REASON_DISALLOW_APPS_CONTROL, }) @Retention(RetentionPolicy.SOURCE) public @interface ReasonCode {} Loading Loading @@ -653,6 +665,10 @@ public class PowerExemptionManager { return AppBackgroundRestrictionsInfo.REASON_ROLE_DIALER; case REASON_ROLE_EMERGENCY: return AppBackgroundRestrictionsInfo.REASON_ROLE_EMERGENCY; case REASON_DPO_PROTECTED_APP: return AppBackgroundRestrictionsInfo.REASON_DPO_PROTECTED_APP; case REASON_DISALLOW_APPS_CONTROL: return AppBackgroundRestrictionsInfo.REASON_DISALLOW_APPS_CONTROL; default: return AppBackgroundRestrictionsInfo.REASON_DENIED; } Loading Loading @@ -798,6 +814,10 @@ public class PowerExemptionManager { return "SYSTEM_MODULE"; case REASON_CARRIER_PRIVILEGED_APP: return "CARRIER_PRIVILEGED_APP"; case REASON_DPO_PROTECTED_APP: return "DPO_PROTECTED_APP"; case REASON_DISALLOW_APPS_CONTROL: return "DISALLOW_APPS_CONTROL"; case REASON_OPT_OUT_REQUESTED: return "REASON_OPT_OUT_REQUESTED"; default: Loading
apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java +53 −20 Original line number Diff line number Diff line Loading @@ -385,6 +385,22 @@ public class AppStandbyController */ private final Map<String, String> mAppStandbyProperties = new ArrayMap<>(); /** * List of app-ids of system packages, populated on boot, when system services are ready. */ private final ArrayList<Integer> mSystemPackagesAppIds = new ArrayList<>(); /** * PackageManager flags to query for all system packages, including those that are disabled * and hidden. */ private static final int SYSTEM_PACKAGE_FLAGS = PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_SYSTEM_ONLY | PackageManager.MATCH_ANY_USER | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; /** * Whether we should allow apps into the * {@link android.app.usage.UsageStatsManager#STANDBY_BUCKET_RESTRICTED} bucket or not. Loading Loading @@ -585,6 +601,14 @@ public class AppStandbyController if (mPendingOneTimeCheckIdleStates) { postOneTimeCheckIdleStates(); } // Populate list of system packages and their app-ids. final List<ApplicationInfo> systemApps = mPackageManager.getInstalledApplications( SYSTEM_PACKAGE_FLAGS); for (int i = 0, size = systemApps.size(); i < size; i++) { final ApplicationInfo appInfo = systemApps.get(i); mSystemPackagesAppIds.add(UserHandle.getAppId(appInfo.uid)); } } else if (phase == PHASE_BOOT_COMPLETED) { setChargingState(mInjector.isCharging()); Loading @@ -602,17 +626,18 @@ public class AppStandbyController // Get sync adapters for the authority String[] packages = ContentResolver.getSyncAdapterPackagesForAuthorityAsUser( authority, userId); final PackageManagerInternal pmi = mInjector.getPackageManagerInternal(); final long elapsedRealtime = mInjector.elapsedRealtime(); for (String packageName : packages) { // Only force the sync adapters to active if the provider is not in the same package and // the sync adapter is a system package. try { PackageInfo pi = mPackageManager.getPackageInfoAsUser( packageName, PackageManager.MATCH_SYSTEM_ONLY, userId); if (pi == null || pi.applicationInfo == null) { // Don't force the sync adapter to active if the provider is in the same APK. if (packageName.equals(providerPkgName)) { continue; } if (!packageName.equals(providerPkgName)) { final int appId = UserHandle.getAppId(pmi.getPackageUid(packageName, 0, userId)); // Elevate the sync adapter to active if it's a system app or // is a non-system app and shares its app id with a system app. if (mSystemPackagesAppIds.contains(appId)) { final List<UserHandle> linkedProfiles = getCrossProfileTargets(packageName, userId); synchronized (mAppIdleLock) { Loading @@ -621,9 +646,6 @@ public class AppStandbyController elapsedRealtime, mSyncAdapterTimeoutMillis, linkedProfiles); } } } catch (PackageManager.NameNotFoundException e) { // Shouldn't happen } } } Loading Loading @@ -2190,7 +2212,18 @@ public class AppStandbyController for (int i = mHeadlessSystemApps.size() - 1; i >= 0; --i) { pw.print(" "); pw.print(mHeadlessSystemApps.valueAt(i)); pw.println(","); if (i != 0) pw.println(","); } } pw.println("]"); pw.println(); pw.println("mSystemPackagesAppIds=["); synchronized (mSystemPackagesAppIds) { for (int i = mSystemPackagesAppIds.size() - 1; i >= 0; --i) { pw.print(" "); pw.print(mSystemPackagesAppIds.get(i)); if (i != 0) pw.println(","); } } pw.println("]"); Loading
cmds/bootanimation/BootAnimation.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -577,8 +577,8 @@ status_t BootAnimation::readyToRun() { mDisplay = display; mContext = context; mSurface = surface; mWidth = w; mHeight = h; mInitWidth = mWidth = w; mInitHeight = mHeight = h; mFlingerSurfaceControl = control; mFlingerSurface = s; mTargetInset = -1; Loading Loading @@ -611,6 +611,7 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) { eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroySurface(mDisplay, mSurface); mFlingerSurfaceControl->updateDefaultBufferSize(newWidth, newHeight); const auto limitedSize = limitSurfaceSize(newWidth, newHeight); mWidth = limitedSize.width; mHeight = limitedSize.height; Loading Loading @@ -1515,8 +1516,10 @@ bool BootAnimation::playAnimation(const Animation& animation) { processDisplayEvents(); const int animationX = (mWidth - animation.width) / 2; const int animationY = (mHeight - animation.height) / 2; const double ratio_w = static_cast<double>(mWidth) / mInitWidth; const double ratio_h = static_cast<double>(mHeight) / mInitHeight; const int animationX = (mWidth - animation.width * ratio_w) / 2; const int animationY = (mHeight - animation.height * ratio_h) / 2; const Animation::Frame& frame(part.frames[j]); nsecs_t lastFrame = systemTime(); Loading @@ -1532,12 +1535,16 @@ bool BootAnimation::playAnimation(const Animation& animation) { initTexture(frame.map, &w, &h, false /* don't premultiply alpha */); } const int xc = animationX + frame.trimX; const int yc = animationY + frame.trimY; const int trimWidth = frame.trimWidth * ratio_w; const int trimHeight = frame.trimHeight * ratio_h; const int trimX = frame.trimX * ratio_w; const int trimY = frame.trimY * ratio_h; const int xc = animationX + trimX; const int yc = animationY + trimY; glClear(GL_COLOR_BUFFER_BIT); // specify the y center as ceiling((mHeight - frame.trimHeight) / 2) // which is equivalent to mHeight - (yc + frame.trimHeight) const int frameDrawY = mHeight - (yc + frame.trimHeight); const int frameDrawY = mHeight - (yc + trimHeight); float fade = 0; // if the part hasn't been stopped yet then continue fading if necessary Loading @@ -1554,7 +1561,7 @@ bool BootAnimation::playAnimation(const Animation& animation) { glUniform1f(mImageColorProgressLocation, colorProgress); } glEnable(GL_BLEND); drawTexturedQuad(xc, frameDrawY, frame.trimWidth, frame.trimHeight); drawTexturedQuad(xc, frameDrawY, trimWidth, trimHeight); glDisable(GL_BLEND); if (mClockEnabled && mTimeIsAccurate && validClock(part)) { Loading
cmds/bootanimation/BootAnimation.h +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,8 @@ private: Texture mAndroid[2]; int mWidth; int mHeight; int mInitWidth; int mInitHeight; int mMaxWidth = 0; int mMaxHeight = 0; int mCurrentInset; Loading