Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 220871a6 authored by Xin Li's avatar Xin Li
Browse files

Merge commit '98e12851' from

oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
parents 802f191b 98e12851
Loading
Loading
Loading
Loading
+32 −10
Original line number Diff line number Diff line
@@ -71,8 +71,6 @@ LOCAL_SRC_FILES += \
	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 \
@@ -84,6 +82,7 @@ LOCAL_SRC_FILES += \
	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 \
@@ -174,6 +173,7 @@ LOCAL_SRC_FILES += \
	core/java/android/content/pm/IPackageInstallerCallback.aidl \
	core/java/android/content/pm/IPackageInstallerSession.aidl \
	core/java/android/content/pm/IPackageManager.aidl \
	../native/libs/binder/aidl/android/content/pm/IPackageManagerNative.aidl \
	core/java/android/content/pm/IPackageMoveObserver.aidl \
	core/java/android/content/pm/IPackageStatsObserver.aidl \
	core/java/android/content/pm/IPinItemRequest.aidl \
@@ -271,6 +271,8 @@ LOCAL_SRC_FILES += \
	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 \
@@ -441,10 +443,6 @@ LOCAL_SRC_FILES += \
	location/java/android/location/INetInitiatedListener.aidl \
	location/java/com/android/internal/location/ILocationProvider.aidl \
	media/java/android/media/IAudioService.aidl \
	../av/drm/libmediadrm/aidl/android/media/ICas.aidl \
	../av/drm/libmediadrm/aidl/android/media/ICasListener.aidl \
	../av/drm/libmediadrm/aidl/android/media/IDescrambler.aidl \
	../av/drm/libmediadrm/aidl/android/media/IMediaCasService.aidl \
	media/java/android/media/IAudioFocusDispatcher.aidl \
	media/java/android/media/IAudioRoutesObserver.aidl \
	media/java/android/media/IMediaHTTPConnection.aidl \
@@ -572,6 +570,15 @@ LOCAL_SRC_FILES += \

LOCAL_AIDL_INCLUDES += system/update_engine/binder_bindings

LOCAL_AIDL_INCLUDES += frameworks/base/lowpan/java
LOCAL_SRC_FILES += \
	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

# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk
LOCAL_AIDL_INCLUDES += \
      $(FRAMEWORKS_BASE_JAVA_SRC_DIRS) \
@@ -609,6 +616,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
    android.hardware.vibrator-V1.1-java-constants        \
    android.hardware.wifi-V1.0-java-constants            \

include hardware/interfaces/cas/1.0/CasHal.mk

# Loaded with System.loadLibrary by android.view.textclassifier
LOCAL_REQUIRED_MODULES += libtextclassifier

@@ -710,7 +719,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 \
@@ -726,6 +737,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 \
@@ -870,7 +882,6 @@ packages_to_document := \
# The result will be relative to frameworks/base.
fwbase_dirs_to_document := \
	legacy-test/src \
	test-runner/src \
	$(patsubst $(LOCAL_PATH)/%,%, \
	  $(wildcard \
	    $(foreach dir, $(FRAMEWORKS_BASE_JAVA_SRC_DIRS), \
@@ -888,6 +899,12 @@ 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))

# These are relative to frameworks/base
dirs_to_check_apis := \
  $(fwbase_dirs_to_document) \
@@ -907,6 +924,7 @@ endef
# FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk
dirs_to_document := \
	$(dirs_to_check_apis) \
	test-runner/src \
	$(addprefix ../../, $(FRAMEWORKS_DATA_BINDING_JAVA_SRC_DIRS))

patterns_to_not_document := \
@@ -929,7 +947,9 @@ framework_docs_LOCAL_SRC_FILES := \

# These are relative to frameworks/base
framework_docs_LOCAL_API_CHECK_SRC_FILES := \
	$(call find-other-java-files, $(dirs_to_check_apis)) \
	$(framework_base_android_test_mock_src_files) \
	$(framework_base_android_test_runner_excluding_mock_src_files) \
	$(call all-java-files-under, $(dirs_to_check_apis)) \
	$(common_src_files)

# This is used by ide.mk as the list of source files that are
@@ -954,7 +974,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.
@@ -1001,7 +1022,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:= \
+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();
                    }
                }
            }
        }
    }
}
+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,
    };
}
+55 −0
Original line number Diff line number Diff line
@@ -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();
@@ -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();
        }
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -20,8 +20,7 @@ LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-test \
    apct-perftests-utils
    android-support-test

LOCAL_PACKAGE_NAME := MultiUserPerfTests

Loading