History log of /frameworks/base/core/java/android/content/res/Resources.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ac3e0e590a7b425af20e2ac70569ced789155dde 24-Jun-2016 Adam Lesinski <adamlesinski@google.com> Update DisplayMetrics when resizing

Previously the DisplayMetrics passed to a new ResourcesImpl
object would be generated from the default DisplayAdjustments.
We now use the correct DisplayAdjustments for the ResourcesImpl
and make sure to update them for things like rotation changes.

Bug:29619314
Change-Id: If2ba0d7670a4554dcd3fde9766e2337f20a191fd
(cherry picked from commit 8e8d23214a71d8813ebd3676b192924c530cb913)
/frameworks/base/core/java/android/content/res/Resources.java
4ece3d6bb18a609afcd0e82f0340b7d36ba24eea 17-Jun-2016 Adam Lesinski <adamlesinski@google.com> ContextImpl: Keep DisplayAdjustments and Display in sync

Make sure that when our Resources get updated, that DisplayAdjustment
and Display properly reflect the potentially new screen dimensions.

Bug:28388969
Change-Id: I340550ea094ece87abc8790dd46aaa60ab3cedd3
/frameworks/base/core/java/android/content/res/Resources.java
4b2b615669edf0cb3e2b1dbf3116281477e1f0b7 08-Jun-2016 Alan Viverette <alanv@google.com> Return correct default theme on API >= 24

This method was broken, but it was returning light theme on N preview
builds, so we'll keep it consistent as we move into N release.

Bug: 29192690
Change-Id: I0d16abbe48756070dcd653c39d0da4124ea66b28
/frameworks/base/core/java/android/content/res/Resources.java
952802e2d1ccfd93c6640de512105f4e400ce473 04-Apr-2016 Alan Viverette <alanv@google.com> Fix bad workaround docs in Resources.getDrawable()

The real solution is to use ContextCompat, but we can't reference support
library from framework. C'est la vie.

Bug: 27727320
Change-Id: Ib9bcd5f2bdce1996f02fd44877df9ba202b26edc
/frameworks/base/core/java/android/content/res/Resources.java
e03c469fd416cf68c9d27268140f058028cd8666 17-Mar-2016 Teng-Hui Zhu <ztenghui@google.com> API review: Hide ComplexColor and GradientColor

b/27532267

Change-Id: I01582e067ec8f4897c34dcec0f7c14700c40e02b
/frameworks/base/core/java/android/content/res/Resources.java
082614c6a57a115ee0c5975e3579bf34a178c0f8 04-Mar-2016 Adam Lesinski <adamlesinski@google.com> Cache per-Activity Resources objects

Each Activity has a Resources object whose underlying state changes
when a configuration change occurs, both global and for that activity only (multi-window).
Views and other clients of the Resources object can safely cache it knowing that
they always have a reference to the most up-to-date resources.

This applies to Resources.Theme objects as well.

Bug:26854894
Change-Id: Ifd3da5a1086e17f747dfc265a447fe92a3a5c692
/frameworks/base/core/java/android/content/res/Resources.java
fb302ccd8e0610a09691ea5503ff8111dc7a2e41 01-Mar-2016 Adam Lesinski <adamlesinski@google.com> Move the guts of Resources to ResourcesImpl

In order to satisfy the requirement that clients can
cache a Resources object when a configuration change happens,
we move the caches and all other method bodies to ResourcesImpl.
These can then be swapped out for the correct version when needed,
while allowing clients to keep holding the existing Resources references.

This is part 1 of 2 CLs. The next one will do the actual switching of implementations
based on configuration changes for multiwindow.

Bug:26854894
Change-Id: I41156194a3541e59053b4048c3a15981c7d8a506
/frameworks/base/core/java/android/content/res/Resources.java
5c64b957dd710cce27134cd480e0b83563c50d7f 28-Feb-2016 Alan Viverette <alanv@google.com> Use asset cookie in XML block cache key

Ensure we're using file paths from the correct package. Also cleans up
synchronization to avoid synchronizing on local variables which, while
not an issue in the current implementation, is generally unsafe.

Bug: 27313689
Change-Id: Ib8550909e7b02ea88d19ce2fc43756a16f9664ab
/frameworks/base/core/java/android/content/res/Resources.java
fde021371668fa8feb62569af155efeecda18026 23-Feb-2016 Alan Viverette <alanv@google.com> Remove @Nullable annotation from getDrawable() methods

Developers usually do not need to check the result of getDrawable(), so
we shouldn't be annotating it like they do.

Bug: 27134828
Change-Id: I0db0ca806fd89c18781da452fe3f31ef344f3cca
/frameworks/base/core/java/android/content/res/Resources.java
fee44846376c212114223fc4259382921e6dca7a 05-Feb-2016 Roozbeh Pournader <roozbeh@google.com> Various LocaleList cleanups

- Remove the LocaleList#getPrimary() API. It had become confusing
after locale negotiation was completely implemented. For example,
it could create the confusion that calling getPrimary() on the
default locale list would provide the default locale, etc.
- Use the adjusted locale list from LocaleList.getAdjustedDefault()
in Paints created with no locale list provided.
- Change LocaleList#get() to treat out of bound indexes from both
negative indexes and too large indexes the same way.

Bug: 26984092
Bug: 26193251
Bug: 26834387
Change-Id: I75f77aea6b75e38793ed8477e5e5a4420d5e6d85
/frameworks/base/core/java/android/content/res/Resources.java
dbee9bb342cdfaa5155b1918f90262c05e2464cb 15-Dec-2015 Teng-Hui Zhu <ztenghui@google.com> Gradient for VectorDrawable's fill and stroke

Add ComplexColor interface for both GradientColor and ColorStateList.
Set up constant state, factory, theme attrs for GradientColor, while
refactoring the ColorStateList's similar code. (Functionality in CSL should
be the same).

Support themeing in both the root and item level in GradientColor.
For example, both startColor in <gradient> tag or color in <item> tag can
have theme color.
Add tests for both simple and complex cases with themeing etc.

Hook up the native VectorDrawable implementation using 2 extra JNI calls for
simplicity. Such calls only happen at inflate and applyTheme call.

b/22564318

Change-Id: Ibdc564ddb4a7ee0133c6141c4784782f0c93ce0e
/frameworks/base/core/java/android/content/res/Resources.java
834641b3908b21e7054c290e116d76e3d5e6888c 24-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Move locale negotiation to ResourcesManager

Previously, locale resolution happened at Resources level, which
could result in different Resources in the same app using different
locales.

This change moves the locale negotiation to ResourcesManager, which
remembers the locales supported by each Resources as they are
created, and negotiates the locale based on their union.

It also makes sure that the old model of apps getting the default
locale by accessing it through the Configuration's locale attribute
continues to work, since the negotiated locale will be moved to the
top of the list before Resources are created and when they are
updated with a Configuration change.

Bug: 25800576
Bug: 26404653
Change-Id: I0dd81df288327fd8d1229188c9544ee2209c161a
/frameworks/base/core/java/android/content/res/Resources.java
1f0945e9f6fc81f5c58da24a29c86e1efa2714ef 20-Jan-2016 Raph Levien <raph@google.com> Update mResolvedLocale more aggressively

A client that mutates the locale of the Configuration being updated
can cause failure of the test that mResolvedLocale needs to be
recomputed. This patch stashes the previous locale list privately
so that updates can be detected even in this case.

Bug: 25993843
Change-Id: I1ea17dffd722177fb5b65ee77b9f5ce9a943f15b
/frameworks/base/core/java/android/content/res/Resources.java
946502f50a4e4d757df03e16bcc72f21db487a43 06-Jan-2016 Alan Viverette <alanv@google.com> Merge "Cache XML blocks against file name rather than resource ID"
ec76b2a1d8c14dc01986d86718dae3acf6a09288 06-Jan-2016 Alan Viverette <alanv@google.com> Merge "Skip the cache when loading drawables from a foreign density"
10979613899ca3963c7d64d25d5f8ef7db1dde84 06-Jan-2016 Alan Viverette <alanv@google.com> Cache XML blocks against file name rather than resource ID

Caching against resource ID leads to incorrect cache hits, since multiple
files (ex. within drawable-mdpi, drawable-ldpi) may map to the same ID.

Also adds nullability annotations.

Bug: 26400880
Change-Id: I4d83caf3c44dc9b546511753e9e72171e8850eb2
/frameworks/base/core/java/android/content/res/Resources.java
7941a7fd8e2976922172ef28106b803caa49d7d1 06-Jan-2016 Alan Viverette <alanv@google.com> Skip the cache when loading drawables from a foreign density

Bug: 26400880
Change-Id: I87c06b30afc61495fe62aa6a9dfe77990200cde7
/frameworks/base/core/java/android/content/res/Resources.java
fb9236cb0c7bdad05ad01b722806edde7385b296 16-Dec-2015 Roozbeh Pournader <roozbeh@google.com> For locale negotiation, assume English is always supported

In practice, a lot of apps provide English resources as their default
resources, so assume that English is always supported.

With this change, users can safely set secondary locales after
English in their preferred locale lists. Such settings would help
the apps (and parts of the system that are aware of multiple locales)
consider the user's familiarity with the secondary locale or the
user's preference for glyphs forms in the secondary locale. This
change makes sure that no app unintentionally switches to such
secondary locales.

Note that this doesn't break from the tradition of previous releases.
Traditionally, if the user had set the system locale to English, they
would get the default resources when the app didn't explicitly
provide English resources. This will continue to be the case where
the user's locale list has English in it before another supported
language. (English will be the first locale in most cases.)

Bug: 26192817
Change-Id: I2c1a003760299157786c1b3f9fb116ce18db3b8c
/frameworks/base/core/java/android/content/res/Resources.java
1c686f2ce6cbfa3fdb598f452aa31d38f3eb2320 18-Dec-2015 Roozbeh Pournader <roozbeh@google.com> Avoid matching system locales in locale negotiation

Also:
1. Add AssetManager method for finding non-system locales: This is
used in per-app locale negotiation. (Normally,
AssetManager#getLocales() returns both system and non-system
locales.)

2. Match pseudolocales correctly in locale negotiation.

Bug: 25800576
Bug: 26236938
Change-Id: I116caf3a91c290deb4ad68b291c65b7035b18dd4
/frameworks/base/core/java/android/content/res/Resources.java
dad100699a8cb2537d8a4ec1d1c3df9aaff6a6eb 15-Dec-2015 Roozbeh Pournader <roozbeh@google.com> Negotiate locales during Resources contruction and updates

This also adds a new API to Resources, to get the resolved locale
from the Resources.

Bug: 25800576
Change-Id: I431f1c1b4b6775fcbc097936d0d607400db47f7d
/frameworks/base/core/java/android/content/res/Resources.java
1168548de3e8a5df514c7758da9e3d860f58b948 09-Dec-2015 Roozbeh Pournader <roozbeh@google.com> Merge "Fix null locale edge cases in Configuration and Resources"
c078c605ab904b0e4a5d793cbeffd78c340f2816 08-Dec-2015 Alan Viverette <alanv@google.com> Attach drawable resource ID and name to getDrawable() exceptions

Wraps the entire getDrawable() method in a try/catch block. Clears the
stack trace from the re-thrown exception, since we only need the trace
from the original exception.

Also clears stack traces from re-thrown RuntimeExceptions in applyTheme
implementations.

Change-Id: I92396abf9e748eef78777174b297a09e118f5e70
/frameworks/base/core/java/android/content/res/Resources.java
8a412e0bb76e22d65cb2e3de1eff9945e502ecc3 03-Dec-2015 Roozbeh Pournader <roozbeh@google.com> Fix null locale edge cases in Configuration and Resources

Previously, Configuration#setTo() would not copy a null locale, and
Resources#updateConfiguration() could fail if it was updated with a
configuration with a null locale or empty locale list.

Bug: 25874762
Change-Id: I76ef5769a16a5165b91c8e5ec5d926c67ef4f3c5
/frameworks/base/core/java/android/content/res/Resources.java
4d07bc99f014dfa112f635148cc2fbb3d73e983e 16-Nov-2015 Alan Viverette <alanv@google.com> Clean up usage of temporary TypedValue in Resources

Reduces the amount of time that a lock is held and reduces the scope of
the lock to only manage the temporary TypedValue. Also ensures that the
typed value is consistently returned to the (single item) pool.

Additionally, performs some refactoring:
- removes unused variables and constants
- moves the NotFoundException cause into the constructor for consistency
with other Exceptions
- inlines sPreloadedDensity which was not used anywhere
- fixes line wrapping and indentation in nearby code

Aside from improvements to locking, there are no functional changes in
this CL.

Change-Id: I8c3059261e3cc2288a086e6637ab946e0b7d3741

Clean up usage of temporary TypedValue in Resources

Reduces the amount of time that a lock is held and reduces the scope of
the lock to only manage the temporary TypedValue. Also ensures that the
typed value is consistently returned to the (single item) pool.

Additionally, performs some refactoring:
- removes unused variables and constants
- moves the NotFoundException cause into the constructor for consistency
with other Exceptions
- inlines sPreloadedDensity which was not used anywhere
- fixes line wrapping and indentation in nearby code

Aside from improvements to locking, there are no functional changes in
this CL.

Change-Id: I8c3059261e3cc2288a086e6637ab946e0b7d3741
/frameworks/base/core/java/android/content/res/Resources.java
47571c76afadc23b8c2b4407a960e427e9db2472 01-Sep-2015 Roozbeh Pournader <roozbeh@google.com> Add LocaleList support to content.res.Resources.

Also remove the adjustLocales() method, since it's no longer possible
to create non-adjusted Locale objects using the public API.

The implementation is still in progress: currently only the first
locale in the list is passed down to the native code.

(Also fix the order of imports based on Android style.)

Change-Id: I325d7a2c0d86a9bf5cd202081f0b02299660364a
/frameworks/base/core/java/android/content/res/Resources.java
02fc5fef36357467eba22a0ee250a96734daf791 27-Aug-2015 Alan Viverette <alanv@google.com> Extract drawable inflation to its own class, inflate from class name

Bug: 22627299
Change-Id: Icd2ac88af4f3102e08e52f6f0f7565839da6437a
/frameworks/base/core/java/android/content/res/Resources.java
395cd017e66b81f9b223f5310cce9b827d156b4c 11-Aug-2015 Alan Viverette <alanv@google.com> Rebase system theme on configuration change

Also makes native theme accesses thread-safe to avoid a race condition
when modifying the theme off the UI thread. Since drawable loading can
occur off the UI thread, we need to ensure Theme access is thread-safe
anyway.

This reverts commit c12ec70def2a5682c6cd7fdb3adaa82cc34d5bf6.

Change-Id: If8fecde76d62738a8e55eddf898eafc468afdba2
/frameworks/base/core/java/android/content/res/Resources.java
2349332f9f69189d7889692b9aafd6f80070e352 30-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Only relaunch activity on significant size configuration changes.

Currently if the configuration width/height/smallest width changes, we
relaunch the activity or invoke onConfigurationChanged callback. When it
comes to size based configuration changes it might not be necessary: if
the size change doesn't pass one of the threshold defined by the
resources, it means there is no need to relaunch the activity.

In this CL the ActivityManager will receive the thresholds from the
application and use them to decide, whether to relaunch the activity.
The application reads the thresholds from the resources, specifically
from resource qualifiers used by the app.

Change-Id: Ie3cf0a172dc1ba0b865cf30c2962e7cfd9ad8436
/frameworks/base/core/java/android/content/res/Resources.java
1913dc11b1bd6d23a13949f9bfa34ca3029d90a8 17-Jul-2015 Neil Fuller <nfuller@google.com> resolved conflicts for merge of 71165ea6 to mnc-dr-dev-plus-aosp

Change-Id: I21f2f14186965bdfc66ed3a2e6957d613837e138
b27b3057687fa6dda8f10d6661eef200f44fdfdf 15-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Migrate Resources.java to use ICU4j drectly.

This change means that NativePluralRules can be removed in its entirety
because this is the only usage of that class.

Using a small benchmark from the NativePluralResources test, ICU4c code
takes 38.6 us and ICU4j code takes 49.2us to execute.

Change-Id: I5dbf643807c024a9c9c0f1292363fa8e39db965a
/frameworks/base/core/java/android/content/res/Resources.java
4feb3260152b2ddbd4a96c43c09cd1ed3cf2d3fb 13-Jul-2015 John Reck <jreck@google.com> Improve resource loading by ~3x

Bug: 22392651

ColorStateLists were never cached because the lazy-create
of the constant state had a typo.

Resource caching in general was broken because ThemeKey did not
clone the hash code, so all keys in the cache had a hashCode
of 0 which did not match the real, uncloned ThemeKeys hash code
so the binary search in ArrayMap based off of hash code was failing.

Change-Id: I9df1628b226bfa797bed97875354c19bf64f41ad
/frameworks/base/core/java/android/content/res/Resources.java
0f1c95edf8c14ad16b96f350b5507664fccc2ba0 05-Jun-2015 Alan Viverette <alanv@google.com> Avoid NPE when drawable fails to load

Bug: 17760671
Change-Id: I99364e915e318b3e49fc758811784939a937de7c
/frameworks/base/core/java/android/content/res/Resources.java
ac67409582aafd7c3f3f58a79b7b3292221a88b8 08-May-2015 Alan Viverette <alanv@google.com> Use correct array index for Theme.getTheme()

Change-Id: Ic462a7b8a81bb87bf08136bb30e3432f10269918
/frameworks/base/core/java/android/content/res/Resources.java
0d857b9028f2702ce439e13feccde8182d40e1e5 22-Apr-2015 Siva Velusamy <vsiva@google.com> Improve hierarchy viewer dump hierarchy latency

Hierarchy Viewer obtains the properties for each view by using
reflection and looking for fields and methods that have the
@ExportedProperty annotation. Using reflection made it quite slow
for large view hierarchies.

This CL adds a new method (encode) to each class that wishes to
export data to hiererachy viewer. Inside this method, the object
can write a sequence of key, value pairs corresponding to the
values it wants exported.

With this change, the dump hierarchy operation that used to take
more than 10 seconds can be performed in a few hundred milliseconds.

Change-Id: I199ac2e7ca3c59ebcfec7e6bd201e134c41fd583
/frameworks/base/core/java/android/content/res/Resources.java
e54d245b993e1347cb32c23a6bdc907a45fab324 06-May-2015 Alan Viverette <alanv@google.com> Improve keying for theme caches, rebase system theme on config change

Themes now use an array of applied styles rather than a String to store
their history. They are keyed based on a hash code computed from the
history of applied styles. The themed drawable cache has been abstracted
out into its own class.

Also updates system context to use DayNight as the default and ensures
that GlobalActions uses the correct context, which exercises the change.

CTS tests have been added in another CL.

Bug: 20421157
Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
/frameworks/base/core/java/android/content/res/Resources.java
c1d527926e1c82828e42bdc0c7abf50f6decc0a7 05-May-2015 Alan Viverette <alanv@google.com> Add API for obtaining changing configurations bitmask from Theme

Required to know when to reload the system context's theme in response
to configuration changes, and thus needed to support the DayNight theme.

Bug: 20267825
Change-Id: I7df5e28b7a6d8b611ea030032544cf4800788514
/frameworks/base/core/java/android/content/res/Resources.java
b4004dfc84b7c51519645020ea9431b051f5db62 30-Apr-2015 Alan Viverette <alanv@google.com> ActionBar SearchView's default hint shouldn't override SearchableInfo

Moves the queryHint to defaultQueryHint, specifies the override order
as queryHint > SearchableInfo > defaultQueryHint.

Cleans up annotations and comments for several related methods.

Bug: 20614122
Change-Id: Ib58ec309e6814cd512df147d789ec0cd546018af
/frameworks/base/core/java/android/content/res/Resources.java
863ba4c4bfdf1e1f701ec85c078aa80ba4d67e83 06-Apr-2015 Alan Viverette <alanv@google.com> Merge "Unify drawable caches"
2a53812cfad79e136a92d7a33a0dcab7ac063758 03-Apr-2015 Tor Norbye <tnorbye@google.com> Merge "Fix resource type annotations for obtainStyledAttributes"
c91531a863d65e4a74fa30ac9a20d02ccd31f5ca 02-Apr-2015 Tor Norbye <tnorbye@google.com> Fix resource type annotations for obtainStyledAttributes

Change-Id: I7681249ff46d687675d0dcd7d4f077646efba687
/frameworks/base/core/java/android/content/res/Resources.java
4325f8e02a6aff999a11ad711d9e8aecc59c4ae2 02-Apr-2015 Alan Viverette <alanv@google.com> Unify drawable caches

Drawables that don't need a theme are now stored in a separate cache,
rather than storing a separate copy in each theme-specific cache.

Bug: 19992973
Change-Id: I98a67ea480af3d381469303439f4aea44ba1e909
/frameworks/base/core/java/android/content/res/Resources.java
e0f95f39c5a669a48ee3ebb8dc45bf2d7ee940f1 01-Apr-2015 Alan Viverette <alanv@google.com> Fix issues with theming of preloaded ColorStateLists

Ensures changing configurations mask is propagated to the host drawable
so that it can be properly cleared from cache on configuration changes.
Also fixes constant state handling of the mask in the Inset and Rotate
drawables.

Hides new ColorStateList methods related to theming, since they should
only be used during preloading or internally by framework drawables.

Fixes bug where the cached versions of themeable ColorStateLists were
modified by calling applyTheme() on the host drawable.

Also cleans up some docs and naming in GradientDrawable.

Bug: 19966397
Change-Id: I8c8d3cabbaf94b488c2b8fe9fd423e07d824c19c
/frameworks/base/core/java/android/content/res/Resources.java
a8636c9414d02e80998b538ceb2726c8f2c68fd0 27-Mar-2015 Alan Viverette <alanv@google.com> Clean up lint warnings in Resources

Change-Id: I28dff6f293c5b6c24fc451f282d11d648042d5dd
/frameworks/base/core/java/android/content/res/Resources.java
4a357cd2e55293402d7172766f7f9419815fc1e8 19-Mar-2015 Alan Viverette <alanv@google.com> Replace usages of deprecated Resources.getColor() and getColorStateList()

Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
/frameworks/base/core/java/android/content/res/Resources.java
80756e38882720860db52f1fcc21fa1505a02abf 02-Mar-2015 Tor Norbye <tnorbye@google.com> Annotate ARGB integer parameters with @ColorInt

Change-Id: I307f72a382272cf18ddb6b07d9fcb81228568d9a
/frameworks/base/core/java/android/content/res/Resources.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/core/java/android/content/res/Resources.java
7b9c912f536925ac6ec43935d6e97506851b33d6 31-May-2013 Tor Norbye <tnorbye@google.com> Add @ResourceInt annotations on APIs

Change-Id: I119cc059c2f8bd98fd585fc84ac2b1b7d5892a08
/frameworks/base/core/java/android/content/res/Resources.java
60454dbc4d815c90ff2713e224953d6547fc3ad5 24-Jan-2015 Wale Ogunwale <ogunwale@google.com> Support activities in the same process having different resources.

Activities can be of various sizes in a multi-window environment.
This change allows them to have override configurations that allows
different resources to the loaded if needed.

Bug: 19002213
Change-Id: Ib2c7be0b427f5ce05e7a362bcdd496ddbc9164f0
/frameworks/base/core/java/android/content/res/Resources.java
6bbb47b7d5ac1b49d916679e5f081fe181d8f162 06-Jan-2015 Alan Viverette <alanv@google.com> Clean up TypedArray docs & formatting, remove coercion warnings

Establishes a clear contract regarding when exceptions will be thrown,
when default values will be returned, and when values will be coerced
to a different type.

Since we have both getInt() and getInteger() where one handles coercion
without throwing an exception, it seems reasonable that we should clearly
document the behavior so that developers can make an informed decision.
Once we document the behavior, there is no reason to log warnings on
coercion. If a developer chooses to use a particular API or data type,
that is still correct according to the API.

BUG: 18625719
Change-Id: I385f0b719182d3c0358943e1d6c3d7bedc756eb5
/frameworks/base/core/java/android/content/res/Resources.java
304ea5aac77cae03b4e8440a7c73c18086d96a20 06-Jan-2015 Alan Viverette <alanv@google.com> Merge "Allow use of theme attributes in color state lists"
45c4bbbbce6bbad50a033efcba7948a23f1f117a 05-Jan-2015 Alan Viverette <alanv@google.com> Allow use of theme attributes in color state lists

BUG: 17384842
Change-Id: Ibdc413acbd00e37b908432abd55f6521c22b8fc9
/frameworks/base/core/java/android/content/res/Resources.java
d6ebb3a75ef9c87ff5294462dc0637ca802d1e59 05-Jan-2015 Alan Viverette <alanv@google.com> Remove null entries from constant state cache

We insert null entries on cache miss, which can cause NPE on prune, but
we ought to remove these entries during prune.

BUG: 18842826
Change-Id: I9c0bca04f34575d1403de943abd8d12b18c9c032
/frameworks/base/core/java/android/content/res/Resources.java
c4ec5b633e6162cbe9bb00b8f90ae89b871b9fbf 17-Dec-2014 Jeff Sharkey <jsharkey@android.com> Iterate based on index, not key.

Bug: 18785949
Change-Id: I5d92fedac9f71b997f87f7035635fde276756faa
/frameworks/base/core/java/android/content/res/Resources.java
9267fda30c73558d4fddfc8e1834782498af742b 08-Dec-2014 Alan Viverette <alanv@google.com> Prune the resource cache before adding new caches

BUG: 18666986
Change-Id: I5f7e4983100c2d5e4478a4d82c21bb59fa87810e
/frameworks/base/core/java/android/content/res/Resources.java
a6f8b2ce552debde1f8a1ea673d689f96c56d67b 03-Dec-2014 Alan Viverette <alanv@google.com> Deprecate one-arg getDrawableForDensity, update currents.txt

BUG: 18579576
Change-Id: I7df6ec2952ab121e2be8ae0a016ccf36f6fba2ff
/frameworks/base/core/java/android/content/res/Resources.java
c10e3960d9107f8663daa842ac57dedded4736e3 02-Dec-2014 Alan Viverette <alanv@google.com> Deprecate Resources.getDrawable(int) in favor of the two-arg version

This is a landmine for developers. If they need to obtain an unthemed
drawable, they should be using an explicit null theme.

BUG: 18579576
Change-Id: Ibca6b4c3e8e50dca144571244e035caec6fa91f8
/frameworks/base/core/java/android/content/res/Resources.java
7e0aaae3db11e0f23dca8c4cddff261f0132266c 24-Nov-2014 Alan Viverette <alanv@google.com> Check for null drawable in theme-less getDrawable()

BUG: 18507509
Change-Id: I64e2950dc3a30f3979ec179789a6f6e055c9f86d
/frameworks/base/core/java/android/content/res/Resources.java
7f4a63d1ebc13c6499a48331ecb78c4d27446dbc 30-Oct-2014 Alan Viverette <alanv@google.com> Ensure we don't pass null values in to Theme.resolveAttributes

BUG: 18182274
Change-Id: I08acf877cb81478cc205254edf92a31fcf05991d
/frameworks/base/core/java/android/content/res/Resources.java
d422dc358f0100106dc07d7b903201eb9b043b11 25-Sep-2014 Yigit Boyar <yboyar@google.com> Added a generic configuration and theme based cache

For now, only animators use it but we can consider migrating
drawable cache to it as well.

Bug: 17456416
Change-Id: I571b96856805edb171f0fc52e6bff5a365f46b70
/frameworks/base/core/java/android/content/res/Resources.java
727cae197b123ef764a1f8fbe08a995b000d14c3 08-Oct-2014 Alan Viverette <alanv@google.com> Mutate and apply theme if needed before caching themed drawables

This ensures that drawables are completely separated from their cached
constant states before applying a theme. After this, we can remove the
implicit (and incomplete) mutation in the clone constructors.

Also implements missing mutate() method on ClipDrawable.

BUG: 17646144
Change-Id: If0d66b0a85724d76e0a4f506758c7ba3c0aa3410
/frameworks/base/core/java/android/content/res/Resources.java
8b5b25b4487e22eb8a7dae32ee32f420210321a0 14-Sep-2014 Alan Viverette <alanv@google.com> Reduce instructions required to obtain and recycle TypedArray

Eliminates several field and method accesses by making the TypedArray
pool local to a single Resources object. Removes an unnecessary
synchronization.

ReadXmlAttrs averaged 0.069 ms/op before, 0.064 ms/op after.

BUG: 17484798
Change-Id: If790a5ba6596b47a04f117c8912974798a592052
/frameworks/base/core/java/android/content/res/Resources.java
042ad633bc68bdda2bb0c50216706d73575a5992 04-Sep-2014 Jon Miranda <jonmiranda@google.com> Added getStyleAttributes to access all Theme attributes.

ViewDebug uses getStyleAttributes to get the attributes, and then gets the
attribute name and value so that Hierarchy Viewer can display it.

Bug: 17407087
Change-Id: I3577e32ae99668383701dc908bb46db14a75c3c4
/frameworks/base/core/java/android/content/res/Resources.java
836c0a8b949d71293c996761691e065f0651acef 11-Aug-2014 Jon Miranda <jonmiranda@google.com> Exposes style and theme data, adds developer option.

Adds support for a String[] return type in ViewDebug; and in addition to that,
the hasAdjacentMapping method can use the String array as means to map a key to
its value.

Adds DEBUG_VIEW_ATTRIBUTES to Settings so that the heavy per-view
computations only affect those who opt in. This setting is used in
CoreSettingsObserver to avoid impacting start time.

Change-Id: I8f507e4e5361414c30d247e8d9815205feb5e91f
/frameworks/base/core/java/android/content/res/Resources.java
34a14f967ab6c88829c9a36ce6e909c47b3ee398 16-Aug-2014 Alan Viverette <alanv@google.com> Better handling of unresolved theme attributes

Also adds a (very obviously wrong) default color to RippleDrawable

Change-Id: I6d29b371f4e59accbebf25eb059b1f372b9184b0
/frameworks/base/core/java/android/content/res/Resources.java
b1e1dbfb36b658bd2710fedf8c0381a5d89fa302 08-Aug-2014 Alan Viverette <alanv@google.com> Update disabled states to be less opaque

Also adds Resources method for retrieving floating-point values.

BUG: 16374059
Change-Id: I68c6a40cbe5badfad624548b9abf2d657dbc2019
/frameworks/base/core/java/android/content/res/Resources.java
4c6ce23816acdede6eb589cba07916a5340d0a38 18-Jul-2014 Narayan Kamath <narayan@google.com> Remove copy of Locale.adjustLanguageCode.

(cherry picked from commit 1d31a5f8243fd6befb14d8a2ba25d28e006511f8)

Change-Id: I7b30a153a44dc1f99a9ddfe256b770d7305a74b7
/frameworks/base/core/java/android/content/res/Resources.java
5cd9dde5a2a77c5095f985186d8f03147fd22870 15-Jul-2014 Deepanshu Gupta <deepanshu@google.com> Support Locale.toLanguageTag on Java 6

Change-Id: I255e79e2c288cd24b350b7c26128bbbb0b2cb9a3
/frameworks/base/core/java/android/content/res/Resources.java
b6f9152b7027e78c7c0c07b1dc10ca4900b1fca7 03-Jun-2014 Alan Viverette <alanv@google.com> Fix drawable cache, add quantum assets to preload list

BUG: 15409352
Change-Id: Idb18fd99dc4229aace9082d6e26c88faf81d15bf
/frameworks/base/core/java/android/content/res/Resources.java
6dbe51b50e82057af4d29882889444d22ac19c9c 03-Jun-2014 Alan Viverette <alanv@google.com> Clean up drawable theming APIs

Removes APIs for themed creation of a drawable from a stream, since
that doesn't involve any inflation. Also cleans up tinting methods
left over from previous clean up.

BUG: 15089957
Change-Id: I2af7aa9a6d351ae61b33ee1216c674fae1bffe11
Signed-off-by: Alan Viverette <alanv@google.com>
/frameworks/base/core/java/android/content/res/Resources.java
75257cefcd64cf5cc73083d9546d27825b29a595 23-May-2014 Alan Viverette <alanv@google.com> Handle hybrid themes correctly in Drawable cache

BUG: 15155868
Change-Id: I00326e6000027c2dae5305e816c80883119449c0
/frameworks/base/core/java/android/content/res/Resources.java
3b5c4272db3e089c4a06d2db2ddf2aee5ebb6281 20-May-2014 Alan Viverette <alanv@google.com> Various API review fixes to resources and drawables

BUG: 15025565
Change-Id: If00c85816f8288338967f7a85453d21f858f5ca7
/frameworks/base/core/java/android/content/res/Resources.java
0cfb877f5a0a1bff82d9c3ee969195bf7812c0b5 15-May-2014 Alan Viverette <alanv@google.com> Simplify attribute extraction for themed Drawables

Also fixes a bug in GlowPadView that randomly popped up.

Change-Id: Id20508a44ea02b4a14c8f794de36e13a2c06587c
/frameworks/base/core/java/android/content/res/Resources.java
5effd7e89f83824ac8982a6cbcebbf5cc331e436 05-May-2014 Alan Viverette <alanv@google.com> Partial revert "Load device default theme mapping from resources"

This reverts commit e4ab72d54cf41d16819b72e94d9b0d0d51289647.

Change-Id: Id17170312c75993fc1f7859d52c7e050b2aeaf80
/frameworks/base/core/java/android/content/res/Resources.java
0810b63739c9981f993063749f804b54faed0ba5 01-May-2014 Alan Viverette <alanv@google.com> Load device default theme mapping from resources

Also adds a few missing styles and reorganizes some XML files. Makes
stackViewStyle public since it's defined in DeviceDefault.

Change-Id: I8f6a0f93410948b38619594474d60dc40ece5917
/frameworks/base/core/java/android/content/res/Resources.java
e9abc279fd0e1cd3a7c0bfb878c9b5ae22840b9b 08-Apr-2014 Deepanshu Gupta <deepanshu@google.com> Merge "Fix theme/style resolution in Layoutlib"
bfec73c2db5a34ced248213edf5519c80727a65f 12-Mar-2014 Deepanshu Gupta <deepanshu@google.com> Fix theme/style resolution in Layoutlib

Change-Id: Icfb91e566666408802dadc0e2070991151b16b9d
/frameworks/base/core/java/android/content/res/Resources.java
6259933ec99dee566f200c5fdfe1756ee72b1513 01-Apr-2014 Alan Viverette <alanv@google.com> Switch framework Holo references to Quantum.Light

Change-Id: Ib545a143f1959b6104adbc9d594dd626851d90b3
/frameworks/base/core/java/android/content/res/Resources.java
351f0c1d26999af7b86f9e0c7eca707121739ee0 28-Mar-2014 Alan Viverette <alanv@google.com> Remove unthemed drawable cache, since canApplyTheme != isThemed

Change-Id: I460673bfa491e67ea239f8ebb03898a0633e7565
/frameworks/base/core/java/android/content/res/Resources.java
52b999f0721b53e9c6e18a4bd664e89aeb65b2d5 25-Mar-2014 Alan Viverette <alanv@google.com> Implement APIs for obtaining, caching themed Drawables

When Drawables are inflated during preload (or otherwise without a theme)
they cache their themeable attributes in their constant state as an array
keyed on attribute index. Drawables inflated with a theme will simply
resolve theme attributes as part of normal inflation, and they will not
cache any themeable attributes.

Drawables obtained from Resources are pulled from theme-specific cache
when possible. If an unthemed Drawable exists in the preload cache, a
new constant state will be obtained for the Drawable and the theme will
be applied by resolving the cached themeable attributes and overwriting
their respective constant state properties. If no cached version exists,
a new Drawable is inflated against the desired theme.

Constant states from themed drawables may be cached if the applied theme
is "pure" and was loaded from a style resource without any subsequent
modifications.

This CL does not handle applying themes to several Drawable types, but it
fully supports BitmapDrawable, GradientDrawable, NinePatchDrawable,
ColorDrawable, and TouchFeedbackDrawable.

BUG: 12611005
Change-Id: I4e794fbb62f7a371715f4ebdf946ee5f9a5ad1c9
/frameworks/base/core/java/android/content/res/Resources.java
21fc8ba39c4799a346caf95218d2bd60ee42ca1a 05-Mar-2014 Narayan Kamath <narayan@google.com> Support deprecated language codes.

Locale.toLanguageTag will transform the obsolete (and
deprecated) language codes "in", "ji" and "iw" to
"id", "yi" and "he" respectively.

All versions of android prior to "L" used the deprecated
language tags, so we will need to support them for backwards
compatibility.

bug: 13230947

Change-Id: Ib63567786bcbe780ceb0487d8f583b75a5452aea
/frameworks/base/core/java/android/content/res/Resources.java
857ba4af8519479298a671461cd6f5cace35b99b 15-Feb-2014 Deepanshu Gupta <deepanshu@google.com> Fix layoutlib by avoiding Java7 calls

This change also fixes a NPE in TypedArray caused by changes in the
framework.

Change-Id: Ie64237c567fa16c35c807db22ce9a4b609ee411d
/frameworks/base/core/java/android/content/res/Resources.java
91447d88f2bdf9c2bf8d1a53570efef6172fba74 21-Jan-2014 Narayan Kamath <narayan@google.com> Extended locales in AAPT / AssetManager.

Support 3 letter language codes, script codes &
variants. The bulk of the changes are related to
the implementation of command line filtering of
locales etc. The previous code assumed that the
value of each "axis" (locale, density, size etc.)
could be represented by a 4 byte type. This is
no longer the case.

This change introduces a new class, AaptLocaleValue
which holds a (normalized) locale parsed from a
directory name or a filter string. This class takes
responsibility for parsing locales as well as
writing them to ResTable_config structures, which is
their representation in the resource table.

This includes minor changes at the java / JNI level
for AssetManager. We now call locale.toLanguageTag()
to give the native layer a well formed BCP-47 tag.
I've removed some duplicated parsing code in
AssetManager.cpp and replaced them with functions on
ResTable_config. The native getLocales function has
been changed to return well formed BCP-47 locales as
well, so that the corresponding java function can use
Locale.forLanguageTag to construct a Locale object
out of it.

Finally, this change introduces default and copy
constructors for ResTable_config to prevent having
to memset() the associated memory to 0 on every
stack allocation.

Change-Id: I899a56a9a182ee6be52b9389d1ae59266f5482e9
/frameworks/base/core/java/android/content/res/Resources.java
8eea3ea5591e59f55cbb4f6b2b7e9363a285ced3 04-Feb-2014 Alan Viverette <alanv@google.com> Add APIs for obtaining themed Drawable from Theme, Context

BUG: 12611005
Change-Id: Ic0057be4e4c2d0c61ce02a019b3f7d0625e3a016
/frameworks/base/core/java/android/content/res/Resources.java
edc4664d60af1f124d05f0a2b6ba58b837630f51 01-Feb-2014 Alan Viverette <alanv@google.com> Fix broken build in BridgeResources

Change-Id: Iec58a2acda6b9538bcb5974d3d5c45ea6e53eac5
/frameworks/base/core/java/android/content/res/Resources.java
562a6a8d834dbc7490d9580afc591f6cd521f20c 31-Jan-2014 Alan Viverette <alanv@google.com> Improve encapsulation of Resources

Change-Id: Ic408915d2695ac8906231da1d2dc127f94bdd0cc
/frameworks/base/core/java/android/content/res/Resources.java
90b8eaa68bda6beaf2ff886c3ed642e7050e3ff6 31-Jan-2014 Narayan Kamath <narayan@google.com> am 797b5adc: am 77a1986c: am 49b7ba4d: Merge "AArch64: Make AssetManager and related classes 64-bit compatible"

* commit '797b5adcb4ead3c687db3d9fd831dff93760dd4a':
AArch64: Make AssetManager and related classes 64-bit compatible
896043d67d3ac75760bd99db8a1561e31ebee1e1 17-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make AssetManager and related classes 64-bit compatible

Following changes have been done:

[x] Long is used to store native pointers as pointers can be
64-bit.

[x] AssetManager openAsset native function returned -1 if
file name was empty and java function considered any
non-zero value as success. This has been fixed by native
function throwing Illegal Argument Exception as well.

[x] AssetManager incRefsLocked and decRefsLocked now accept
long as input to support 64-bit native references.

[x] AssetManager incRefsLocked method incorrecly used
'this.hashCode()' instead of the passed parameter id.
This has been fixed.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

Change-Id: I095b9f900d49e51f43ad6afc47cbc23116a6a64a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
/frameworks/base/core/java/android/content/res/Resources.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/content/res/Resources.java
79a8ffe54f9c99ffc34f7b5b73c22eea2673424a 20-Sep-2013 Adam Lesinski <adamlesinski@google.com> Ensures that CompatibilityInfo is always set in Resources

- Adds null checks when setting mCompatibilityInfo and uses default no-op
CompatibilityInfo object instead of null
- Removes null checks when calling methods on mCompatibilityInfo since it is never
null

bug:10204942

Change-Id: I36e88f5cdceb46b8b19fb902270ef74023a81546
/frameworks/base/core/java/android/content/res/Resources.java
88c0589969b17e66559cd2f132094cdaa0ee351d 28-Jun-2013 Craig Mautner <cmautner@google.com> Refactor ActivityThread cache - Baby step 1.

Introduce ResourcesManager and ResourcesKey as standalone classes.
Move DisplayMetrics and Resources HashMaps from ActivityThread to
ResourcesManager.

Change-Id: I20cc6c0dd1b74667354839e5ac9a660f4ee2d00d
/frameworks/base/core/java/android/content/res/Resources.java
48d0d1886731ff19ed3fb47a5997be5df0d1bba8 11-Jun-2013 Craig Mautner <cmautner@google.com> Add activity token to display system.

First step in adding activity specific information to displays.
Replace CompatibilityInfoHolder with DisplayAdjustmentsHolder that
holds an activity token in addition to the CompatibilityInfo.

Change-Id: Ie113cd8dd9c62e0b5311204e039a4829096bea68
/frameworks/base/core/java/android/content/res/Resources.java
f4bf0ae2a7c2d9d92c5c8abdb82baa53b4c9ccda 21-May-2013 Dianne Hackborn <hackbod@google.com> New ArrayMap class.

This is a new kind of key/value mapping that stores its data
as an array, so it doesn't need to create an extra Entry object
for every mapping placed in to it. It is also optimized to reduce
memory overhead in other ways, by keeping the base object small,
being fairly aggressive about keeping the array data structures
small, etc.

There are some unit and performance tests dropped in to some
random places; they will need to be put somewhere else once I
decided what we are going to do with this for the next release
(for example if we make it public the unit tests should go in
to CTS).

Switch IntentResolver to using ArrayMap instead of HashMap.

Also get rid of a bunch of duplicate implementations of binarySearch,
and add an optimization to the various sparse arrays where you can
supply an explicit 0 capacity to prevent it from doing an initial
array allocation; use this new optimization in a few places where it
makes sense.

Change-Id: I01ef2764680f8ae49938e2a2ed40dc01606a056b
/frameworks/base/core/java/android/content/res/Resources.java
3b748a44c6bd2ea05fe16839caf73dbe50bd7ae9 18-Apr-2013 Romain Guy <romainguy@google.com> Pack preloaded framework assets in a texture atlas

When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.

This CL introduces an asset server that provides an atlas to all processes.

Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.

WHAT IS THE ASSETS ATLAS

The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)

HOW IS THE ASSETS ATLAS GENERATED

Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.

There are several steps that lead to the atlas generation:

1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas

2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.

3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.

HOW PROCESSES USE THE ATLAS

Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.

It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)

Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.

Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
/frameworks/base/core/java/android/content/res/Resources.java
f1ae269c0665f266b904db7c9ef4511e11459f44 19-Apr-2013 Dianne Hackborn <hackbod@google.com> Follow up on issue #8159072: Spinner widget should be RTL'ized

Only allow through changing direction configs for drawables.

Explicitly map layout direction values to an index in the
preload arrays.

Drawables that don't vary by configuration should go in to both
the rtl and ltr preloads.

Change-Id: Ib92dd11738082a795e02d1d4191adb54702d651c
/frameworks/base/core/java/android/content/res/Resources.java
b9a13b892ef3da521d428f144e4048aac8a63017 15-Apr-2013 Fabrice Di Meglio <fdimeglio@google.com> Improve fix for bug #8159072 Spinner widget should be RTL'ized

- populate the preloaded drawable cache with only LTR drawables
when the layout direction during preloading is LTR. Populate
the cache with only RTL drawables when the layout direction during
preloading is RTL
- only preload drawables that dont have a dual LTR/RTL version

Change-Id: I7807bdc031b99102609efda75042a9500d96065c
/frameworks/base/core/java/android/content/res/Resources.java
0acc1931d364fabb32e2051f58bfbbc5f2505176 13-Apr-2013 Dianne Hackborn <hackbod@google.com> Add a little more resource load tracing.

Change-Id: Id797adb67ab411d5b1a1c223863d3bb4655d10b1
/frameworks/base/core/java/android/content/res/Resources.java
dc25d25333d3fac96dccfb9bd31d2474d6bc2d78 10-Apr-2013 Fabrice Di Meglio <fdimeglio@google.com> More fix for bug #8159072 Spinner widget should be RTL'ized

- fix DrawableContainerState.getChangingConfigurations() to take care about its children
- make Resources.verifyPreloadConfig() return false when the changing configuration
contains layout direction bits (this is when a Drawable is having different version
for LTR and RTL layout directions)
- use constant state instead of the resource type value for checking if we can
preload the drawable
- fix typo

Change-Id: Idd64caf0fbe0f5cfd5ffe09343e84bafa9446ea5
/frameworks/base/core/java/android/content/res/Resources.java
47b50333c110194565498011379988e5c05f7890 15-Mar-2013 Jeff Sharkey <jsharkey@android.com> Avoid warnings about synthesized IDs.

Bug: 8153518
Change-Id: I5d638e17581f63c6d4a10ff6bc2c1bf9997a78b3
/frameworks/base/core/java/android/content/res/Resources.java
5043dc20633a05c429de3ae469dc7d74bfb92451 08-Mar-2013 Elliott Hughes <enh@google.com> am bf8a663c: am 3f7a4990: Merge "Improve the Resource.getQuantityString/getQuantityText documentation."

* commit 'bf8a663c53454f8b8cd7e07344316981022efa10':
Improve the Resource.getQuantityString/getQuantityText documentation.
95d5ab30f2f91b63af2f493548dc67e90c052831 08-Mar-2013 Elliott Hughes <enh@google.com> Improve the Resource.getQuantityString/getQuantityText documentation.

Natural languages differ so much and in such odd ways that you can't
use getQuantityString as an "if" statement. It's really just for grammaticality.
This is explained well in
http://developer.android.com/guide/topics/resources/string-resource.html#Plurals
but we need to make more of an effort to motivate people to read that, and to
at least get the most important point across if they don't read it.

Change-Id: I549b9f3563462c45f2dea34c558185e0714127cd
/frameworks/base/core/java/android/content/res/Resources.java
e5b50a65ad26a32f6e58588ffdcbc0389eac9257 12-Feb-2013 Dianne Hackborn <hackbod@google.com> Fix issue #8176917: Stabillity : Native Crash :

/system/lib/libandroidfw.so

Change-Id: I235470fac7ad0f5a5d3432006f4dfa69620e30d8
/frameworks/base/core/java/android/content/res/Resources.java
50707cc8206f0d257ba83de2f1f99c3eaa13a4bd 09-Feb-2013 Dianne Hackborn <hackbod@google.com> Fix issue #8133857: Tracking ANR in Gallery

Reworking the locking in resources so that we never hold the
state lock while calling in to potential long running operations.
This means the mTmpValue can no longer be final (since we need
to use it while the lock isn't held), so a new field needs to
be added as the lock and everything that touches mTmpValue must
deal with it being null, restoring the value in there when
possible, etc.

Change-Id: Ie5ffd0f66e5f2d0e869a62d72e7a55b1c74fe872
/frameworks/base/core/java/android/content/res/Resources.java
330dd534848562515c6c67cb3de13067e86866a1 18-Dec-2012 John Spurlock <jspurlock@google.com> Remove remaining doc references to StyledAttributes.

It appears StyledAttributes was renamed to TypedArray
prior to fw 1.0. Leaving references to the old name
around in the public docs is confusing.

Deliberating leaving...
tests/coretests/src/android/widget/LabelView.java
... as is - it's clearly unused.

Change-Id: I3f66e5f9cbe945d9d86530d37b88369b401f054d
/frameworks/base/core/java/android/content/res/Resources.java
58ed5d748c0b9b64845975ef5844ad313de7c3f6 07-Nov-2012 Kenny Root <kroot@google.com> am 768d9e1a: Merge "Correct executable bit for source files"

* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
Correct executable bit for source files
3a084af2e90849aaa8beb3a610189e3399c63ea0 07-Nov-2012 Kenny Root <kroot@google.com> Correct executable bit for source files

Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
/frameworks/base/core/java/android/content/res/Resources.java
c36c49ee83123d6083c05a3e333ac43a13f664cd 30-Sep-2012 Craig Mautner <cmautner@google.com> Changing debug for b/7094175.

Fixes bug 7094175 (but not really).

Change-Id: Ice2abb93f479ea0bda931e9643710668c25aa285
/frameworks/base/core/java/android/content/res/Resources.java
0cbfcffe7b99eea85dc17e92ef204035fa6fd4f9 18-Sep-2012 Craig Mautner <cmautner@google.com> Add debug for b/7094175.

Change-Id: Iec83b9350bfeb804dfe3da25986138c2dbaa6d45
/frameworks/base/core/java/android/content/res/Resources.java
5f49c3023a512efbef8bc9515d310c7a72be4af2 07-Sep-2012 Romain Guy <romainguy@google.com> The drawables cache strikes again
Bug #7117785

Draawables created from the ConstantState cache found in Resources must be
mutated before they can be safely modified by apps. Failure to do so results
in all drawables sharing the same constant state to be affected by the
modification.

In the case of the bugreport above, the status bar code plays tricks with
a background drawable and modifies its color to implement a fade in/out
effect. This drawable comes from a cached resource (color 0x0) and the
modifications made by the status bar apply to other clients of this drawable,
most notably the recents panel.

This change fixes several things:
- Simplifies colors caching by removing the assetCookie from the key. This
should result in better reuse of cached drawables
- Makes View.setBackgroundColor() honor the mutate() contract
- Ensure StateListDrawable properly mutates its children before modifying
them
- Optimize Bitmap/ColorDrawable to mark them mutated when they are not
created from an existing ConstantSate. The same optimization should be
applied to other drawables in the future

Change-Id: I54adb5d5b914c7d8930bf9b46f7e3f9dcbf4bcab
/frameworks/base/core/java/android/content/res/Resources.java
5f7979993979466c79ab4f38d83c6f2aca361662 16-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Add support for "-rtl" in resources

- fix bug #7035019 Need to have "-rtl" support for Resource

Change-Id: Ic82145c2ac672729d8a6c695a5f343276a1a0a2c
/frameworks/base/core/java/android/content/res/Resources.java
34743ac7d688a7ecf4daec84078fc7ec74a6dac9 15-Aug-2012 Dianne Hackborn <hackbod@google.com> Merge "Add API to create new contexts with custom configurations." into jb-mr1-dev
756220bd1912535840388a6743830d2e59ad4964 15-Aug-2012 Dianne Hackborn <hackbod@google.com> Add API to create new contexts with custom configurations.

This allows you to, say, make a Context whose configuration
is set to a different density than the actual density of the device.

The main API is Context.createConfigurationContext(). There is
also a new API on ContextThemeWrapper that allows you to apply
an override context before its resources are retrieved, which
addresses some feature requests from developers to be able to
customize the context their app is running in.

Change-Id: I88364986660088521e24b567e2fda22fb7042819
/frameworks/base/core/java/android/content/res/Resources.java
a5d1dc9d0322d2c7b7d7f13816fd551a7042c2a3 14-Aug-2012 Scott Main <smain@google.com> am bd63fb87: am 6958c161: Merge "docs: misc bug fixes from external issues" into jb-dev

* commit 'bd63fb875c49d69d5969df35ae159bd17cadb730':
docs: misc bug fixes from external issues
183bf116978e3c44292c9ead2bceb47e972624a1 14-Aug-2012 Scott Main <smain@google.com> docs: misc bug fixes from external issues

Change-Id: I380b65341200c0519a93e2f8969f70f64aec0264
/frameworks/base/core/java/android/content/res/Resources.java
dde331cebd87982faded6818ad5f9927ff994c96 03-Aug-2012 Dianne Hackborn <hackbod@google.com> We can now (kind-of) change screen density on the fly.

Preloaded drawables now have a density associated with them, so we
can load the correct drawable if we are using a different density.

Window manager now formally keeps track of the density for each
screen, allowing it to be overridden like you can already do with
size, and relies on this density to drive itself internally and
the configurations it reports.

There are a new set of Bitmap constructors where you provide a
DisplayMetrics so they can be constructed with the correct density.
(This will be for when you can have different windows in the same
app running at different densities.)

ActivityThread now watches for density changes, and pushes them
to the DENSITY_DEVICE and Bitmap global density values for that
process.

A new am command allows you to change the density.
/frameworks/base/core/java/android/content/res/Resources.java
908aecc3a63c5520d5b11da14a9383f885b7d126 01-Aug-2012 Dianne Hackborn <hackbod@google.com> Start moving away from DisplayMetrics.DENSITY_DEVICE.

This puts in most of the infrastructure needed to allow us to
switch between different densities at run time. The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.

Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
/frameworks/base/core/java/android/content/res/Resources.java
fb5c3dba4ddac023cfd4cdcabdfdbcf343197c94 19-May-2012 Dianne Hackborn <hackbod@google.com> Fix issue #6440173: MenuItem.setIcon(Drawable) scaling incorrectly...

...when resource is aliased

We were not correctly using the final resolved configuration when
retrieving a drawable through Resources.getDrawable(). (It already
does the correct behavior when going through TypedArray.getDrawable()).

Change-Id: I9032b788b592412178e31e2e6b0181b92c20fe45
/frameworks/base/core/java/android/content/res/Resources.java
5d911c3a95cf4db4cf1cc0c8d4d253553d50c550 13-Apr-2012 Romain Guy <romainguy@google.com> Properly cache color state lists.

Clobbering the typed value's cookie with the alpha channel is not okay.

Change-Id: Ia75481be06699b42f80eb4c59672c6cd6cf8c0a8
/frameworks/base/core/java/android/content/res/Resources.java
32313b161f7c7d17841bf49b3d146fd19dd7fde1 10-Jan-2012 Dianne Hackborn <hackbod@google.com> am d476c8b8: am d3be0a76: Merge "Unhide Resources APIs for getting resources at specific densities." into ics-mr1

* commit 'd476c8b8a8a6fadea7e72426d3e93c4e6b00e543':
Unhide Resources APIs for getting resources at specific densities.
613989772f7d7f7317349568a4809bf08b942bd7 09-Jan-2012 Dianne Hackborn <hackbod@google.com> Unhide Resources APIs for getting resources at specific densities.

This adds Resources.getDrawableForDensity() and
Resources.getValueForDensity(). These are needed for applications
to correctly retrieve larger icons such as in launcher when
running on a tablet. We had already exposed the APIs to tell the
application which density to use for app icons on the current
device, but didn't unhide these APIs that allowed you to
actually retrieve them.

This is safe to do without introducing a new API level (as long
as we do it soon) because we know these APIs already exist in
Android 4.0, and there is no reason for anyone to be removing
them when building a device.

Change-Id: I5138e5dc908197b66a98d20af73c5374cb5d41d3
/frameworks/base/core/java/android/content/res/Resources.java
8f85e80b64b89fd38cc23b129f61ec36ddde7f15 15-Dec-2011 Romain Guy <romainguy@google.com> Generate even fewer GL commands

Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
/frameworks/base/core/java/android/content/res/Resources.java
ab0f485e64418eb22f0a1d89d7064902b381e9c2 13-Sep-2011 Dianne Hackborn <hackbod@google.com> Fix problems where we were allocating TypedArray when not needed.

Fixes up some recycling of TypedArray objects to reduce the
number we need to allocate during inflation etc.

Change-Id: I948dccc052997779001eaa99db2a710b04be01ae
/frameworks/base/core/java/android/content/res/Resources.java
9b44aaefc0c8c4aafd176c2fe5af86e098422b56 03-Sep-2011 Dianne Hackborn <hackbod@google.com> Some more preloaded drawables.

More to come.

Change-Id: I28393c6e52553e960d3a765ba793cfdbf36460ff
/frameworks/base/core/java/android/content/res/Resources.java
6e90a362bc66cc67b1beae27b21d3f0148403b08 15-Aug-2011 Adam Powell <adamp@google.com> Fix bug 5159736 - Make DeviceDefault the default

Have the framework refer to the DeviceDefault themes for ICS apps that
don't explicitly request another theme.

Change-Id: I27dd0bbaa60f71df4f36e47d260f556d923ba075
/frameworks/base/core/java/android/content/res/Resources.java
7f9f99ea11051614a7727dfb9f9578b518e76e3c 11-Aug-2011 Xavier Ducrohet <xav@android.com> Make some methods/fields package private so that layoutlib can access them.

Change-Id: I4aeadfbaf8a4f6a459fa19937c21ac23d9e5fb64
/frameworks/base/core/java/android/content/res/Resources.java
2b31d53161789358de57fd396716a6503855c5da 23-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4770360: older app compatibility mode is really tiny on ICS phones

We were applying the density compat mode scaling multiple times to
display metrics, causing bad values.

Change-Id: Iafafd9a5e94b9d774cd2715bf968e91602a1bd82
/frameworks/base/core/java/android/content/res/Resources.java
5fd2169eabd77e6bfafaf456e58051a3bafb2bca 07-Jun-2011 Dianne Hackborn <hackbod@google.com> Work on issue #4518815: Compatibility mode introduces compatibility regression...

...for Market App iRunner

There were a lot of serious issues with how we updated (or often didn't update)
the display and resource state when switching compatibility mode in conjunction
with restarting and updating application components. This addresses everything
I could find.

Unfortunately it does *not* fix this particular app. I am starting to think this
is just an issue in the app. This change does fix a number of other problems
I could repro, such as switching the compatibility mode of an IME.

Also a few changes here and there to get rid of $#*&^!! debug logs.

Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
/frameworks/base/core/java/android/content/res/Resources.java
2f0b17573d4324832f7a20402a3d2b5920bc4866 01-Jun-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4502672: Wrong xml resources used for homescreen widgets.

There was a race in the system process between applying the initial
configuration and executing code in higher-level system services
like the app widget service that relies on the config. For some
reason it starting showing up more after my code changes; it should
now be completely fixed.

Also fix the activity starting window to run in compatibility mode
if its application is going to be in compatibility mode.

And some various cleanup and small fixes.

Change-Id: I0566933bf1bbb4259c1d99a60c0a3c19af1542e5
/frameworks/base/core/java/android/content/res/Resources.java
3904d03dd01dcd43c446744e44b34615825d9679 27-May-2011 Dianne Hackborn <hackbod@google.com> Small fixes and cleanup of resource config handling.

Change-Id: I402c31b68f2b4825cb4c610a65ee8e1da471c7bb
/frameworks/base/core/java/android/content/res/Resources.java
5be8de3420ba4c9d816b98e29bdec11715f6b626 25-May-2011 Dianne Hackborn <hackbod@google.com> More compatibility mode improvements.

We now correctly adjust display metrics, fixing for example issues
seen in Barcode Scanner. In addition the decision about when to use
compatibility mode has a bug fixed where certain apps would not go
out of compatibility mode even though they should be able to.

Change-Id: I5971206323df0f11ce653d1c790c700f457f0582
/frameworks/base/core/java/android/content/res/Resources.java
69cb87576ba163b61bb0e6477a3b7c57a9b11d40 20-May-2011 Dianne Hackborn <hackbod@google.com> Add new "-swNNNdp" resource qualifier.

Change-Id: I0101e88ca9d8d44138bdcaf571f24b0352f4f6ce
/frameworks/base/core/java/android/content/res/Resources.java
ebff8f92f13513ce37bd74759eb1db63f2220590 13-May-2011 Dianne Hackborn <hackbod@google.com> DO NOT MERGE. Integrate add new screen width/height in "dp" configs.

You can now specify resource configuration variants "wNNNdp"
and "hNNNdp". These are the minimum screen width/height in "dp"
units. This allows you to do things like have your app adjust
its layout based only on the about of horizontal space available.

This introduces a new configuration change flag for screen size.
Note that this configuration change happens each time the orientation
changes. Applications often say they handle the orientation change
to avoid being restarted at a screen rotation, and this will now
cause them to be restarted. To address this, we assume the app can
handle this new config change if its target SDK version is < ICS.

Change-Id: I4acb73d82677b74092c1da9e4046a4951921f9f4
/frameworks/base/core/java/android/content/res/Resources.java
e2515eebf42c763c0a2d9f873a153711778cfc17 28-Apr-2011 Dianne Hackborn <hackbod@google.com> Better compat mode part one: start scaling windows.

First step of improving app screen size compatibility mode. When
running in compat mode, an application's windows are scaled up on
the screen rather than being small with 1:1 pixels.

Currently we scale the application to fill the entire screen, so
don't use an even pixel scaling. Though this may have some
negative impact on the appearance (it looks okay to me), it has a
big benefit of allowing us to now treat these apps as normal
full-screens apps and do the normal transition animations as you
move in and out and around in them.

This introduces fun stuff in the input system to take care of
modifying pointer coordinates to account for the app window
surface scaling. The input dispatcher is told about the scale
that is being applied to each window and, when there is one,
adjusts pointer events appropriately as they are being sent
to the transport.

Also modified is CompatibilityInfo, which has been greatly
simplified to not be so insane and incomprehendible. It is
now simple -- when constructed it determines if the given app
is compatible with the current screen size and density, and
that is that.

There are new APIs on ActivityManagerService to put applications
that we would traditionally consider compatible with larger screens
in compatibility mode. This is the start of a facility to have
a UI affordance for a user to switch apps in and out of
compatibility.

To test switching of modes, there is a new variation of the "am"
command to do this: am screen-compat [on|off] [package]

This mode switching has the fundamentals of restarting activities
when it is changed, though the state still needs to be persisted
and the overall mode switch cleaned up.

For the few small apps I have tested, things mostly seem to be
working well. I know of one problem with the text selection
handles being drawn at the wrong position because at some point
the window offset is being scaled incorrectly. There are
probably other similar issues around the interaction between
two windows because the different window coordinate spaces are
done in a hacky way instead of being formally integrated into
the window manager layout process.

Change-Id: Ie038e3746b448135117bd860859d74e360938557
/frameworks/base/core/java/android/content/res/Resources.java
179a3bda60044cf191ce9f47e3349398fc32bafb 18-Feb-2011 Jesse Wilson <jessewilson@google.com> Save a few bytes on the zygote heap.

The default LongSparseArray constructor builds two 10-element
arrays that we don't need.

Change-Id: I83ef4fbd8825109087cbe8990ad66d79eab33e5c
/frameworks/base/core/java/android/content/res/Resources.java
f4f05b8f24183b9e0d6959fe8b71fb88543edd9b 07-Jan-2011 Scott Main <smain@google.com> Update package descriptions with editorial revisions.
Notably, this removes exessive info about resources
from the content package, because it's not a good location
and the info is avilable in the dev guide, but also
added some of the info to the Resources class description.

Change-Id: Ie78af26c9cec66314deb98e53078f48e16c08e70
/frameworks/base/core/java/android/content/res/Resources.java
3b81bc18bb661c02ad8074c39dab16644c1e65d0 15-Jan-2011 Dianne Hackborn <hackbod@google.com> Add manifest API to request a large heap.

You can now do android:largeHeap="true" on an application.

Doesn't yet do anything, waiting for Dalvik API.

Also tweak package parsing so that the SDK API level is set in the
configuration, allowing manifest resource value selection based on
that.

Change-Id: I6e035f9702a97b055416743b88f83a22ba4a9584
/frameworks/base/core/java/android/content/res/Resources.java
6efd2bad954e0e5bd74916a32f036a0f149dcd4d 13-Jan-2011 Christopher Lais <chris+android@zenthought.org> Don't drop the drawable cache completely on configuration change

There was a lot of fancy code just above the clear to ensure
that drawables that aren't affected by the change are kept,
then the entire array was cleared. This patch removes the
clear, so that the drawables that haven't changed are really
kept, matching the logs, comments and larger part of the code.

This patch also fixes the various constant states to return
correct ChangingConfigurations.

Change-Id: Ic11f6179537318d3de16dc58286989eb62a07f15
Old-Change-Id: I22495e6ed232dfe056207ce5155405af1fa82428
/frameworks/base/core/java/android/content/res/Resources.java
d922ae01ca99a2b6d39a9393f86776a1d10ebd14 14-Jan-2011 Dianne Hackborn <hackbod@google.com> Add Holo theme for IMEs.

Also clean up theme selection code to get rid of duplication.

Change-Id: Idf7b21db70ee83fce24756ead877169bd08b77a9
/frameworks/base/core/java/android/content/res/Resources.java
55fc850cf992cdcb0993cb109d2f716613c0dbdd 28-Oct-2010 Kenny Root <kroot@google.com> Add path to get different DPI drawables

Allow a caller to request a different density than their current display
allows. This can mean a device displaying mdpi can get a resource that's
in hdpi and have it pretend to be in mdpi resolution. If a drawable
that's returned is not in the requested density, it will set it at the
appropriate density to be scaled up later on.

The API for this is hidden currently.

Bug: 3134688
Change-Id: I6c3908cbdef4907b8d3f1576df9e3b0e7af1755a
/frameworks/base/core/java/android/content/res/Resources.java
def1537e9e8d0dd190cde5310ddae8b921088c9b 15-Aug-2010 Dianne Hackborn <hackbod@google.com> More fragment work:

- Introduce FragmentManager as a public API, deprecating the fragment
APIs on Activity. (They will be removed soon.)
- Add APIs to write a fragment reference to a bundle and later retrieve
it.
- Add Fragment API to set another fragment as its target, for delivering
results.
- Change when onInflate() is called and formalize its meaning in relation
to the fragment arguments that were previously introduced.
- Change onDestroyView() to always be called, regardless of when
onCreateView() returns. It now also is called slightly differently,
after the view hierarchy's state is saved.
- Fix some issues with DialogFragment's lifecycle with its associated
Dialog and state save/restore.
- Preference can now have a Bundle associated with it to provide
arguments to a fragment. The data for this Bundle call be supplied
via <extra> tags under a PreferenceScreen.
- PreferenceActivity's header XML tags are now <preference-headers>
and <header>, and you can supply <extra> tags under a <header> to set
arguments for the header's fragment.

Change-Id: I22c212c9fa862d50840201ca16e51f9de5ef0031
/frameworks/base/core/java/android/content/res/Resources.java
7b6d0d99b6904b511996267efae215fe9cb5e98f 11-Aug-2010 Dianne Hackborn <hackbod@google.com> am 679ac09a: am a5ae50cd: Merge "More native work." into gingerbread

Merge commit '679ac09a5c22175354f3a04b28456b323839530e'

* commit '679ac09a5c22175354f3a04b28456b323839530e':
More native work.
679ac09a5c22175354f3a04b28456b323839530e 11-Aug-2010 Dianne Hackborn <hackbod@google.com> am a5ae50cd: Merge "More native work." into gingerbread

Merge commit 'a5ae50cd838b5725c63ed485292aae4edd1a98cb' into gingerbread-plus-aosp

* commit 'a5ae50cd838b5725c63ed485292aae4edd1a98cb':
More native work.
08d5b8fad8d46ccb64db2fdcb4d66972ec87bf48 04-Aug-2010 Dianne Hackborn <hackbod@google.com> More native work.

Implement save/restore of state, and add native APIs for
configuration information.

Change-Id: I2a3ddc2ba605db58d7c8b2b31b9215fb323f90b5
/frameworks/base/core/java/android/content/res/Resources.java
63ae85f0e17f09892e87e2b02de38599289eac5a 21-Jul-2010 The Android Open Source Project <initial-contribution@android.com> am 42ef77f3: merge from open-source master

Merge commit '42ef77f3603ae54990d6718db79afae61e91dc61'

* commit '42ef77f3603ae54990d6718db79afae61e91dc61':
Shoud specify the Resource class instance as an argument of the method
708654c0b8d45001bc333a3b7b9fd845c81c6f26 20-Jul-2010 Masanori Ogino <ogino.masanori@sharp.co.jp> Shoud specify the Resource class instance as an argument of the method
newDrawable and change the name from 'DrawableCacheClear' to 'clearDrawableCache'
(additional changes for ID:15815)
https://review.source.android.com/#change,15815

Change-Id: I6bf19b8e6e187df8c8e3cb57d9e04278ddfe5055
/frameworks/base/core/java/android/content/res/Resources.java
bf4564f03daf9a43bafae8cbfe6c3cecd60847f0 16-Jul-2010 The Android Open Source Project <initial-contribution@android.com> am 5adfe6c5: merge from open-source master

Merge commit '5adfe6c56369b48e10493c0bb9e9b64ac553a19f'

* commit '5adfe6c56369b48e10493c0bb9e9b64ac553a19f':
Fix the problem that color drawable cache key conflicts another drawable one.
c7d9d2790f0b7a036d70bac2f100b42790ff0979 09-Jul-2010 Masanori Ogino <ogino.masanori@sharp.co.jp> Fix the problem that color drawable cache key conflicts another drawable one.
The cache key of a color drawable resource may be the same as another
drawable resource's value.

Change-Id: Ia971bb242ceac5e8f9346094009a10f356399ab9
(Reduced duplicated codes and replace TAB to white spaces)

And try to fix compile error.
/frameworks/base/core/java/android/content/res/Resources.java
1ad636c31501b1f407a3bf504d14689c1d5c7f5a 02-Jul-2010 Elliott Hughes <enh@google.com> Defer to ICU's knowledge of language-specific grammatical quantity rules.

Also improve the documentation to make it a little less unclear what this
is all about. In particular, explain why the original submitter's complaint
about "zero" never being used in English, is expected behavior.

Bug: 2663392
Change-Id: Iade3b4f5c549ce01a95fd0e7e5c6ea394178eda3
/frameworks/base/core/java/android/content/res/Resources.java
2269d1572e5fcfb725ea55f5764d8c3280d69f6d 25-Feb-2010 Dianne Hackborn <hackbod@google.com> Re-arrange android-common so framework no longer links with it.

This is the framework part, moving classes around so the framework
no longer needs to link to android-common. Makes some APIs public,
others that didn't need to be public are private in the framework,
some small things are copied.
/frameworks/base/core/java/android/content/res/Resources.java
e36d6e277e49475076b7872d36ea6a5c5b996e9d 18-Feb-2010 Dianne Hackborn <hackbod@google.com> Work on issue #2263557: PMF3000 showing hybrid of portrait and landscape modes

This is a bunch of reworking of how configuration changes are handled:

- When orientation is changing (for whatever reason), the window manager no
longer tries to pre-emptively compute a new configuration. Instead, it
just determines change is happening and tells the window manager.
- The activity manager is now responsible for giving the window manager the
final configuration it is using. This is both so it knows whem the
activity manager is done with its configuration updates, and so the window
manager can use the "real" configuration.
- When an orientation or other configuration change is happening, freeze the
screen and keep it frozen until the activity manager has given us the
final configuration.
- The window manager can now send new configurations to its clients during
its layout pass, as part of a resize, if it has determined that it has
changed. This allows for a new View.onConfigurationChanged() API for any
view to easily find out when the configuration has changed.
- ViewRoot now also works with the activity thread to make sure the process's
current resources are updated to the new configuration when it receives one
from a window. This ensures that at the time onConfigurationChanged() and
other view callbacks are happening, the correct configuration is in force.
- There is now a sequence number associated with Configuration, which
ActivityThread uses to avoid using stale configurations. This is needed now
that it can receive configurations asynchronously from both the window
manager and activity manager.
- The hack for keeping the locale has been removed, and underlying problem
fixed by having Configuration initialize its locale to "unknown" instead of
a valid default value.
/frameworks/base/core/java/android/content/res/Resources.java
27b28b3f62bd3b54fa13acd5d035940b9be464f3 09-Feb-2010 Tobias Haamel <haamel@google.com> Introduce special UI modes for night and car usage.

The device mode is now called ui mode. Furthermore is the order of
precedence for the resources now in such a way that the ui mode needs
to be specified after the orientation and before the density.

The ui mode can be set, like it is done for the locale, as follows:

IActivityManager am = ActivityManagerNative.getDefault();
Configuration config = am.getConfiguration();
config.uiMode = Configuration.UI_MODE_TYPE_CAR | Configuration.UI_MODE_NIGHT_ANY;
am.updateConfiguration(config);

To allow users to disable the car mode and set the night mode the IUiModeManager
interface is used.

The automatic night mode switching will be added in a separate change.
/frameworks/base/core/java/android/content/res/Resources.java
d4a4729c0cac582a2dcec7c8cfb316b81885a0f0 21-Dec-2009 Tom Taylor <tomtaylor@google.com> Update imports to android-common

Several files were moved to android-common. Update all the references
to import those files from the new location.
/frameworks/base/core/java/android/content/res/Resources.java
553399518f39cd9f31f2bb6f502866c3c9d6d1a5 02-Nov-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2226370: Resource versions match with equality

Also fixed turned-around increment of version number for resources. :(

Change-Id: I604137272da984bcd69cee4f174e6b7f2c786e46
/frameworks/base/core/java/android/content/res/Resources.java
3b3e145d3c41fd68974e08f799b1fd1f8f060cf0 25-Sep-2009 Dianne Hackborn <hackbod@google.com> A variety of work on animations.

- The lock screen now fades in and out.
- Fixed a bug where we would accidentally freeze the screen when switching
to an activity with a different orientation than the current (but
the screen itself is in the current orientation). This would mess up
the animations on the car dock.
- New API to force a particular animation for an activity transition
(untested).
- New wallpaper animations.
- Resources now uses the next API version when in a development build,
to help applications being developed against such builds.

Change-Id: I2d9998f8400967ff09a04d693dc4ce55f0dbef5b
/frameworks/base/core/java/android/content/res/Resources.java
c2974809373697147cbe5754835cc871fb93aef1 14-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2116977: buttons are huge and bent

Now that we are using preloaded drawables in compatibilty mode, when
constructing them from their constant state we need to set the new
drawable's target density appropriately.

Change-Id: I3665cbea09d38b9ac5f45f8c380dc8641f86b266
/frameworks/base/core/java/android/content/res/Resources.java
19382ac1a4e4e7c23a1346d299368763f149de9c 12-Sep-2009 Dianne Hackborn <hackbod@google.com> Some optizations to wallpaper drawing/scrolling.

First, fix some issues with the final wallpaper bitmap
we use: ensure it is always 16bpp, and make sure dithering
of its bitmap is turned off. We take of dithering
when loading, to make sure we don't use it when drawing.

Also add new APIs to return the wallpaper with the equivalent
of Launcher's old FastBitmapDrawable. As doing this, also load
the default wallpaper the same way as custom ones, taking care to
resize it as needed at load time.

Finally implement a mechanism for the window manager to wait
for the wallpaper to redraw at its new position before returning
from the application's call to change the offset. This ensures
that the wallpaper better tracks the application. Note that there
is a timeout in this wait that is relatively short, and if it
expires we will run for a while without waiting.

Change-Id: Ife449437746da85958bd447e0a6cf3d2223b398c
/frameworks/base/core/java/android/content/res/Resources.java
8cae124af2142687a6833dbaab8a43df6dd67b43 10-Sep-2009 Dianne Hackborn <hackbod@google.com> Various cleanup around resources and nine-patches.

Remove the stuff that doesn't use preloaded drawables when in
compatibility mode, since this works fine ever since we were able
to deal with drawables in a different density than the canvas.

Change the snapshot function on View to return a snapshot at
the same size that will actually be drawn on screen (when in
compatibility mode), to be able to show scaling artifacts and
all.

This change was original an attempt to fix issue #2101917: Text
field edges appears to be improperly rounded. That turns out to
probably be something deeper in the graphics system, but also
included here is the debugging code I did to try to track down the
problem to make it easy to turn on again later.

Change-Id: I34bfca629639c7ff103f3989d88874112ef778d9
/frameworks/base/core/java/android/content/res/Resources.java
7341d7a104b47996445d069a695e155a07184606 14-Aug-2009 Dianne Hackborn <hackbod@google.com> More work on wallpapers.

- Do better about figuring out when to stop them and other related window
management.
- Fix problem where we were not redrawing the surface when the orientation
changed. This was the cause of the device hang.
/frameworks/base/core/java/android/content/res/Resources.java
a53b828635fce8b6b2d3e3377d74d72070056623 17-Jul-2009 Dianne Hackborn <hackbod@google.com> Add "nodpi" density, and expose a bunch of density-related APIs.

Also update the DpiTest app to use nodpi images, and try to have a mode
where it turns off compatibility though it's not quite working.
/frameworks/base/core/java/android/content/res/Resources.java
ddd12535f095d8d056716c3290faf50ec52a538a 14-Jul-2009 Mitsuru Oshima <oshima@google.com> Return adjusted display for WindowManager.getDefaultDisplay()
/frameworks/base/core/java/android/content/res/Resources.java
ba3ba57921dedaaef669719c0359c0caf60e008b 09-Jul-2009 Mitsuru Oshima <oshima@google.com> * Use cached resources for widgets
/frameworks/base/core/java/android/content/res/Resources.java
569076c9f6bdadb4d3285a26e069634a839b5b87 03-Jul-2009 Mitsuru Oshima <oshima@google.com> widgets scaling fix. Use container's compatibility info and display metrics when container and widgets disagree.
/frameworks/base/core/java/android/content/res/Resources.java
723738cfaec3dd7b0fe152c872c41bebf94074c4 26-Jun-2009 Dianne Hackborn <hackbod@google.com> Expand support for different screen sizes.

Applications can now declare that they support small, normal, or
large screens. Resource selection can also be done based on these
sizes. By default, pre-Donut apps are false for small and large,
and Donut or later apps are assumed to support all sizes. In either
case they can use <supports-screens> in their manifest to declare
what they actually support.
/frameworks/base/core/java/android/content/res/Resources.java
64f59342d41849bd365cb43fad7505d5e3daa417 21-Jun-2009 Mitsuru Oshima <oshima@google.com> * new screen resolution support impl.
* use full window for activities, and shift & clip the content
* refactored the compatibility code, and introdcued Translator class to handle cooridnate translations.
* removed a workaround to handle an activity with configChagne=rotation in old implementation.
* I'll fix background issue on rotation in next CL.

* removed unnecessary scaling code in SurfaceView, which I forgot to remove when I changed SurfaceView
not to scale the content.
/frameworks/base/core/java/android/content/res/Resources.java
fdbf6a7eac39a23e0e910c29678fe00d4eb56c99 19-Jun-2009 Romain Guy <romainguy@android.com> Fixes #1922373. Resolves a case of keys collision in Resources' cache.

The Resources class keeps a cache of known resources. The keys used by the
cache are stored as int primitives. For any given drawable resource, a key
is built thusly:

TypeValue.assetCookie << 24 | TypedValue.data

In the case of a plain color drawable, assetCookie always equals -1, that
is 0xFF once right-shifted and the data contains the color value. Which
means the key for the following two colors is the same:

0xFF000000
0x00000000

Because of the int storage and the use of the (constant in this case)
asset cookie, the alpha channel of a color is ignored. That means that
if you first load an opaque black color (0xFF000000), subsequent loads
of a totally transparent black color (0x00000000) will give you an
opaque black color.

A workaround is to use a transparent color that is not black,
0x00000001 for instance. Note that this issue would arise with any color
and any opacity level.

The solution to fix this issue is simply to change the cache to use
longs instead of ints to represent the keys. A key thus becomes:

TypedValue.assetCookie << 32 | TypedValue.data

This allows us correct storage of all colors at the cost of a few bytes.
The tradeoff is that we can keep caching ColorDrawable, which is
definitely worth it.
/frameworks/base/core/java/android/content/res/Resources.java
e5fb328825995aa33b5b7ecf8b5bee2b17f81715 10-Jun-2009 Mitsuru Oshima <oshima@google.com> resolution support fix/improvement
* adding compatibility menu
* backup gravity
* set expanable=true if the screen size is hvga * density.
* added "supports any density" mode. I'll add sdk check later.
* disallow to catch orientation change event if the app is not expandable. This
was causing layout problem under non-expandable mode. I discussed this with Mike C
and we agreed to do this approach for now. We'll revisit if this causes problem to
a lot of applications.
/frameworks/base/core/java/android/content/res/Resources.java
9189cabb0b6c6c28232fe6f412b7ba7a37352a6a 03-Jun-2009 Mitsuru Oshima <oshima@google.com> * Moved supports-density tag under manifest
* Refactored Compatibility code
* Added CompatibilityInfo class
* Removed getApplicationScale from Context
* Added Resources#getCompatibilityInfo so that RootView can get the compatibility info w/o going through Context
* Expandable support
* Added expandable tag under manifest
* Old application w/o expandable is given the default screen size ([320, 480] x density).
* The non-expandable window is centered.
/frameworks/base/core/java/android/content/res/Resources.java
8169daed2f7a8731d478b884b1f455c747b88478 29-Apr-2009 Mitsuru Oshima <> AI 147976: Compatibility mode support. Part 2.
* Introduced ApplicationScale (may not be good name. CompatibilityScale? CanvasScale? Pls let me know if you have better idea)
* Changes to RootView / SurfaceView
- Makes the app believe it's running in the supported density/resolution.
- Makes the window manager believe it's running at the right density/resolution.
* Added methods to Rect/Event for scaling up/down.
Known issues:
* certain kind of images (such as nine patch for buttons) seesm to be loaded not by app, thus does not take the scale into account,
which, in turn, is causing layout issue.
* ZoomButton in MapView is rendered in wrong place
* Transparent region on Surface is not correct
* Specifying different densities in one process is not working.
BUG=1770627

Automated import of CL 147976
/frameworks/base/core/java/android/content/res/Resources.java
f8a7ceaef2e7d5cd530c9426bde91b6fa9a40b75 11-Apr-2009 Andy Stadler <> AI 145778: Manual merge changes 145382-145384 from cupcake.

Automated import of CL 145778
/frameworks/base/core/java/android/content/res/Resources.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/content/res/Resources.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/content/res/Resources.java
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/core/java/android/content/res/Resources.java
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/core/java/android/content/res/Resources.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/java/android/content/res/Resources.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/content/res/Resources.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/content/res/Resources.java