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

Commit ca3b4f76 authored by Ryan Mitchell's avatar Ryan Mitchell
Browse files

Use staging-public-group in framework SDK

To make S finalization easier, this changes the framework SDK so that
apps linking against it will be able to continue working as expected
after the first phase of SDK finalization.

During the first phase of SDK finalization, the resource ids of
resources that have not been removed are finalized.
staging-public-group tags are converted to staging-public-group-final
tags in order to encode into the framework what the staged resource id
of a finalized resource was. When an app recompiles, it will use the
finalized resource id. Then after all apps recompile, phase 2 of
finalization begins, in which the staging-public-group-final tags are
removed so apps can no longer use the staged resource ids.

Apps that link against the SDK (provided they are using a recent
version of aapt) will encode references to staged resources as
TYPE_DYNAMIC_REFERENCE and TYPE_DYNAMIC_ATTRIBUTE. The values of R
fields for staged resources are defined out-of-line to prevent them
from being inlined into apps linking agsint the SDK. This allows the
resource ids to change during phase 1 of API finalization.

Bug: 183413192
Test: `aapt2 diff` and resource ids stayed the same
Test: `aapt2 dump` of framework-res.apk and observe staged resources
Change-Id: Ie2275c608297a5f63dde8b1cf795415112cbcc24
parent b50914c5
Loading
Loading
Loading
Loading
+111 −111

File changed.

Preview size limit exceeded, changes collapsed.

+13 −13
Original line number Diff line number Diff line
@@ -313,15 +313,15 @@ package android {
  public static final class R.attr {
    field public static final int allowClearUserDataOnFailedRestore = 16844288; // 0x1010600
    field public static final int hotwordDetectionService = 16844326; // 0x1010626
    field public static final int hotwordDetectionService;
    field public static final int isVrOnly = 16844152; // 0x1010578
    field public static final int minExtensionVersion = 16844305; // 0x1010611
    field public static final int playHomeTransitionSound = 16844358; // 0x1010646
    field public static final int playHomeTransitionSound;
    field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
    field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566
    field public static final int sdkVersion = 16844304; // 0x1010610
    field public static final int supportsAmbientMode = 16844173; // 0x101058d
    field public static final int throttleDurationMillis = 16844360; // 0x1010648
    field public static final int throttleDurationMillis;
    field public static final int userRestriction = 16844164; // 0x1010584
  }
@@ -350,8 +350,8 @@ package android {
  }
  public static final class R.string {
    field public static final int config_customMediaKeyDispatcher = 17039404; // 0x104002c
    field public static final int config_customMediaSessionPolicyProvider = 17039405; // 0x104002d
    field public static final int config_customMediaKeyDispatcher;
    field public static final int config_customMediaSessionPolicyProvider;
    field public static final int config_defaultAssistant = 17039393; // 0x1040021
    field public static final int config_defaultBrowser = 17039394; // 0x1040022
    field public static final int config_defaultCallRedirection = 17039397; // 0x1040025
@@ -364,15 +364,15 @@ package android {
    field public static final int config_helpIntentNameKey = 17039390; // 0x104001e
    field public static final int config_helpPackageNameKey = 17039387; // 0x104001b
    field public static final int config_helpPackageNameValue = 17039388; // 0x104001c
    field public static final int config_systemAutomotiveCluster = 17039400; // 0x1040028
    field public static final int config_systemAutomotiveProjection = 17039401; // 0x1040029
    field public static final int config_systemContacts = 17039403; // 0x104002b
    field public static final int config_systemAutomotiveCluster;
    field public static final int config_systemAutomotiveProjection;
    field public static final int config_systemContacts;
    field public static final int config_systemGallery = 17039399; // 0x1040027
    field public static final int config_systemShell = 17039402; // 0x104002a
    field public static final int config_systemSpeechRecognizer = 17039406; // 0x104002e
    field public static final int config_systemTelevisionNotificationHandler = 17039409; // 0x1040031
    field public static final int config_systemWellbeing = 17039408; // 0x1040030
    field public static final int config_systemWifiCoexManager = 17039407; // 0x104002f
    field public static final int config_systemShell;
    field public static final int config_systemSpeechRecognizer;
    field public static final int config_systemTelevisionNotificationHandler;
    field public static final int config_systemWellbeing;
    field public static final int config_systemWifiCoexManager;
  }
  public static final class R.style {
+2 −2
Original line number Diff line number Diff line
@@ -58,8 +58,8 @@ package android {
  public static final class R.string {
    field public static final int config_defaultAssistant = 17039393; // 0x1040021
    field public static final int config_defaultDialer = 17039395; // 0x1040023
    field public static final int config_systemAutomotiveCluster = 17039400; // 0x1040028
    field public static final int config_systemAutomotiveProjection = 17039401; // 0x1040029
    field public static final int config_systemAutomotiveCluster;
    field public static final int config_systemAutomotiveProjection;
    field public static final int config_systemGallery = 17039399; // 0x1040027
  }

+4 −1
Original line number Diff line number Diff line
@@ -376,10 +376,13 @@ public class ColorStateList extends ComplexColor implements Parcelable {
            int[] stateSpec = new int[numAttrs];
            for (int i = 0; i < numAttrs; i++) {
                final int stateResId = attrs.getAttributeNameResource(i);
                if (stateResId == R.attr.lStar) {
                    // Non-finalized resource ids cannot be used in switch statements.
                    continue;
                }
                switch (stateResId) {
                    case R.attr.color:
                    case R.attr.alpha:
                    case R.attr.lStar:
                        // Recognized attribute, ignore.
                        break;
                    default:
+19 −19
Original line number Diff line number Diff line
@@ -3030,12 +3030,12 @@
  <!-- ===============================================================
     Resources added in version S of the platform

     NOTE: add <public> elements within a <public-group> like so:
     NOTE: add <public> elements within a <staging-public-group> like so:

     <public-group type="attr" first-id="0x01010531">
     <staging-public-group type="attr" first-id="0x01010531">
         <public name="exampleAttr1" />
         <public name="exampleAttr2" />
     </public-group>
     </staging-public-group>

     To add a new public-group block, choose an id value that is 1 greater
     than the last of that item above. For example, the last "attr" id
@@ -3044,7 +3044,7 @@
     =============================================================== -->
  <eat-comment />

  <public-group type="attr" first-id="0x01010617">
  <staging-public-group type="attr" first-id="0x01010617">
    <public name="rollbackDataPolicy" />
    <public name="allowClickWhenDisabled" />
    <public name="windowLayoutAffinity" />
@@ -3099,13 +3099,13 @@
    <!-- @hide @SystemApi -->
    <public name="throttleDurationMillis" />
    <public name="showInInputMethodPicker" />
  </public-group>
  </staging-public-group>

  <public-group type="drawable" first-id="0x010800b5">
  <staging-public-group type="drawable" first-id="0x010800b5">
    <!-- drawable definitions go here -->
  </public-group>
  </staging-public-group>

  <public-group type="color" first-id="0x0106001d">
  <staging-public-group type="color" first-id="0x0106001d">
    <!-- color definitions go here -->

    <!-- Material design dynamic system palette:-->
@@ -3171,26 +3171,26 @@
    <public name="system_accent3_800" />
    <public name="system_accent3_900" />
    <public name="system_accent3_1000" />
  </public-group>
  </staging-public-group>

  <public-group type="dimen" first-id="0x01050008">
  <staging-public-group type="dimen" first-id="0x01050008">
    <!-- dimension definitions go here -->

    <!-- System-provided dimensions for app widgets. -->
    <public name="system_app_widget_background_radius" />
    <public name="system_app_widget_inner_radius" />
    <public name="system_app_widget_internal_padding" />
  </public-group>
  </staging-public-group>

  <public-group type="bool" first-id="0x01110007">
  <staging-public-group type="bool" first-id="0x01110007">
    <!-- boolean definitions go here -->
  </public-group>
  </staging-public-group>

  <public-group type="style" first-id="0x010302e5">
  <staging-public-group type="style" first-id="0x010302e5">
    <!-- style definitions go here -->
  </public-group>
  </staging-public-group>

  <public-group type="string" first-id="0x01040028">
  <staging-public-group type="string" first-id="0x01040028">
    <!-- @hide @SystemApi @TestApi -->
    <public name="config_systemAutomotiveCluster" />
    <!-- @hide @SystemApi @TestApi -->
@@ -3211,11 +3211,11 @@
    <public name="config_systemWellbeing" />
    <!-- @hide @SystemApi -->
    <public name="config_systemTelevisionNotificationHandler" />
  </public-group>
  </staging-public-group>

  <public-group type="id" first-id="0x01020055">
  <staging-public-group type="id" first-id="0x01020055">
    <!-- id definitions go here -->
  </public-group>
  </staging-public-group>

  <!-- ===============================================================
       DO NOT ADD UN-GROUPED ITEMS HERE
Loading