summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2011-06-09 11:29:08 -0700
committer Dianne Hackborn <hackbod@google.com> 2011-06-09 15:27:39 -0700
commit426431adcc220b6adfbe1d9530247f897e60fa36 (patch)
treee9dd34ae5151de5bf9f57edb3055d0d228e1f006
parent1d3173c3dc93bb4f2efc5b059fec8e7577b3258a (diff)
Enforce public resource restriction on bag parents.
Need to put some more styles in the SDK to avoid breaking apps. Also, welcome Android 3.2. Change-Id: Ia31d07c9b1b91ad868d8630437fdc1b5ae24f37d
-rw-r--r--api/current.xml321
-rw-r--r--core/java/android/os/Build.java4
-rw-r--r--core/res/res/values/public.xml29
-rw-r--r--include/utils/ResourceTypes.h3
-rw-r--r--libs/utils/ResourceTypes.cpp32
-rw-r--r--packages/SystemUI/res/values/styles.xml8
-rw-r--r--tools/aapt/ResourceTable.cpp5
-rw-r--r--tools/aapt/ResourceTable.h4
8 files changed, 392 insertions, 14 deletions
diff --git a/api/current.xml b/api/current.xml
index 1f5aaf325718..6581042f5074 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -15208,6 +15208,325 @@
visibility="public"
>
</field>
+<field name="TextAppearance_Holo"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974075"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_DialogWindowTitle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974103"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Inverse"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974076"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Large"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974077"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Large_Inverse"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974078"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Medium"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974079"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Medium_Inverse"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974080"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_SearchResult_Subtitle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974084"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_SearchResult_Title"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974083"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Small"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974081"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Small_Inverse"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974082"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974085"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_ActionBar_Subtitle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974099"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_ActionBar_Title"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974098"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_ActionMode_Subtitle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974101"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_ActionMode_Title"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974100"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_Button"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974086"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_DropDownHint"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974091"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_DropDownItem"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974092"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_EditText"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974094"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_IconMenu_Item"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974087"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_PopupMenu"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974095"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_PopupMenu_Large"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974096"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_PopupMenu_Small"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974097"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_TabWidget"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974088"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_TextView"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974089"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_TextView_PopupMenu"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974090"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_Widget_TextView_SpinnerItem"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974093"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="TextAppearance_Holo_WindowTitle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16974102"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="TextAppearance_Inverse"
type="int"
transient="false"
@@ -144465,7 +144784,7 @@
type="int"
transient="false"
volatile="false"
- value="10000"
+ value="13"
static="true"
final="true"
deprecated="not deprecated"
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 3c91d64065fe..6257e957e1d7 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -232,7 +232,7 @@ public class Build {
public static final int HONEYCOMB_MR1 = 12;
/**
- * Current development version.
+ * June 2011: Android 3.2.
*
* <p>Update to Honeycomb MR1 to support 7 inch tablets, improve
* screen compatibility mode, etc.</p>
@@ -244,7 +244,7 @@ public class Build {
* large as the current screen will provide the user with a UI to
* switch them in to screen size compatibility mode.</p>
*/
- public static final int HONEYCOMB_MR2 = CUR_DEVELOPMENT;
+ public static final int HONEYCOMB_MR2 = 13;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index db5f39feb98f..dfa33a6ae57d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1670,5 +1670,34 @@
<public type="style" name="Widget.Holo.Light.ActionBar.TabView" />
<public type="style" name="Widget.Holo.Light.ActionBar.TabText" />
<public type="style" name="Widget.Holo.Light.ActionBar.TabBar" />
+ <public type="style" name="TextAppearance.Holo" />
+ <public type="style" name="TextAppearance.Holo.Inverse" />
+ <public type="style" name="TextAppearance.Holo.Large" />
+ <public type="style" name="TextAppearance.Holo.Large.Inverse" />
+ <public type="style" name="TextAppearance.Holo.Medium" />
+ <public type="style" name="TextAppearance.Holo.Medium.Inverse" />
+ <public type="style" name="TextAppearance.Holo.Small" />
+ <public type="style" name="TextAppearance.Holo.Small.Inverse" />
+ <public type="style" name="TextAppearance.Holo.SearchResult.Title" />
+ <public type="style" name="TextAppearance.Holo.SearchResult.Subtitle" />
+ <public type="style" name="TextAppearance.Holo.Widget" />
+ <public type="style" name="TextAppearance.Holo.Widget.Button" />
+ <public type="style" name="TextAppearance.Holo.Widget.IconMenu.Item" />
+ <public type="style" name="TextAppearance.Holo.Widget.TabWidget" />
+ <public type="style" name="TextAppearance.Holo.Widget.TextView" />
+ <public type="style" name="TextAppearance.Holo.Widget.TextView.PopupMenu" />
+ <public type="style" name="TextAppearance.Holo.Widget.DropDownHint" />
+ <public type="style" name="TextAppearance.Holo.Widget.DropDownItem" />
+ <public type="style" name="TextAppearance.Holo.Widget.TextView.SpinnerItem" />
+ <public type="style" name="TextAppearance.Holo.Widget.EditText" />
+ <public type="style" name="TextAppearance.Holo.Widget.PopupMenu" />
+ <public type="style" name="TextAppearance.Holo.Widget.PopupMenu.Large" />
+ <public type="style" name="TextAppearance.Holo.Widget.PopupMenu.Small" />
+ <public type="style" name="TextAppearance.Holo.Widget.ActionBar.Title" />
+ <public type="style" name="TextAppearance.Holo.Widget.ActionBar.Subtitle" />
+ <public type="style" name="TextAppearance.Holo.Widget.ActionMode.Title" />
+ <public type="style" name="TextAppearance.Holo.Widget.ActionMode.Subtitle" />
+ <public type="style" name="TextAppearance.Holo.WindowTitle" />
+ <public type="style" name="TextAppearance.Holo.DialogWindowTitle" />
</resources>
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index d1d98447436d..0603ed54017e 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -1988,7 +1988,8 @@ public:
String16* outName,
const String16* defType = NULL,
const String16* defPackage = NULL,
- const char** outErrorMsg = NULL);
+ const char** outErrorMsg = NULL,
+ bool* outPublicOnly = NULL);
static bool stringToInt(const char16_t* s, size_t len, Res_value* outValue);
static bool stringToFloat(const char16_t* s, size_t len, Res_value* outValue);
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index a64918d050e5..ecb8c0c2ef08 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -2499,6 +2499,9 @@ uint32_t ResTable::identifierForName(const char16_t* name, size_t nameLen,
goto nope;
}
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return m->id;
nope:
;
@@ -2513,6 +2516,9 @@ nope:
index);
return 0;
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return Res_MAKEARRAY(index);
}
}
@@ -2523,6 +2529,8 @@ nope:
return 0;
}
+ bool fakePublic = false;
+
// Figure out the package and type we are looking in...
const char16_t* packageEnd = NULL;
@@ -2534,7 +2542,13 @@ nope:
else if (*p == '/') typeEnd = p;
p++;
}
- if (*name == '@') name++;
+ if (*name == '@') {
+ name++;
+ if (*name == '*') {
+ fakePublic = true;
+ name++;
+ }
+ }
if (name >= nameEnd) {
return 0;
}
@@ -2639,6 +2653,9 @@ nope:
if (dtohl(entry->key.index) == (size_t)ei) {
if (outTypeSpecFlags) {
*outTypeSpecFlags = typeConfigs->typeSpecFlags[i];
+ if (fakePublic) {
+ *outTypeSpecFlags |= ResTable_typeSpec::SPEC_PUBLIC;
+ }
}
return Res_MAKEID(group->id-1, ti, i);
}
@@ -2655,7 +2672,8 @@ bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen,
String16* outName,
const String16* defType,
const String16* defPackage,
- const char** outErrorMsg)
+ const char** outErrorMsg,
+ bool* outPublicOnly)
{
const char16_t* packageEnd = NULL;
const char16_t* typeEnd = NULL;
@@ -2672,6 +2690,16 @@ bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen,
p = refStr;
if (*p == '@') p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = true;
+ }
+ if (*p == '*') {
+ p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = false;
+ }
+ }
+
if (packageEnd) {
*outPackage = String16(p, packageEnd-p);
p = packageEnd+1;
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 86ffb4d1ea06..91a8855e3684 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -16,25 +16,25 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="TextAppearance.StatusBar.Title" parent="@android:style/TextAppearance.StatusBar">
+ <style name="TextAppearance.StatusBar.Title" parent="@*android:style/TextAppearance.StatusBar">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="TextAppearance.StatusBar.IntruderAlert"
- parent="@android:style/TextAppearance.StatusBar">
+ parent="@*android:style/TextAppearance.StatusBar">
</style>
<style name="TextAppearance.StatusBar.SystemPanel"
- parent="@android:style/TextAppearance.StatusBar">
+ parent="@*android:style/TextAppearance.StatusBar">
<item name="android:textAppearance">?android:attr/textAppearance</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#FF808080</item>
</style>
<style name="TextAppearance.StatusBar.TextButton"
- parent="@android:style/TextAppearance.StatusBar">
+ parent="@*android:style/TextAppearance.StatusBar">
<item name="android:textAppearance">?android:attr/textAppearance</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#FFFFFFFF</item>
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 68c38928882e..d98b285dd1e3 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1963,10 +1963,11 @@ uint32_t ResourceTable::getResId(const String16& ref,
bool onlyPublic) const
{
String16 package, type, name;
+ bool refOnlyPublic = true;
if (!ResTable::expandResourceRef(
ref.string(), ref.size(), &package, &type, &name,
defType, defPackage ? defPackage:&mAssetsPackage,
- outErrorMsg)) {
+ outErrorMsg, &refOnlyPublic)) {
NOISY(printf("Expanding resource: ref=%s\n",
String8(ref).string()));
NOISY(printf("Expanding resource: defType=%s\n",
@@ -1979,7 +1980,7 @@ uint32_t ResourceTable::getResId(const String16& ref,
String8(name).string()));
return 0;
}
- uint32_t res = getResId(package, type, name, onlyPublic);
+ uint32_t res = getResId(package, type, name, onlyPublic && refOnlyPublic);
NOISY(printf("Expanded resource: p=%s, t=%s, n=%s, res=%d\n",
String8(package).string(), String8(type).string(),
String8(name).string(), res));
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index bbb81408c830..734c541f9b61 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -162,13 +162,13 @@ public:
uint32_t getResId(const String16& package,
const String16& type,
const String16& name,
- bool onlyPublic = false) const;
+ bool onlyPublic = true) const;
uint32_t getResId(const String16& ref,
const String16* defType = NULL,
const String16* defPackage = NULL,
const char** outErrorMsg = NULL,
- bool onlyPublic = false) const;
+ bool onlyPublic = true) const;
static bool isValidResourceName(const String16& s);