Gurpreet Singh | 7138788 | 2023-01-09 19:07:43 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- |
| 3 | Exposing a new resource: |
| 4 | To add a new entry, find the corresponding "staging-public-group" with the correct type for |
| 5 | your resource, and add a new entry to the BOTTOM of the list. This ensures that indexes |
| 6 | don't shift for previously added resources, and the new one will be appended to the end. |
| 7 | |
| 8 | To add R.attr.exampleAttrName: |
| 9 | <staging-public-group type="attr" first-id="0x1ff0000"> |
| 10 | <public name="previouslyAdded1"/> |
| 11 | <public name="previouslyAdded2"/> |
| 12 | <public name="exampleAttrName"/> |
| 13 | </staging-public-group> |
| 14 | |
| 15 | Deleting a resource: |
| 16 | If a resource is no longer supported/used, it can be marked removed by renaming the |
| 17 | resource with a `removed_` prefix. This preserves the indexes of other resources so as not |
| 18 | to break apps that have compiled with their integers previously. |
| 19 | |
| 20 | To remove R.attr.previouslyAdded2: |
| 21 | <staging-public-group type="attr" first-id="0x1ff0000"> |
| 22 | <public name="previouslyAdded1"/> |
| 23 | <public name="removed_previouslyAdded2"/> |
| 24 | <public name="exampleAttrName"/> |
| 25 | </staging-public-group> |
| 26 | |
| 27 | IMPORTANT: Deleting an entry is never allowed, even across branches or reverts. Please take |
| 28 | this into account before merging a change which edits this file. Small, isolated changes |
| 29 | which only add/remove resources is recommended to avoid reverts due to build/test failures. |
| 30 | |
| 31 | Renaming a resource: |
| 32 | This is generally fine and can be done to the entry directly, with no other changes. But |
| 33 | note that any apps/tooling that resolve against resource names rather than IDs may break |
| 34 | as a result. This is uncommon, but not rare. |
| 35 | |
| 36 | Finalizing a release's resources: |
| 37 | 1. $ANDROID_BUILD_TOP/frameworks/base/tools/aapt2/tools/finalize_res.py \ |
| 38 | $ANDROID_BUILD_TOP/frameworks/base/core/res/res/values/public-staging.xml \ |
| 39 | $ANDROID_BUILD_TOP/frameworks/base/core/res/res/values/public-final.xml |
| 40 | 2. Rename "NEXT" in the new public-staging.xml resources header to the next platform short |
| 41 | version code |
| 42 | |
| 43 | Finalizing a release's resources (manually; only for reference): |
| 44 | 1. Delete all "staging-public-group" blocks for the release with no entries inside them |
| 45 | 2. Rename the remaining "staging-public-group" blocks for that release to |
| 46 | "staging-public-group-final" |
| 47 | 3. Cut them out this file and place at the bottom of public-final.xml; also move the |
| 48 | "Resources added in version ? of the platform" header |
| 49 | 4. Copy-paste all of the non-"removed_" resources outside of the staging blocks into being |
| 50 | siblings alongside them |
| 51 | 5. Assign them final public IDs in the form of |
| 52 | <public type="attr" name="exampleAttrName" id="0x0101088a" /> |
| 53 | by finding the last ID for that type and incrementing the last 4 characters by 1 in |
| 54 | hexadecimal |
| 55 | 6. Back in this file, seed the next release's resources by adding "staging-public-group" |
| 56 | tags with their "first-id" value shifted by -0x00010000 from the lowest "first-id" |
| 57 | in the last used "staging-public-group-final" |
| 58 | |
| 59 | Example: |
| 60 | Starting public-staging.xml: |
| 61 | <!\- =============================================================== |
| 62 | Resources added in version ? of the platform |
| 63 | =============================================================== -\> |
| 64 | <eat-comment /> |
| 65 | |
| 66 | <staging-public-group type="attr" first-id="0x01ff0000"> |
| 67 | <public name="exampleAttr1"/> |
| 68 | <public name="removed_exampleAttr2"/> |
| 69 | <public name="exampleAttr3"/> |
| 70 | </staging-public-group> |
| 71 | |
| 72 | <staging-public-group type="id" first-id="0x01fe0000"> |
| 73 | </staging-public-group> |
| 74 | |
| 75 | Resulting public-final.xml: |
| 76 | <!\- =============================================================== |
| 77 | Resources added in version ? of the platform |
| 78 | =============================================================== -\> |
| 79 | <eat-comment /> |
| 80 | |
| 81 | <staging-public-group-final type="attr" first-id="0x01ff0000"> |
| 82 | <public name="exampleAttr1"/> |
| 83 | <public name="removed_exampleAttr2"/> |
| 84 | <public name="exampleAttr3"/> |
| 85 | </staging-public-group-final> |
| 86 | |
| 87 | <public type="id" name="exampleAttr1" id="0x0101088a"/> |
| 88 | <public type="id" name="exampleAttr3" id="0x0101088b"/> |
| 89 | |
| 90 | Resulting public-staging.xml: |
| 91 | <!\- =============================================================== |
| 92 | Resources added in version (? + 1) of the platform |
| 93 | =============================================================== -\> |
| 94 | <eat-comment /> |
| 95 | |
| 96 | <staging-public-group type="attr" first-id="0x01fd0000"> |
| 97 | </staging-public-group> |
| 98 | |
| 99 | <staging-public-group type="id" first-id="0x01fc0000"> |
| 100 | </staging-public-group> |
| 101 | --> |
| 102 | <resources> |
| 103 | |
| 104 | <!-- =============================================================== |
| 105 | Resources added in version U of the platform |
| 106 | |
| 107 | NOTE: After this version of the platform is forked, changes cannot be made to the root |
| 108 | branch's groups for that release. Only merge changes to the forked platform branch. |
| 109 | =============================================================== --> |
| 110 | <eat-comment/> |
| 111 | |
| 112 | <staging-public-group type="attr" first-id="0x01ce0000"> |
| 113 | </staging-public-group> |
| 114 | |
| 115 | <staging-public-group type="id" first-id="0x01cd0000"> |
| 116 | </staging-public-group> |
| 117 | |
| 118 | <staging-public-group type="style" first-id="0x01cc0000"> |
| 119 | </staging-public-group> |
| 120 | |
| 121 | <staging-public-group type="string" first-id="0x01cb0000"> |
| 122 | </staging-public-group> |
| 123 | |
| 124 | <staging-public-group type="dimen" first-id="0x01ca0000"> |
| 125 | </staging-public-group> |
| 126 | |
| 127 | <staging-public-group type="color" first-id="0x01c90000"> |
| 128 | </staging-public-group> |
| 129 | |
| 130 | <staging-public-group type="array" first-id="0x01c80000"> |
| 131 | </staging-public-group> |
| 132 | |
| 133 | <staging-public-group type="drawable" first-id="0x01c70000"> |
| 134 | </staging-public-group> |
| 135 | |
| 136 | <staging-public-group type="layout" first-id="0x01c60000"> |
| 137 | </staging-public-group> |
| 138 | |
| 139 | <staging-public-group type="anim" first-id="0x01c50000"> |
| 140 | </staging-public-group> |
| 141 | |
| 142 | <staging-public-group type="animator" first-id="0x01c40000"> |
| 143 | </staging-public-group> |
| 144 | |
| 145 | <staging-public-group type="interpolator" first-id="0x01c30000"> |
| 146 | </staging-public-group> |
| 147 | |
| 148 | <staging-public-group type="mipmap" first-id="0x01c20000"> |
| 149 | </staging-public-group> |
| 150 | |
| 151 | <staging-public-group type="integer" first-id="0x01c10000"> |
| 152 | </staging-public-group> |
| 153 | |
| 154 | <staging-public-group type="transition" first-id="0x01c00000"> |
| 155 | </staging-public-group> |
| 156 | |
| 157 | <staging-public-group type="raw" first-id="0x01bf0000"> |
| 158 | </staging-public-group> |
| 159 | |
| 160 | <staging-public-group type="bool" first-id="0x01be0000"> |
| 161 | </staging-public-group> |
| 162 | |
| 163 | <staging-public-group type="fraction" first-id="0x01bd0000"> |
| 164 | </staging-public-group> |
| 165 | |
| 166 | </resources> |