90 Commits

Author SHA1 Message Date
KOUSHIK PANUGANTI
4bb5f3a58e Migrate frameworks/base/core/tests/utiltests to androidx.test
See go/jetpack-test-android-migration

Test: make checkbuild
Change-Id: I9582eb2f46761a34a12a90a0d27124afc19b312b
2018-12-18 02:32:56 +00:00
Josh Gao
ff39377b5c Merge "MemoryIntArray: track the owned file descriptor in a PFD." am: dccbfca194 am: 873c70a8fd am: 1fb65f1798
am: 461fb59073

Change-Id: Ie5c01958466b3ba1612defd0e0a8b7ec79098d1c
2018-08-10 17:19:22 -07:00
Josh Gao
c81f53f7f1 MemoryIntArray: track the owned file descriptor in a PFD.
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
2018-08-09 16:32:42 -07:00
Jeff Sharkey
b89df9eac8 Support for appending "standalone" WHERE chunks.
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
2018-07-27 13:45:51 -06:00
Jeff Sharkey
6adc98c09c Extend SQLiteQueryBuilder for update and delete.
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
2018-07-13 18:11:37 -06:00
Nicolas Geoffray
b0284fb5de Exempt tests for hidden APIs.
Bug: 64382372
Bug: 74963051
Test: m
Change-Id: I5234dd6230f2bdd6ffccbf12b25a02d929d20161
2018-04-06 14:54:39 +01:00
jdesprez
60b0348c3d Update a bunch of AndroidTest for apct suite
Test: build device-tests
Bug: 74440293
Change-Id: I3c64eb8b5b2932632dd5dd46a5894a68a4835790
2018-03-14 10:03:56 -07:00
Anton Hansson
ab6ec61251 frameworks/base: Set LOCAL_SDK_VERSION where possible.
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
2018-02-28 15:13:23 +00:00
Paul Duffin
2710ca1e9d Flatten dependency hierarchy of legacy-android-test
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
2017-12-07 07:38:59 +00:00
TreeHugger Robot
15c45c854e Merge "Fix StateMachine init/quit race." 2017-10-30 22:57:47 +00:00
Calvin On
dce6e5dfd4 Fix StateMachine init/quit race.
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
2017-10-26 14:07:31 -07:00
Etan Cohen
de7c2e88ad Merge "Add Runnable mechanism to WakeupMessage" am: 5964b55654 am: d870cd33f5 am: b4e455552f
am: 4655548617

Change-Id: Ifb271f45a06399315f55b8fff7abd0e2a56dab8e
2017-10-21 02:46:29 +00:00
Etan Cohen
4655548617 Merge "Add Runnable mechanism to WakeupMessage" am: 5964b55654 am: d870cd33f5
am: b4e455552f

Change-Id: Iff399d348193b8028e3927c1003d887c211470fb
2017-10-21 02:35:29 +00:00
Etan Cohen
d870cd33f5 Merge "Add Runnable mechanism to WakeupMessage"
am: 5964b55654

Change-Id: Iab0414f644223d69602e8e93a636eaa46137d873
2017-10-21 02:17:30 +00:00
Etan Cohen
1861ea9df4 Add Runnable mechanism to WakeupMessage
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
2017-10-20 13:32:00 -07:00
Lennart Wieboldt
602716ffa0 Merge "tests: remove LOCAL_CLANG" am: e77be9c610 am: 24b36003d4 am: 7599be2e67
am: 61079e7685

Change-Id: I24b5e3bec0f8c2e46e7ad1deb6f32595e5aa3566
2017-09-11 16:01:51 +00:00
Lennart Wieboldt
61079e7685 Merge "tests: remove LOCAL_CLANG" am: e77be9c610 am: 24b36003d4
am: 7599be2e67

Change-Id: I5f2388ec80aa9aad27ef264c9012e27faaece08e
2017-09-10 18:02:40 +00:00
Lennart Wieboldt
24b36003d4 Merge "tests: remove LOCAL_CLANG"
am: e77be9c610

Change-Id: Ie2b3d0c5a6c0f30e8fd768720fb6a9e4ca45e207
2017-09-10 17:42:08 +00:00
Lennart Wieboldt
9eb1bc05ac tests: remove LOCAL_CLANG
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>
2017-09-10 11:54:23 +02:00
Makoto Onuki
2eee04d2c2 Merge "DropBoxManagerService: Don't store redundant information" into oc-mr1-dev am: 75590ffa84
am: bb4f580494

Change-Id: I204695ecd43fe86eb6837098556aa1e7c0db354f
2017-08-10 01:33:09 +00:00
Makoto Onuki
ff94e0351a DropBoxManagerService: Don't store redundant information
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
2017-08-09 12:07:40 -07:00
Julian Mancini
a83cc4582f Add support for simpler Lat/Long values
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
2017-07-27 10:21:23 -07:00
TreeHugger Robot
dc751a3867 Merge "Add provider support for metadata extraction" 2017-07-20 00:29:59 +00:00
Julian Mancini
b65051579f Add provider support for metadata extraction
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
2017-07-19 15:46:23 -07:00
Christine Franks
645011f5fa Merge "Disable lock screen by default for demo users" into oc-dr1-dev am: 205585e574
am: 6b43433062

Change-Id: I9e00e9e2771ba8c2a271c12e8213debbca96b9aa
2017-07-18 23:40:43 +00:00
Christine Franks
6b43433062 Merge "Disable lock screen by default for demo users" into oc-dr1-dev
am: 205585e574

Change-Id: I05eeee1b997916e0f8fa86614aaac3d0e395a35c
2017-07-18 23:30:29 +00:00
Jeff Sharkey
9f09e6a73d Unify permissions under UPDATE_DEVICE_STATS.
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
2017-07-17 16:10:55 -06:00
Christine Franks
5856be889f Disable lock screen by default for demo users
Bug: 62712426
Test: frameworks/base/core/tests/utiltests/runtests.sh \
-e class com.android.internal.util.LockPatternUtilsTest
Change-Id: Ic2e00a2a73f160c27e4059f32e5a1d18ebc298a5
2017-07-17 09:37:20 -07:00
Jeff Sharkey
5ab0243330 Only require that system UIDs tag their sockets.
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
2017-06-27 11:11:06 -06:00
Paul Duffin
4f9d89a380 Merge "Clean up Predicate related code in android.test" into oc-dev-plus-aosp
am: 50826c5f2e

Change-Id: Ica9b9b478b670ec5467732a09cf123dd63780c97
2017-06-26 13:21:28 +00:00
Paul Duffin
fedb4b7456 Clean up Predicate related code in android.test
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
2017-06-22 15:48:44 +01:00
Paul Duffin
413d371991 Merge "Moved c.a.i.u.Predicate[s] into legacy-test" into oc-dev-plus-aosp
am: e5573b54cb

Change-Id: I7c86684028d38f33e062a47ca92e7db2c6a6f3cf
2017-05-15 10:52:54 +00:00
Paul Duffin
f71d5b5b18 Moved c.a.i.u.Predicate[s] into legacy-test
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
2017-05-12 15:35:11 +01:00
Hugo Benichi
ada3f6b8f1 Merge "Improve utility of IntArray and LongArray" am: 35786735df am: e718797a37 am: 4ca1cb7c10
am: 6f75cb52e8

Change-Id: I82032bf85861cfc8aebffd9e49796fb61b5a19ed
2017-04-10 01:46:36 +00:00
Hugo Benichi
6f75cb52e8 Merge "Improve utility of IntArray and LongArray" am: 35786735df am: e718797a37
am: 4ca1cb7c10

Change-Id: If206b2b4d837dbbb8d0fd0c9a75fad240bb5379e
2017-04-10 01:36:20 +00:00
Hugo Benichi
35786735df Merge "Improve utility of IntArray and LongArray" 2017-04-10 01:09:04 +00:00
Hugo Benichi
112962a6b0 Improve utility of IntArray and LongArray
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
2017-04-07 13:18:16 +09:00
Dan Shi
1fee398b88 Change test type from InstrumentationTest to AndroidJUnitTest
Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test

Change-Id: Ic3c4c7a9d29ef9d32a407f31cfc93c5e43650297
2017-03-31 16:02:33 -07:00
Mukesh Agrawal
d194a1877a Merge changes I5c16c650,I3151fb6b am: 55efea25f3 am: ad2684ca3d
am: 6b29b1c256

Change-Id: I08019c46a433b5ea64a561d374df445d50400d45
2017-03-29 18:41:16 +00:00
Mukesh Agrawal
ad2684ca3d Merge changes I5c16c650,I3151fb6b
am: 55efea25f3

Change-Id: Ifaaae29780d905ffe9f82645d6d17dad478ba6a9
2017-03-29 18:30:00 +00:00
mukesh agrawal
47e1c7a005 StateMachine: make toString() terser
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
2017-03-28 18:21:36 -07:00
mukesh agrawal
28882ed5d5 utiltests: add script to run tests
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
2017-03-28 18:21:35 -07:00
Dan Shi
7f2afd2dff Add test configs to apct tests under frameworks/base
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
2017-03-21 00:05:14 -07:00
Paul Duffin
6cd440c574 Merge "Partial Revert "Replace com.android.internal.util.Predicate with java.util.function.Predicate"" am: 621ebe692f am: a2c92b0b88 am: c1a93884dc
am: 8faed45024

Change-Id: I9d047f2e7bd8dfb14bf7b1f8c82ce6721e105198
2017-02-09 20:02:25 +00:00
Paul Duffin
c1a93884dc Merge "Partial Revert "Replace com.android.internal.util.Predicate with java.util.function.Predicate"" am: 621ebe692f
am: a2c92b0b88

Change-Id: I605588603280ff0b4ebc1088c6c1f1c933c1e657
2017-02-09 19:32:58 +00:00
Paul Duffin
57e490cf8c Partial Revert "Replace com.android.internal.util.Predicate with java.util.function.Predicate"
This partially reverts commit 3e5fbca0c57742f28f5c7e6bda6c3500b9471b47.

Bug: 35187548
Bug: 30188076
Bug: 35089332
Test: make checkbuild
Change-Id: I7ab4279aab604e3d56003b0a59867948aebabd28
2017-02-09 14:52:43 +00:00
Paul Duffin
9250814fd2 Merge "Replace com.android.internal.util.Predicate with java.util.function.Predicate" am: 78a20be77a
am: 9e99b9ee45

Change-Id: I289950cff0cdc6b5ad301936c7b55eadee5fd0f8
2017-02-08 18:30:17 +00:00
Paul Duffin
ca4964ccbe Replace com.android.internal.util.Predicate with java.util.function.Predicate
Bug: 35089332
Bug: 30188076
Test: make checkbuild
Change-Id: I0a5b4bf520fc39b59d8d790b01e9cff0d54e6d21
2017-02-08 11:55:39 +00:00
Paul Duffin
3e5fbca0c5 Replace com.android.internal.util.Predicate with java.util.function.Predicate
Bug: 35089332
Bug: 30188076
Test: make checkbuild
Merged-In: I0a5b4bf520fc39b59d8d790b01e9cff0d54e6d21
Change-Id: I58e4e35e7b7315033d893748f7c79e1ba6732f39
2017-02-07 16:57:54 +00:00
The Android Automerger
53095bb5bd Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
* 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
  ...
2017-01-27 06:39:05 +00:00