Loading Android.bp +15 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ java_library { "core/java/**/*.java", "graphics/java/**/*.java", "location/java/**/*.java", "lowpan/java/**/*.java", "media/java/**/*.java", "media/mca/effect/java/**/*.java", "media/mca/filterfw/java/**/*.java", Loading @@ -54,8 +55,6 @@ java_library { "core/java/android/accounts/IAccountManagerResponse.aidl", "core/java/android/accounts/IAccountAuthenticator.aidl", "core/java/android/accounts/IAccountAuthenticatorResponse.aidl", "core/java/android/app/IActivityContainer.aidl", "core/java/android/app/IActivityContainerCallback.aidl", "core/java/android/app/IActivityController.aidl", "core/java/android/app/IActivityManager.aidl", "core/java/android/app/IActivityPendingResult.aidl", Loading @@ -67,6 +66,7 @@ java_library { "core/java/android/app/ITaskStackListener.aidl", "core/java/android/app/IBackupAgent.aidl", "core/java/android/app/IEphemeralResolver.aidl", "core/java/android/app/IInputForwarder.aidl", "core/java/android/app/IInstantAppResolver.aidl", "core/java/android/app/IInstrumentationWatcher.aidl", "core/java/android/app/INotificationManager.aidl", Loading Loading @@ -128,6 +128,7 @@ java_library { "core/java/android/content/pm/IPackageInstallerCallback.aidl", "core/java/android/content/pm/IPackageInstallerSession.aidl", "core/java/android/content/pm/IPackageManager.aidl", ":libbinder_aidl", "core/java/android/content/pm/IPackageMoveObserver.aidl", "core/java/android/content/pm/IPackageStatsObserver.aidl", "core/java/android/content/pm/IPinItemRequest.aidl", Loading Loading @@ -220,6 +221,8 @@ java_library { "core/java/android/os/IRecoverySystemProgressListener.aidl", "core/java/android/os/IRemoteCallback.aidl", "core/java/android/os/ISchedulingPolicyService.aidl", "core/java/android/os/IThermalEventListener.aidl", "core/java/android/os/IThermalService.aidl", "core/java/android/os/IUpdateLock.aidl", "core/java/android/os/IUserManager.aidl", "core/java/android/os/IVibratorService.aidl", Loading Loading @@ -390,7 +393,6 @@ java_library { "location/java/android/location/INetInitiatedListener.aidl", "location/java/com/android/internal/location/ILocationProvider.aidl", "media/java/android/media/IAudioService.aidl", ":libmediadrm_aidl", "media/java/android/media/IAudioFocusDispatcher.aidl", "media/java/android/media/IAudioRoutesObserver.aidl", "media/java/android/media/IMediaHTTPConnection.aidl", Loading Loading @@ -515,6 +517,13 @@ java_library { ":netd_aidl", ":installd_aidl", "lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl", "lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl", "lowpan/java/android/net/lowpan/ILowpanInterfaceListener.aidl", "lowpan/java/android/net/lowpan/ILowpanInterface.aidl", "lowpan/java/android/net/lowpan/ILowpanManagerListener.aidl", "lowpan/java/android/net/lowpan/ILowpanManager.aidl", "core/java/android/app/admin/SecurityLogTags.logtags", "core/java/android/content/EventLogTags.logtags", "core/java/android/speech/tts/EventLogTags.logtags", Loading @@ -537,6 +546,7 @@ java_library { "core/java", "graphics/java", "location/java", "lowpan/java", "media/java", "media/mca/effect/java", "media/mca/filterfw/java", Loading @@ -555,7 +565,6 @@ java_library { "system/update_engine/binder_bindings", "frameworks/native/aidl/binder", "frameworks/av/camera/aidl", "frameworks/av/drm/libmediadrm/aidl", "frameworks/native/aidl/gui", "system/netd/server/binder", "system/bt/binder", Loading @@ -572,6 +581,8 @@ java_library { static_libs: [ "framework-protos", "android.hidl.base-V1.0-java", "android.hardware.cas-V1.0-java", "android.hardware.health-V1.0-java-constants", "android.hardware.thermal-V1.0-java-constants", "android.hardware.tv.input-V1.0-java-constants", Loading Android.mk +18 −4 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ aidl_files := \ frameworks/base/core/java/android/print/PrinterInfo.aidl \ frameworks/base/core/java/android/print/PrintJobId.aidl \ frameworks/base/core/java/android/printservice/recommendation/RecommendationInfo.aidl \ frameworks/base/core/java/android/hardware/radio/ProgramSelector.aidl \ frameworks/base/core/java/android/hardware/radio/RadioManager.aidl \ frameworks/base/core/java/android/hardware/radio/RadioMetadata.aidl \ frameworks/base/core/java/android/hardware/usb/UsbDevice.aidl \ frameworks/base/core/java/android/hardware/usb/UsbInterface.aidl \ frameworks/base/core/java/android/hardware/usb/UsbEndpoint.aidl \ Loading @@ -118,6 +120,7 @@ aidl_files := \ frameworks/base/core/java/android/os/DropBoxManager.aidl \ frameworks/base/core/java/android/os/Bundle.aidl \ frameworks/base/core/java/android/os/Debug.aidl \ frameworks/base/core/java/android/os/SharedMemory.aidl \ frameworks/base/core/java/android/os/StrictMode.aidl \ frameworks/base/core/java/android/accessibilityservice/AccessibilityServiceInfo.aidl \ frameworks/base/core/java/android/net/Network.aidl \ Loading Loading @@ -266,12 +269,17 @@ non_base_dirs := \ ../opt/net/voip/src/java/android/net/rtp \ ../opt/net/voip/src/java/android/net/sip \ framework_base_android_test_mock_src_files := \ $(call all-java-files-under, test-runner/src/android/test/mock) framework_base_android_test_runner_excluding_mock_src_files := \ $(filter-out $(framework_base_android_test_mock_src_files), $(call all-java-files-under, test-runner/src)) # Find all files in specific directories (relative to frameworks/base) # to document and check apis files_to_check_apis := \ $(call find-other-java-files, \ legacy-test/src \ test-runner/src \ $(non_base_dirs) \ ) Loading @@ -294,7 +302,9 @@ files_to_check_apis_generated := \ # FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk files_to_document := \ $(files_to_check_apis) \ $(call find-other-java-files,$(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS))) $(call find-other-java-files,\ $(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS)) \ test-runner/src) # These are relative to frameworks/base html_dirs := \ Loading @@ -313,6 +323,8 @@ framework_docs_LOCAL_SRC_FILES := \ # These are relative to frameworks/base framework_docs_LOCAL_API_CHECK_SRC_FILES := \ $(framework_base_android_test_mock_src_files) \ $(framework_base_android_test_runner_excluding_mock_src_files) \ $(files_to_check_apis) \ $(common_src_files) \ Loading @@ -338,7 +350,8 @@ framework_docs_LOCAL_API_CHECK_JAVA_LIBRARIES := \ ext \ icu4j \ framework \ voip-common voip-common \ android.test.mock \ # Platform docs can refer to Support Library APIs, but we don't actually build # them as part of the docs target, so we need to include them on the classpath. Loading Loading @@ -385,7 +398,8 @@ framework_docs_LOCAL_DROIDDOC_OPTIONS := \ -since $(SRC_API_DIR)/24.txt 24 \ -since $(SRC_API_DIR)/25.txt 25 \ -since $(SRC_API_DIR)/26.txt 26 \ -werror -hide 111 -hide 113 -hide 121 \ -since $(SRC_API_DIR)/27.txt 27 \ -werror -lerror -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128 \ -overview $(LOCAL_PATH)/core/java/overview.html \ framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR:= \ Loading apct-tests/perftests/core/src/android/database/CursorWindowPerfTest.java 0 → 100644 +123 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.database; import static org.junit.Assert.assertTrue; import android.content.Context; import android.database.sqlite.SQLiteCursor; import android.database.sqlite.SQLiteDatabase; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.support.test.InstrumentationRegistry; import android.support.test.filters.LargeTest; import android.support.test.runner.AndroidJUnit4; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class CursorWindowPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Context getContext() { return InstrumentationRegistry.getTargetContext(); } private static final String DB_NAME = CursorWindowPerfTest.class.toString(); private static SQLiteDatabase sDatabase; @BeforeClass public static void setup() { getContext().deleteDatabase(DB_NAME); sDatabase = getContext().openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); for (TableHelper helper : TableHelper.TABLE_HELPERS) { sDatabase.execSQL(helper.createSql()); final String insert = helper.insertSql(); // this test only needs 1 row sDatabase.execSQL(insert, helper.createItem(0)); } } @AfterClass public static void teardown() { getContext().deleteDatabase(DB_NAME); } @Test public void loadInt() { loadRowFromCursorWindow(TableHelper.INT_1, false); } @Test public void loadInt_doubleRef() { loadRowFromCursorWindow(TableHelper.INT_1, true); } @Test public void load10Ints() { loadRowFromCursorWindow(TableHelper.INT_10, false); } @Test public void loadUser() { loadRowFromCursorWindow(TableHelper.USER, false); } private void loadRowFromCursorWindow(TableHelper helper, boolean doubleRef) { try (Cursor cursor = sDatabase.rawQuery(helper.readSql(), new String[0])) { TableHelper.CursorReader reader = helper.createReader(cursor); SQLiteCursor sqLiteCursor = (SQLiteCursor) cursor; sqLiteCursor.getCount(); // load one window CursorWindow window = sqLiteCursor.getWindow(); assertTrue("must have enough rows", window.getNumRows() >= 1); int start = window.getStartPosition(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (!doubleRef) { // normal access while (state.keepRunning()) { cursor.moveToPosition(start); reader.read(); } } else { // add an extra window acquire/release to measure overhead while (state.keepRunning()) { cursor.moveToPosition(start); try { window.acquireReference(); reader.read(); } finally { window.releaseReference(); } } } } } } apct-tests/perftests/core/src/android/database/TableHelper.java 0 → 100644 +223 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.database; import java.util.Date; import java.util.UUID; /** * Helper class for creating and querying data from a database in performance tests. * * Subclasses can define different table/query formats. */ public abstract class TableHelper { public interface CursorReader { void read(); } public abstract String createSql(); public abstract String insertSql(); public abstract Object[] createItem(int id); public abstract String readSql(); public abstract CursorReader createReader(Cursor cursor); /** * 1 column, single integer */ public static TableHelper INT_1 = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `Int1` (" + "`a` INTEGER," + " PRIMARY KEY(`a`))"; } @Override public String insertSql() { return "INSERT INTO `Int1`(`a`)" + " VALUES (?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, }; } @Override public String readSql() { return "SELECT * from Int1"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfA = cursor.getColumnIndexOrThrow("a"); return () -> { cursor.getInt(cursorIndexOfA); }; } }; /** * 10 columns of integers */ public static TableHelper INT_10 = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `Int10` (" + "`a` INTEGER," + " `b` INTEGER," + " `c` INTEGER," + " `d` INTEGER," + " `e` INTEGER," + " `f` INTEGER," + " `g` INTEGER," + " `h` INTEGER," + " `i` INTEGER," + " `j` INTEGER," + " PRIMARY KEY(`a`))"; } @Override public String insertSql() { return "INSERT INTO `Int10`(`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`,`j`)" + " VALUES (?,?,?,?,?,?,?,?,?,?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, id + 1, id + 2, id + 3, id + 4, id + 5, id + 6, id + 7, id + 8, id + 9, }; } @Override public String readSql() { return "SELECT * from Int10"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfA = cursor.getColumnIndexOrThrow("a"); final int cursorIndexOfB = cursor.getColumnIndexOrThrow("b"); final int cursorIndexOfC = cursor.getColumnIndexOrThrow("c"); final int cursorIndexOfD = cursor.getColumnIndexOrThrow("d"); final int cursorIndexOfE = cursor.getColumnIndexOrThrow("e"); final int cursorIndexOfF = cursor.getColumnIndexOrThrow("f"); final int cursorIndexOfG = cursor.getColumnIndexOrThrow("g"); final int cursorIndexOfH = cursor.getColumnIndexOrThrow("h"); final int cursorIndexOfI = cursor.getColumnIndexOrThrow("i"); final int cursorIndexOfJ = cursor.getColumnIndexOrThrow("j"); return () -> { cursor.getInt(cursorIndexOfA); cursor.getInt(cursorIndexOfB); cursor.getInt(cursorIndexOfC); cursor.getInt(cursorIndexOfD); cursor.getInt(cursorIndexOfE); cursor.getInt(cursorIndexOfF); cursor.getInt(cursorIndexOfG); cursor.getInt(cursorIndexOfH); cursor.getInt(cursorIndexOfI); cursor.getInt(cursorIndexOfJ); }; } }; /** * Mock up of 'user' table with various ints/strings */ public static TableHelper USER = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `User` (" + "`mId` INTEGER," + " `mName` TEXT," + " `mLastName` TEXT," + " `mAge` INTEGER," + " `mAdmin` INTEGER," + " `mWeight` DOUBLE," + " `mBirthday` INTEGER," + " `mMoreText` TEXT," + " PRIMARY KEY(`mId`))"; } @Override public String insertSql() { return "INSERT INTO `User`(`mId`,`mName`,`mLastName`,`mAge`," + "`mAdmin`,`mWeight`,`mBirthday`,`mMoreText`) VALUES (?,?,?,?,?,?,?,?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, UUID.randomUUID().toString(), UUID.randomUUID().toString(), (int) (10 + Math.random() * 50), 0, (float)0, new Date().getTime(), UUID.randomUUID().toString(), }; } @Override public String readSql() { return "SELECT * from User"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfMId = cursor.getColumnIndexOrThrow("mId"); final int cursorIndexOfMName = cursor.getColumnIndexOrThrow("mName"); final int cursorIndexOfMLastName = cursor.getColumnIndexOrThrow("mLastName"); final int cursorIndexOfMAge = cursor.getColumnIndexOrThrow("mAge"); final int cursorIndexOfMAdmin = cursor.getColumnIndexOrThrow("mAdmin"); final int cursorIndexOfMWeight = cursor.getColumnIndexOrThrow("mWeight"); final int cursorIndexOfMBirthday = cursor.getColumnIndexOrThrow("mBirthday"); final int cursorIndexOfMMoreTextField = cursor.getColumnIndexOrThrow("mMoreText"); return () -> { cursor.getInt(cursorIndexOfMId); cursor.getString(cursorIndexOfMName); cursor.getString(cursorIndexOfMLastName); cursor.getInt(cursorIndexOfMAge); cursor.getInt(cursorIndexOfMAdmin); cursor.getFloat(cursorIndexOfMWeight); if (!cursor.isNull(cursorIndexOfMBirthday)) { cursor.getLong(cursorIndexOfMBirthday); } cursor.getString(cursorIndexOfMMoreTextField); }; } }; public static TableHelper[] TABLE_HELPERS = new TableHelper[] { INT_1, INT_10, USER, }; } apct-tests/perftests/core/src/android/os/ParcelPerfTest.java +55 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,46 @@ public class ParcelPerfTest { } } @Test public void timeGetDataPosition() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataPosition(); } } @Test public void timeSetDataSize() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.setDataSize(0); } } @Test public void timeGetDataSize() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataSize(); } } @Test public void timeSetDataCapacity() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.setDataCapacity(0); } } @Test public void timeGetDataCapacity() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataCapacity(); } } @Test public void timeWriteByte() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); Loading Loading @@ -112,4 +152,19 @@ public class ParcelPerfTest { mParcel.readLong(); } } @Test public void timeObtainRecycle() { // Use up the pooled instances. // A lot bigger than the actual size but in case someone increased it. final int POOL_SIZE = 100; for (int i = 0; i < POOL_SIZE; i++) { Parcel.obtain(); } final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Parcel.obtain().recycle(); } } } Loading
Android.bp +15 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ java_library { "core/java/**/*.java", "graphics/java/**/*.java", "location/java/**/*.java", "lowpan/java/**/*.java", "media/java/**/*.java", "media/mca/effect/java/**/*.java", "media/mca/filterfw/java/**/*.java", Loading @@ -54,8 +55,6 @@ java_library { "core/java/android/accounts/IAccountManagerResponse.aidl", "core/java/android/accounts/IAccountAuthenticator.aidl", "core/java/android/accounts/IAccountAuthenticatorResponse.aidl", "core/java/android/app/IActivityContainer.aidl", "core/java/android/app/IActivityContainerCallback.aidl", "core/java/android/app/IActivityController.aidl", "core/java/android/app/IActivityManager.aidl", "core/java/android/app/IActivityPendingResult.aidl", Loading @@ -67,6 +66,7 @@ java_library { "core/java/android/app/ITaskStackListener.aidl", "core/java/android/app/IBackupAgent.aidl", "core/java/android/app/IEphemeralResolver.aidl", "core/java/android/app/IInputForwarder.aidl", "core/java/android/app/IInstantAppResolver.aidl", "core/java/android/app/IInstrumentationWatcher.aidl", "core/java/android/app/INotificationManager.aidl", Loading Loading @@ -128,6 +128,7 @@ java_library { "core/java/android/content/pm/IPackageInstallerCallback.aidl", "core/java/android/content/pm/IPackageInstallerSession.aidl", "core/java/android/content/pm/IPackageManager.aidl", ":libbinder_aidl", "core/java/android/content/pm/IPackageMoveObserver.aidl", "core/java/android/content/pm/IPackageStatsObserver.aidl", "core/java/android/content/pm/IPinItemRequest.aidl", Loading Loading @@ -220,6 +221,8 @@ java_library { "core/java/android/os/IRecoverySystemProgressListener.aidl", "core/java/android/os/IRemoteCallback.aidl", "core/java/android/os/ISchedulingPolicyService.aidl", "core/java/android/os/IThermalEventListener.aidl", "core/java/android/os/IThermalService.aidl", "core/java/android/os/IUpdateLock.aidl", "core/java/android/os/IUserManager.aidl", "core/java/android/os/IVibratorService.aidl", Loading Loading @@ -390,7 +393,6 @@ java_library { "location/java/android/location/INetInitiatedListener.aidl", "location/java/com/android/internal/location/ILocationProvider.aidl", "media/java/android/media/IAudioService.aidl", ":libmediadrm_aidl", "media/java/android/media/IAudioFocusDispatcher.aidl", "media/java/android/media/IAudioRoutesObserver.aidl", "media/java/android/media/IMediaHTTPConnection.aidl", Loading Loading @@ -515,6 +517,13 @@ java_library { ":netd_aidl", ":installd_aidl", "lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl", "lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl", "lowpan/java/android/net/lowpan/ILowpanInterfaceListener.aidl", "lowpan/java/android/net/lowpan/ILowpanInterface.aidl", "lowpan/java/android/net/lowpan/ILowpanManagerListener.aidl", "lowpan/java/android/net/lowpan/ILowpanManager.aidl", "core/java/android/app/admin/SecurityLogTags.logtags", "core/java/android/content/EventLogTags.logtags", "core/java/android/speech/tts/EventLogTags.logtags", Loading @@ -537,6 +546,7 @@ java_library { "core/java", "graphics/java", "location/java", "lowpan/java", "media/java", "media/mca/effect/java", "media/mca/filterfw/java", Loading @@ -555,7 +565,6 @@ java_library { "system/update_engine/binder_bindings", "frameworks/native/aidl/binder", "frameworks/av/camera/aidl", "frameworks/av/drm/libmediadrm/aidl", "frameworks/native/aidl/gui", "system/netd/server/binder", "system/bt/binder", Loading @@ -572,6 +581,8 @@ java_library { static_libs: [ "framework-protos", "android.hidl.base-V1.0-java", "android.hardware.cas-V1.0-java", "android.hardware.health-V1.0-java-constants", "android.hardware.thermal-V1.0-java-constants", "android.hardware.tv.input-V1.0-java-constants", Loading
Android.mk +18 −4 Original line number Diff line number Diff line Loading @@ -102,7 +102,9 @@ aidl_files := \ frameworks/base/core/java/android/print/PrinterInfo.aidl \ frameworks/base/core/java/android/print/PrintJobId.aidl \ frameworks/base/core/java/android/printservice/recommendation/RecommendationInfo.aidl \ frameworks/base/core/java/android/hardware/radio/ProgramSelector.aidl \ frameworks/base/core/java/android/hardware/radio/RadioManager.aidl \ frameworks/base/core/java/android/hardware/radio/RadioMetadata.aidl \ frameworks/base/core/java/android/hardware/usb/UsbDevice.aidl \ frameworks/base/core/java/android/hardware/usb/UsbInterface.aidl \ frameworks/base/core/java/android/hardware/usb/UsbEndpoint.aidl \ Loading @@ -118,6 +120,7 @@ aidl_files := \ frameworks/base/core/java/android/os/DropBoxManager.aidl \ frameworks/base/core/java/android/os/Bundle.aidl \ frameworks/base/core/java/android/os/Debug.aidl \ frameworks/base/core/java/android/os/SharedMemory.aidl \ frameworks/base/core/java/android/os/StrictMode.aidl \ frameworks/base/core/java/android/accessibilityservice/AccessibilityServiceInfo.aidl \ frameworks/base/core/java/android/net/Network.aidl \ Loading Loading @@ -266,12 +269,17 @@ non_base_dirs := \ ../opt/net/voip/src/java/android/net/rtp \ ../opt/net/voip/src/java/android/net/sip \ framework_base_android_test_mock_src_files := \ $(call all-java-files-under, test-runner/src/android/test/mock) framework_base_android_test_runner_excluding_mock_src_files := \ $(filter-out $(framework_base_android_test_mock_src_files), $(call all-java-files-under, test-runner/src)) # Find all files in specific directories (relative to frameworks/base) # to document and check apis files_to_check_apis := \ $(call find-other-java-files, \ legacy-test/src \ test-runner/src \ $(non_base_dirs) \ ) Loading @@ -294,7 +302,9 @@ files_to_check_apis_generated := \ # FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk files_to_document := \ $(files_to_check_apis) \ $(call find-other-java-files,$(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS))) $(call find-other-java-files,\ $(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS)) \ test-runner/src) # These are relative to frameworks/base html_dirs := \ Loading @@ -313,6 +323,8 @@ framework_docs_LOCAL_SRC_FILES := \ # These are relative to frameworks/base framework_docs_LOCAL_API_CHECK_SRC_FILES := \ $(framework_base_android_test_mock_src_files) \ $(framework_base_android_test_runner_excluding_mock_src_files) \ $(files_to_check_apis) \ $(common_src_files) \ Loading @@ -338,7 +350,8 @@ framework_docs_LOCAL_API_CHECK_JAVA_LIBRARIES := \ ext \ icu4j \ framework \ voip-common voip-common \ android.test.mock \ # Platform docs can refer to Support Library APIs, but we don't actually build # them as part of the docs target, so we need to include them on the classpath. Loading Loading @@ -385,7 +398,8 @@ framework_docs_LOCAL_DROIDDOC_OPTIONS := \ -since $(SRC_API_DIR)/24.txt 24 \ -since $(SRC_API_DIR)/25.txt 25 \ -since $(SRC_API_DIR)/26.txt 26 \ -werror -hide 111 -hide 113 -hide 121 \ -since $(SRC_API_DIR)/27.txt 27 \ -werror -lerror -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128 \ -overview $(LOCAL_PATH)/core/java/overview.html \ framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR:= \ Loading
apct-tests/perftests/core/src/android/database/CursorWindowPerfTest.java 0 → 100644 +123 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.database; import static org.junit.Assert.assertTrue; import android.content.Context; import android.database.sqlite.SQLiteCursor; import android.database.sqlite.SQLiteDatabase; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.support.test.InstrumentationRegistry; import android.support.test.filters.LargeTest; import android.support.test.runner.AndroidJUnit4; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @LargeTest public class CursorWindowPerfTest { @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); private static Context getContext() { return InstrumentationRegistry.getTargetContext(); } private static final String DB_NAME = CursorWindowPerfTest.class.toString(); private static SQLiteDatabase sDatabase; @BeforeClass public static void setup() { getContext().deleteDatabase(DB_NAME); sDatabase = getContext().openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null); for (TableHelper helper : TableHelper.TABLE_HELPERS) { sDatabase.execSQL(helper.createSql()); final String insert = helper.insertSql(); // this test only needs 1 row sDatabase.execSQL(insert, helper.createItem(0)); } } @AfterClass public static void teardown() { getContext().deleteDatabase(DB_NAME); } @Test public void loadInt() { loadRowFromCursorWindow(TableHelper.INT_1, false); } @Test public void loadInt_doubleRef() { loadRowFromCursorWindow(TableHelper.INT_1, true); } @Test public void load10Ints() { loadRowFromCursorWindow(TableHelper.INT_10, false); } @Test public void loadUser() { loadRowFromCursorWindow(TableHelper.USER, false); } private void loadRowFromCursorWindow(TableHelper helper, boolean doubleRef) { try (Cursor cursor = sDatabase.rawQuery(helper.readSql(), new String[0])) { TableHelper.CursorReader reader = helper.createReader(cursor); SQLiteCursor sqLiteCursor = (SQLiteCursor) cursor; sqLiteCursor.getCount(); // load one window CursorWindow window = sqLiteCursor.getWindow(); assertTrue("must have enough rows", window.getNumRows() >= 1); int start = window.getStartPosition(); BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); if (!doubleRef) { // normal access while (state.keepRunning()) { cursor.moveToPosition(start); reader.read(); } } else { // add an extra window acquire/release to measure overhead while (state.keepRunning()) { cursor.moveToPosition(start); try { window.acquireReference(); reader.read(); } finally { window.releaseReference(); } } } } } }
apct-tests/perftests/core/src/android/database/TableHelper.java 0 → 100644 +223 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.database; import java.util.Date; import java.util.UUID; /** * Helper class for creating and querying data from a database in performance tests. * * Subclasses can define different table/query formats. */ public abstract class TableHelper { public interface CursorReader { void read(); } public abstract String createSql(); public abstract String insertSql(); public abstract Object[] createItem(int id); public abstract String readSql(); public abstract CursorReader createReader(Cursor cursor); /** * 1 column, single integer */ public static TableHelper INT_1 = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `Int1` (" + "`a` INTEGER," + " PRIMARY KEY(`a`))"; } @Override public String insertSql() { return "INSERT INTO `Int1`(`a`)" + " VALUES (?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, }; } @Override public String readSql() { return "SELECT * from Int1"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfA = cursor.getColumnIndexOrThrow("a"); return () -> { cursor.getInt(cursorIndexOfA); }; } }; /** * 10 columns of integers */ public static TableHelper INT_10 = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `Int10` (" + "`a` INTEGER," + " `b` INTEGER," + " `c` INTEGER," + " `d` INTEGER," + " `e` INTEGER," + " `f` INTEGER," + " `g` INTEGER," + " `h` INTEGER," + " `i` INTEGER," + " `j` INTEGER," + " PRIMARY KEY(`a`))"; } @Override public String insertSql() { return "INSERT INTO `Int10`(`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`,`j`)" + " VALUES (?,?,?,?,?,?,?,?,?,?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, id + 1, id + 2, id + 3, id + 4, id + 5, id + 6, id + 7, id + 8, id + 9, }; } @Override public String readSql() { return "SELECT * from Int10"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfA = cursor.getColumnIndexOrThrow("a"); final int cursorIndexOfB = cursor.getColumnIndexOrThrow("b"); final int cursorIndexOfC = cursor.getColumnIndexOrThrow("c"); final int cursorIndexOfD = cursor.getColumnIndexOrThrow("d"); final int cursorIndexOfE = cursor.getColumnIndexOrThrow("e"); final int cursorIndexOfF = cursor.getColumnIndexOrThrow("f"); final int cursorIndexOfG = cursor.getColumnIndexOrThrow("g"); final int cursorIndexOfH = cursor.getColumnIndexOrThrow("h"); final int cursorIndexOfI = cursor.getColumnIndexOrThrow("i"); final int cursorIndexOfJ = cursor.getColumnIndexOrThrow("j"); return () -> { cursor.getInt(cursorIndexOfA); cursor.getInt(cursorIndexOfB); cursor.getInt(cursorIndexOfC); cursor.getInt(cursorIndexOfD); cursor.getInt(cursorIndexOfE); cursor.getInt(cursorIndexOfF); cursor.getInt(cursorIndexOfG); cursor.getInt(cursorIndexOfH); cursor.getInt(cursorIndexOfI); cursor.getInt(cursorIndexOfJ); }; } }; /** * Mock up of 'user' table with various ints/strings */ public static TableHelper USER = new TableHelper() { @Override public String createSql() { return "CREATE TABLE `User` (" + "`mId` INTEGER," + " `mName` TEXT," + " `mLastName` TEXT," + " `mAge` INTEGER," + " `mAdmin` INTEGER," + " `mWeight` DOUBLE," + " `mBirthday` INTEGER," + " `mMoreText` TEXT," + " PRIMARY KEY(`mId`))"; } @Override public String insertSql() { return "INSERT INTO `User`(`mId`,`mName`,`mLastName`,`mAge`," + "`mAdmin`,`mWeight`,`mBirthday`,`mMoreText`) VALUES (?,?,?,?,?,?,?,?)"; } @Override public Object[] createItem(int id) { return new Object[] { id, UUID.randomUUID().toString(), UUID.randomUUID().toString(), (int) (10 + Math.random() * 50), 0, (float)0, new Date().getTime(), UUID.randomUUID().toString(), }; } @Override public String readSql() { return "SELECT * from User"; } @Override public CursorReader createReader(final Cursor cursor) { final int cursorIndexOfMId = cursor.getColumnIndexOrThrow("mId"); final int cursorIndexOfMName = cursor.getColumnIndexOrThrow("mName"); final int cursorIndexOfMLastName = cursor.getColumnIndexOrThrow("mLastName"); final int cursorIndexOfMAge = cursor.getColumnIndexOrThrow("mAge"); final int cursorIndexOfMAdmin = cursor.getColumnIndexOrThrow("mAdmin"); final int cursorIndexOfMWeight = cursor.getColumnIndexOrThrow("mWeight"); final int cursorIndexOfMBirthday = cursor.getColumnIndexOrThrow("mBirthday"); final int cursorIndexOfMMoreTextField = cursor.getColumnIndexOrThrow("mMoreText"); return () -> { cursor.getInt(cursorIndexOfMId); cursor.getString(cursorIndexOfMName); cursor.getString(cursorIndexOfMLastName); cursor.getInt(cursorIndexOfMAge); cursor.getInt(cursorIndexOfMAdmin); cursor.getFloat(cursorIndexOfMWeight); if (!cursor.isNull(cursorIndexOfMBirthday)) { cursor.getLong(cursorIndexOfMBirthday); } cursor.getString(cursorIndexOfMMoreTextField); }; } }; public static TableHelper[] TABLE_HELPERS = new TableHelper[] { INT_1, INT_10, USER, }; }
apct-tests/perftests/core/src/android/os/ParcelPerfTest.java +55 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,46 @@ public class ParcelPerfTest { } } @Test public void timeGetDataPosition() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataPosition(); } } @Test public void timeSetDataSize() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.setDataSize(0); } } @Test public void timeGetDataSize() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataSize(); } } @Test public void timeSetDataCapacity() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.setDataCapacity(0); } } @Test public void timeGetDataCapacity() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { mParcel.dataCapacity(); } } @Test public void timeWriteByte() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); Loading Loading @@ -112,4 +152,19 @@ public class ParcelPerfTest { mParcel.readLong(); } } @Test public void timeObtainRecycle() { // Use up the pooled instances. // A lot bigger than the actual size but in case someone increased it. final int POOL_SIZE = 100; for (int i = 0; i < POOL_SIZE; i++) { Parcel.obtain(); } final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); while (state.keepRunning()) { Parcel.obtain().recycle(); } } }