AUPT is triggering an fdsan diagnostic when creating a temporary
ParcelFileDescriptor to write to a Parcel. This code seems correct at
first glance, so under the assumption that some other code is closing
the file descriptor out from under us, keep our owned file descriptor
around as a ParcelFileDescriptor to catch the perpetrator in the act.
Bug: http://b/112405224
Test: atest MemoryIntArrayTest
(testAshmemSizeMatchesMemoryIntArraySize failed/crashed before, fails now)
Change-Id: Ie8ff7562c78ecde4cf1757d572ecb733213cc975
The existing appendWhere() methods aren't very friendly for
developers, since they require manual tracking of state to decide if
subsequent standalone chunks should be prefixed with "AND".
While it's tempting to offer direct argument binding on the builder
class, we can't really deliver on that API in a secure way, so instead
add separate bindSelection() method which explicitly burns arguments
into a standalone selection string, which can then be appended to
the builder.
This was the last piece of new functionality being used by
SQLiteStatementBuilder, so we can delete that class and migrate
users back to SQLiteQueryBuilder.
Bug: 111268862
Test: atest frameworks/base/core/tests/coretests/src/android/database/DatabaseUtilsTest.java
Test: atest frameworks/base/core/tests/utiltests/src/com/android/internal/util/ArrayUtilsTest.java
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Change-Id: I418f24338c90bae8a9dad473fa76329cea00a8c5
Developers often accept selection clauses from untrusted code, and
SQLiteQueryBuilder already supports a "strict" mode to help catch
SQL injection attacks. This change extends the builder to support
update() and delete() calls, so that we can help secure those
selection clauses too.
Extend it to support selection arguments being provided when
appending appendWhere() clauses, meaning developers no longer need
to manually track their local selection arguments along with
remote arguments.
Extend it to support newer ContentProvider.query() variant that
accepts "Bundle queryArgs", and have all query() callers flow
through that common code path. (This paves the way for a future
CL that will offer to gracefully extract non-WHERE clauses that
callers have tried smashing into their selections.)
Updates ContentValues to internally use more efficient ArrayMap.
Bug: 111268862
Test: atest frameworks/base/core/tests/utiltests/src/com/android/internal/util/ArrayUtilsTest.java
Test: atest cts/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
Change-Id: I60b6f69045766bb28d2f21a32c120ec8c383b917
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.
Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.
Test: make relevant packages
Bug: 73535841
Change-Id: I4233b9091d9066c4fa69f3d24aaf367ea500f760
Previous changes statically included legacy-android-test in preparation
for removing android.test.* and junit.* classes from the android.jar.
Unfortunately, that lead to duplicate classes between APKs and the
bootclasspath which caused build problems (Proguard) and also runtime
problems (when targeting and running on older releases).
Switching from statically including the classes to using the runtime
libraries cannot be done in one step because legacy-android-test is
statically included in libraries which are used in many APKs and so
removing it from those libraries requires that all APKs be updated at
once. Doing that atomically across dozens of projects is not practical.
This change modifies APKS that statically include the
legacy-android-test library indirectly.
* If the APK manifest uses the android.test.runner library then the APK
is modified to stop statically including legacy-android-test and
instead build against android.test.base/mock/runner libraries instead.
* Otherwise, the APK statically includes legacy-android-test.
Also, any libraries that statically include are modified to stop
statically including it and if it has source dependencies on the classes
is changed to build against the android.test.base/mock/runner libraries.
The following change descriptions were generated automatically and so
may be a little repetitive. They are provided to give the reviewer
enough information to check the comments match what has actually been
changed and check the reasoning behind the changes.
* cmds/uiautomator/instrumentation/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because uiautomator-instrumentation is not a package so does not
need to statically include the classes
* cmds/uiautomator/library/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
uiautomator.core has a source dependency on its classes
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because uiautomator.core is not a package so does not need to
statically include the classes
* core/tests/BroadcastRadioTests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
BroadcastRadioTests's source depends on its classes and because of
these changes they are no longer present on the compilation path.
The classes do not need to be statically included because the
classes will be provided by the runtime, either from the default
bootclasspath or from the android.test.runner library that
BroadcastRadioTests specifies in its manifest.
* core/tests/coretests/Android.mk
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because FrameworksCoreTests's source depends
on their classes and because of these changes they are no longer
present on the compilation path. The classes do not need to be
statically included because the classes will be provided by the
runtime, either from the default bootclasspath or from the
android.test.runner library that FrameworksCoreTests specifies in
its manifest.
* core/tests/featureflagtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksCoreFeatureFlagTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that FrameworksCoreFeatureFlagTests specifies in its manifest.
* core/tests/systemproperties/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksCoreSystemPropertiesTests's source depends on its classes
and because of these changes they are no longer present on the
compilation path. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that FrameworksCoreSystemPropertiesTests specifies in its manifest.
* core/tests/utillib/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because frameworks-core-util-lib is not a package so does not need
to statically include the classes
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
frameworks-core-util-lib has a source dependency on its classes
* core/tests/utiltests/Android.mk
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because FrameworksUtilTests's source depends
on their classes and because of these changes they are no longer
present on the compilation path. The classes do not need to be
statically included because the classes will be provided by the
runtime, either from the default bootclasspath or from the
android.test.runner library that FrameworksUtilTests specifies in
its manifest.
* location/tests/locationtests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksLocationTests's source depends on its classes and because
of these changes they are no longer present on the compilation
path. The classes do not need to be statically included because the
classes will be provided by the runtime, either from the default
bootclasspath or from the android.test.runner library that
FrameworksLocationTests specifies in its manifest.
* lowpan/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksLowpanApiTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that FrameworksLowpanApiTests specifies in its manifest.
* packages/Osu2/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
OsuTests's source depends on its classes and because of these
changes they are no longer present on the compilation path. The
classes do not need to be statically included because the classes
will be provided by the runtime, either from the default
bootclasspath or from the android.test.runner library that OsuTests
specifies in its manifest.
* packages/SettingsProvider/test/Android.mk
Replaced 'legacy-android-test' with 'android.test.base' in
LOCAL_JAVA_LIBRARIES because SettingsProviderTest's source depends
on its classes. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that SettingsProviderTest specifies in its manifest.
* services/tests/notification/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksNotificationTests's source depends on its classes and
because of these changes they are no longer present on the
compilation path. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that FrameworksNotificationTests specifies in its manifest.
* services/tests/servicestests/Android.mk
Replaced 'legacy-android-test' with 'android.test.base' and
'android.test.runner' in LOCAL_JAVA_LIBRARIES because
FrameworksServicesTests's source depends on their classes. The
classes do not need to be statically included because the classes
will be provided by the runtime, either from the default
bootclasspath or from the android.test.runner library that
FrameworksServicesTests specifies in its manifest.
* services/tests/shortcutmanagerutils/Android.mk
Added 'android.test.runner.stubs' to LOCAL_JAVA_LIBRARIES because
ShortcutManagerTestUtils has a source dependency on its classes
* tests/AppLaunch/Android.mk
Replaced 'legacy-android-test' with 'android.test.base' and
'android.test.runner' in LOCAL_JAVA_LIBRARIES because AppLaunch's
source depends on their classes. The classes do not need to be
statically included because the classes will be provided by the
runtime, either from the default bootclasspath or from the
android.test.runner library that AppLaunch specifies in its
manifest.
* tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.mk
Replaced 'legacy-android-test' with 'android.test.base' in
LOCAL_JAVA_LIBRARIES because SmartCamera-tests's source depends on
its classes. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that SmartCamera-tests specifies in its manifest.
* tests/ServiceCrashTest/Android.mk
Replaced 'legacy-android-test' with 'android.test.base' in
LOCAL_JAVA_LIBRARIES because ServiceCrashTest's source depends on
its classes. The classes do not need to be statically included
because the classes will be provided by the runtime, either from
the default bootclasspath or from the android.test.runner library
that ServiceCrashTest specifies in its manifest.
* tests/net/Android.mk
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because FrameworksNetTests's source depends on
their classes and because of these changes they are no longer
present on the compilation path. The classes do not need to be
statically included because the classes will be provided by the
runtime, either from the default bootclasspath or from the
android.test.runner library that FrameworksNetTests specifies in
its manifest.
* tests/testables/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because testables is not a package so does not need to statically
include the classes
Added 'android.test.mock' to LOCAL_JAVA_LIBRARIES because testables
has a source dependency on its classes
* tests/utils/testutils/Android.mk
Removed legacy-android-test from LOCAL_STATIC_JAVA_LIBRARIES
because frameworks-base-testutils is not a package so does not need
to statically include the classes
Added 'android.test.base' and 'android.test.mock' to
LOCAL_JAVA_LIBRARIES because frameworks-base-testutils has a source
dependency on their classes
* wifi/tests/Android.mk
Added 'android.test.base' to LOCAL_JAVA_LIBRARIES because
FrameworksWifiApiTests's source depends on its classes and because
of these changes they are no longer present on the compilation
path. The classes do not need to be statically included because the
classes will be provided by the runtime, either from the default
bootclasspath or from the android.test.runner library that
FrameworksWifiApiTests specifies in its manifest.
Bug: 30188076
Test: make checkbuild
Change-Id: Ia6a48234f28e7e1789049cf4b37cd7fe0bc8251c
The quitNow method places the SM_QUIT_CMD at the front
of the queue. This can cause StateMachine to throw exception
if it has not yet processed the SM_INIT_CMD from start().
Bug: 67370902
Test: make checkbuild
Test: StateMachineTest unittest
Test: build/install on device, toggle bluetooth and wifi
Change-Id: I7cec7bb91e0447e3c565d33cb7c34ccf59566639
The WakeupMessage object provides a mechanism to create an Alarm
which will wake-up the device and deliver a message to a Handler.
Add a Runnable mechanism as an alternative to the message.
Bug: 67276378
Test: unit test
Change-Id: Icf5f03b2b25a340273f9d3fcd09f182216ea6238
clang is the default compiler since Android nougat
Test: mma & verified it´s still build with clang
Change-Id: I9bfe0668eddf51dd56174fefc650a11002d38196
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
Filenames can be calculated from other fields, so there's no need to
store them.
This will reduce the average EntryFile size from 160b to 28b, so in theory
it could save 132 KB for 1000 entries.
- Also switched from HashMap to ArrayMap, which should help a bit too.
- Also fixed unit tests and added more.
Bug: 20890386
Test: bit FrameworksServicesTests:com.android.server.DropBoxTest
Test: Boot, check the dropbox directory, run dumpsys dropbox, reboot and repeat.
Change-Id: If567750f478318acd621864d1d4ef2ed41f214bd
In this CL, we add two public static final Strings to MetadataReader. I
use these to put in an "extras" bundle into our highest level bundle.
Within that extras bundle is the Latitude and Longitude values, if
available.
Bug: 63906073
Test: In Place
Change-Id: I1feccb4444d6525f9bc8bddfe8cc73b098e0b90e
In this CL, I'm adding ability to retrieve image metadata. I've added
the class MetadataRetriever that can currently retrieve Exif data from
an image. This class is used withing FileSystemProvider in order to
return a given image's exif data.
Test: Hidden API
Bug: 62621970
Change-Id: Ibb329492df4db1a65f65722c6a52582c43de8fe5
The UPDATE_DEVICE_STATS permission has become the de-facto mechanism
that platform components use to shift blame for resource usage, so
it's confusing to also have a separate MODIFY_NETWORK_ACCOUNTING
permission. So this change replaces MODIFY_NETWORK_ACCOUNTING with
UPDATE_DEVICE_STATS.
Bug: 62483389
Test: builds, boots
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I872759f02327b6d531ec2338bd876890aded60ad
Apps with a normal UID are typically isolated enough to not require
socket tagging; we're mostly interested in tracking down internal
UIDs that have lots of code sharing the same UID.
Also fix up everyone doing manual string checks of Build.TYPE, since
we now have first-class fields for those.
Bug: 38126076
Test: builds, boots
Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
Part of the work of removing JUnit and dependent android.test classes
from the Android API involves providing a static library that developers
can include in their test applications to ease migration. That library
will be built directly from the source (as opposed to android.jar which
is built from stubs) and so developers will be able to see classes and
methods that are not present in the stubs. This change is one of a
number of similar changes that cleanup the existing non-API code in
order to minimize the additional methods and classes exposed externally.
The basic approach is to remove unused classes and methods, use least
visible access modifier possible and generally minimize the amount of
publicly visible code.
The HasClassAnnotation and HasMethodAnnotation were never used
separately and only used by HasAnnotation. This merges the functionality
into a single nested class in TestPredicates, hidden behind the new
TestPredicates.hasAnnotation(). The HasAnnotationTest was renamed as
TestPredicatesTest and the HasClassAnnotationTest and
HasMethodAnnotationTest classes were removed as their tests provide no
additional coverage. The removal of the Has*Annotation.java files means
that the test-runner/src/android/test/suitebuilder/annotation/ directory
is empty apart from the package.html file so that was moved to
legacy-test to sit alongside the actual annotation classes.
The Predicates class, while part of the legacy-test module was only
ever used by the test-runner module and only its not() method was
actually used. So, the not() method and associated nested class were
moved to TestPredicates, the tests for not() were moved to
TestPredicatesTest and the Predicates* classes were removed.
That allowed for the removal of the legacy-android-tests as that is now
empty.
TestPredicates has a number of constants that were public. They were
hidden by moving them to the class that actually used them.
A minor generic issue was fixed in AssignableFrom.
Bug: 30188076
Test: make checkbuild and run FrameworkTestRunnerTests
Change-Id: I861da388a4146bb28e1e480d1b7ba9137b7b270e
These classes are only used by android.test classes that are
being removed. As their name suggests they should not be in the
Android API at all so it makes sense to remove them. Especially
as there is java.lang.function.Predicate available now.
It appears as though Predicate was only added in to the API
because it was used by a method in the API as the directory in
which it and Predicates live was not on the list of classes to
explicitly index. Moving it into legacy-test meant that they are
now being indexed explicitly which means that Predicates needs
to be hidden.
Keeps running the tests as part of the existing target.
At runtime apps targeted at the API version before these are
removed will have the legacy-test library automatically added
to their classpath so they should see no effect. Apps that
target a later API will have to include those classes from the
android.legacy.test.jar which will contain all the android.test
classes that depend on it as well.
Bug: 30188076
Test: make checkbuild
Change-Id: I6f6f5f16fe93bd80227a450c6254166632fc6813
This patch adds several utility methods to IntArray and LongArray to
make them more useful in the context of a Parcelable class.
More specifically, it is now possible to parcel and unparcel a
{Int, Long}Array with the following one liners:
- mIntArray = IntArray.wrap(parcel.createIntArray());
- parcel.writeIntArray(mIntArray.toArray());
This patch also
- adds unit tests for IntArray and LongArray.
- adds a method for setting a field at a given index.
- adds a method for changing the effective array length.
- adds missing bound checks for negative index values.
Test: added test coverage
Bug: 34901696
Change-Id: Ia0febf4dae048b0a45c75310b5d90b56499320da
The current implementation of the toString()
method calls dump(). This causes two problems:
1. toString() may return a large string. This
is at odds with the advice in the documentation
for Object.toString(), which says that the
returned String should be concise, and easy
to read.
2. The dump() method is overriden by many of the
StateMachine subclasses. Some of those subclasses
have dump() implementations that are expensive,
and/or have dependencies on other objects.
To resolve these problems, we simpify
StateMachine.toString().
Along the way: remove a stale comment about
implementing dump() using toString().
Note: only ran the StateMachine tests, since some
other tests are already failing.
Bug: 36661851
Test: tests/utiltests/runtests.sh \
-e class com.android.internal.util.StateMachineTest
Change-Id: I5c16c650f01178c4d018b6a65e4aa95fb905aff6
Make it easier to run the tests, so that more people
will run them.
Bug: 36698401
Test: tests/utiltests/runtests.sh \
-e class com.android.internal.util.StateMachineTest
Change-Id: I3151fb6b2f609f45c7d8154b51f13cce58ccdc13
TouchLatency is needed by test TouchLatencyJankTestWear
UiBench is needed by test UiBenchJankTests
Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#
Bug: 35882476
Test: local test
make -j32 TouchLatency TouchLatencyJankTestWear && \
tradefed.sh run template/local --template:map test=TouchLatencyJankTestWear \
--test-tag testname --log-level-display VERBOSE
make -j32 UiBenchJankTests UiBench && \
tradefed.sh run template/local --template:map test=UiBenchJankTests \
--test-tag testname --log-level-display VERBOSE
Change-Id: I63f23e3a21ad1343607953958fb7bb0a5fb8c343
* commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1': (35 commits)
NetworkMonitor: send one DNS probe per web probe
NetworkMonitor metrics: add first validation information
APF: also drop any ICMPv6 RSs
ConnectivityServiceTest: fix testAvoidBadWifiSettings
Fix ConnectivityServiceTest testRequestBenchmark
Switch over to new "time.android.com" NTP pool.
Define API for metering network stats buckets.
Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
Use @Ignore to explicitly disable a @Test method.
Fixed NetworkStatsServiceTest and converted it to JUnit4.
VPN network stat accounting changes.
ConnectivityThread: use lazy holder idiom
ConnectivityManager: use ConnectivityThread looper
ConnectivityManager: a simpler CallbackHandler
Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Add a null check for the OnStartTetheringCallback.
TokenBucket for rate-limiting and throttling
IpConnectivityMetrics reads buffer size in settings
CaptivePortalLogin: set mixed content policy to compatibility.
Add IP conn metrics to dumpsys and bug reports
...