Import Upstream version 8.1.0+r23
This commit is contained in:
commit
3aa2eaab56
|
@ -0,0 +1,62 @@
|
|||
// Copyright (C) 2016 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.
|
||||
|
||||
// ==== c++ proto device library ==============================
|
||||
cc_library {
|
||||
name: "libplatformprotos",
|
||||
host_supported: true,
|
||||
proto: {
|
||||
export_proto_headers: true,
|
||||
include_dirs: ["external/protobuf/src"],
|
||||
},
|
||||
|
||||
target: {
|
||||
host: {
|
||||
proto: {
|
||||
type: "full",
|
||||
},
|
||||
srcs: [
|
||||
"core/proto/**/*.proto",
|
||||
"libs/incident/**/*.proto",
|
||||
],
|
||||
},
|
||||
android: {
|
||||
proto: {
|
||||
type: "lite",
|
||||
},
|
||||
// We only build the protos that are optimized for the lite
|
||||
// runtime, as well as the only protos that are actually
|
||||
// needed by the device.
|
||||
srcs: [
|
||||
"core/proto/android/service/graphicsstats.proto",
|
||||
],
|
||||
shared: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
subdirs = [
|
||||
"core/jni",
|
||||
"libs/*",
|
||||
"media/*",
|
||||
"tools/*",
|
||||
"native/android",
|
||||
"native/graphics/jni",
|
||||
]
|
||||
|
||||
optional_subdirs = [
|
||||
"core/tests/utiltests/jni",
|
||||
]
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,248 @@
|
|||
# Copyright (C) 2007 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.
|
||||
#
|
||||
|
||||
# If you don't need to do a full clean build but would like to touch
|
||||
# a file or delete some intermediate files, add a clean step to the end
|
||||
# of the list. These steps will only be run once, if they haven't been
|
||||
# run before.
|
||||
#
|
||||
# E.g.:
|
||||
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
|
||||
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
|
||||
#
|
||||
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
|
||||
# files that are missing or have been moved.
|
||||
#
|
||||
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
|
||||
# Use $(OUT_DIR) to refer to the "out" directory.
|
||||
#
|
||||
# If you need to re-do something that's already mentioned, just copy
|
||||
# the command and add it to the bottom of the list. E.g., if a change
|
||||
# that you made last week required touching a file and a change you
|
||||
# made today requires touching the same file, just copy the old
|
||||
# touch step and add it to the end of the list.
|
||||
#
|
||||
# *****************************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THE BANNER
|
||||
# *****************************************************************
|
||||
|
||||
# For example:
|
||||
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
|
||||
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
|
||||
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
|
||||
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/os/IDropBoxService.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/backup)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/backup)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/backup)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/backup)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/app)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/FrameworkTest_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android.policy*)
|
||||
$(call add-clean-step, rm -rf $(TARGET_OUT_JAVA_LIBRARIES)/android.policy.jar)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/obj/lib/libequalizer.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/obj/lib/libequalizertest.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/obj/lib/libreverb.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/obj/lib/libreverbtest.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib/libequalizer.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib/libequalizertest.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib/libreverb.so)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/symbols/system/lib/libreverbtest.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libequalizer_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libequalizertest_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libreverb_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libreverbtest_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/soundfx/)
|
||||
$(call add-clean-step, find . -type f -name "*.rs" -print0 | xargs -0 touch)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libandroid_runtime.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/libandroid_runtime.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libandroid_runtime.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libhwui_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libhwui.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/libhwui.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libhwui.so)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os/storage/*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/IClipboard.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/ITelephonyRegistry.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/docs/api-stubs*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/trustedlogic)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/com/trustedlogic)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/trustedlogic)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/com/trustedlogic)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Music2_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc/INdefTag.java)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libstagefright_aacdec_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libstagefright_mp3dec_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ModelViewer_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PerfTest_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/RSTest_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware/IUsbManager.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/os)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/keystore/java/android/security/IKeyChainAliasResponse.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/vpn)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/nfc/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/fonts/Lohit_Hindi.ttf)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/fonts/DroidSans*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/fonts/DroidSans*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/android/content)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/renderscript)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/*/src/renderscript)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/*/src/RenderScript.stamp)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/*/src/RenderScript.stamp)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libRS_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libRSDriver_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/host/$(HOST_PREBUILT_TAG)/obj/STATIC_LIBRARIES/libRS_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IEventListener.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IEventListener.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/accessibility/IAccessibilityManager.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClient.P)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/media/video/Disco*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing2_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/ui/*.ogg)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/IExtendedNetworkService.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/IExtendedNetworkService.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayContentChangeListener.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayContentChangeListener.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IWindowManager.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IWindowManager.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayMagnificationController.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayMagnificationController.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayMagnificationMediator.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/IDisplayMagnificationMediator.P)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/voip)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/librtp_jni_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/librtp_jni.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/librtp_jni.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/librtp_jni.so)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/SmsRawData.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodCallback.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodSession.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodCallback.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/framework-res_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(HOST_OUT)/obj/STATIC_LIBRARIES/libandroidfw_intermediates/import_includes)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrinterDiscoveryObserver.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/printservice/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/packages/services/Proxy/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrinterDiscoverySessionObserver.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrinterDiscoverySessionClient.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/os/IBattery*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/usr/idc/frameworks)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/usr/keylayout/frameworks)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/usr/keychars/frameworks)
|
||||
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/media/video/*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/effects/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/framework-res_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/print/IPrintClient.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/media/java/android/media/IMedia*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/view/IMagnificationCallbacks*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/tv/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/media/java/android/media/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/app)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/android/app/wearable)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/tv/ITv*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/classes/android/app/task)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/app/task)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/classes/android/app/TaskManager)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/app/maintenance)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/classes/android/app/maintenance)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes/android/app/maintenance)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes/android/app/maintenance)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/android/app/maintenance)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/app)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/ims-common_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework2_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/telecomm/java/com/android/internal/telecom)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework.* $(PRODUCT_OUT)/system/framework2.*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/docs/api-stubs-timestamp)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services.core_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services.core_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/services_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/inputflinger $(PRODUCT_OUT)/symbols/system/bin/inputflinger)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/RsFountainFbo_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/telecomm/java/com/android/internal/telecomm)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/widget/ILockSettingsObserver.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates/)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/Keyguard_intermediates/)
|
||||
$(call add-clean-step, rm -f $(OUT_DIR)/target/product/*/system/framework/android.policy.jar)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/inputflinger $(PRODUCT_OUT)/symbols/system/bin/inputflinger)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libinputflingerhost.so $(PRODUCT_OUT)/system/lib64/libinputflingerhost.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/libinputflingerhost.so $(PRODUCT_OUT)/symbols/system/lib64/libinputflingerhost.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/libinputflingerhost.so $(PRODUCT_OUT)/obj_arm/lib/libinputflingerhost.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libinputflingerhost_intermediates $(PRODUCT_OUT)/obj_arm/SHARED_LIBRARIES/libinputflingerhost_intermediates)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/target/common/obj/framework.aidl)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/DocumentsUI_intermediates)
|
||||
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IRemoteControlClient.*)
|
||||
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IRemoteControlDisplay.*)
|
||||
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit1_intermediates/src/com/android/test/split/feature/R.java)
|
||||
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit2_intermediates/src/com/android/test/split/feature/R.java)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/core/java/android/os/storage/*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/host/common/obj/JAVA_LIBRARIES/platformprotos_intermediates)
|
||||
# ******************************************************************
|
||||
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
|
||||
# ******************************************************************
|
|
@ -0,0 +1,335 @@
|
|||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the Android-specific code. ==
|
||||
=========================================================================
|
||||
|
||||
Android Code
|
||||
Copyright 2005-2008 The Android Open Source Project
|
||||
|
||||
This product includes software developed as part of
|
||||
The Android Open Source Project (http://source.android.com).
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for Apache Commons code. ==
|
||||
=========================================================================
|
||||
|
||||
Apache Commons
|
||||
Copyright 1999-2006 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for Jakarta Commons Logging. ==
|
||||
=========================================================================
|
||||
|
||||
Jakarta Commons Logging (JCL)
|
||||
Copyright 2005,2006 The Apache Software Foundation.
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the Nuance code. ==
|
||||
=========================================================================
|
||||
|
||||
These files are Copyright 2007 Nuance Communications, but released under
|
||||
the Apache2 License.
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the Media Codecs code. ==
|
||||
=========================================================================
|
||||
|
||||
Media Codecs
|
||||
These files are Copyright 1998 - 2009 PacketVideo, but released under
|
||||
the Apache2 License.
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the mDnsResponder code. ==
|
||||
=========================================================================
|
||||
|
||||
mDnsResponder TXTRecord
|
||||
This file is Copyright 2004 Apple Computer, Inc. but released under
|
||||
the Apache2 License.
|
||||
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the TagSoup code. ==
|
||||
=========================================================================
|
||||
|
||||
This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
|
||||
|
||||
TagSoup is licensed under the Apache License,
|
||||
Version 2.0. You may obtain a copy of this license at
|
||||
http://www.apache.org/licenses/LICENSE-2.0 . You may also have
|
||||
additional legal rights not granted by this license.
|
||||
|
||||
TagSoup is distributed in the hope that it will be useful, but
|
||||
unless required by applicable law or agreed to in writing, TagSoup
|
||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, either express or implied; not even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for Additional Codecs code. ==
|
||||
=========================================================================
|
||||
|
||||
Additional Codecs
|
||||
These files are Copyright 2003-2010 VisualOn, but released under
|
||||
the Apache2 License.
|
||||
|
||||
=========================================================================
|
||||
== NOTICE file corresponding to the section 4 d of ==
|
||||
== the Apache License, Version 2.0, ==
|
||||
== in this case for the Audio Effects code. ==
|
||||
=========================================================================
|
||||
|
||||
Audio Effects
|
||||
These files are Copyright (C) 2004-2010 NXP Software and
|
||||
Copyright (C) 2010 The Android Open Source Project, but released under
|
||||
the Apache2 License.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
|
||||
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
|
||||
|
||||
Unicode Data Files include all data files under the directories
|
||||
http://www.unicode.org/Public/, http://www.unicode.org/reports/,
|
||||
and http://www.unicode.org/cldr/data/ . Unicode Software includes any
|
||||
source code published in the Unicode Standard or under the directories
|
||||
http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
|
||||
http://www.unicode.org/cldr/data/.
|
||||
|
||||
NOTICE TO USER: Carefully read the following legal agreement. BY
|
||||
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA
|
||||
FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY
|
||||
ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF
|
||||
THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY,
|
||||
DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
|
||||
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright © 1991-2008 Unicode, Inc. All rights reserved. Distributed
|
||||
under the Terms of Use in http://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation (the
|
||||
"Data Files") or Unicode software and any associated documentation (the
|
||||
"Software") to deal in the Data Files or Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, and/or sell copies of the Data Files or Software,
|
||||
and to permit persons to whom the Data Files or Software are furnished to
|
||||
do so, provided that (a) the above copyright notice(s) and this permission
|
||||
notice appear with all copies of the Data Files or Software, (b) both the
|
||||
above copyright notice(s) and this permission notice appear in associated
|
||||
documentation, and (c) there is clear notice in each modified Data File
|
||||
or in the Software as well as in the documentation associated with the
|
||||
Data File(s) or Software that the data or software has been modified.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|
||||
OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in these Data Files or Software without prior written
|
||||
authorization of the copyright holder.
|
|
@ -0,0 +1,9 @@
|
|||
[Hook Scripts]
|
||||
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
|
||||
-fw core/java/android/
|
||||
core/tests/coretests/src/android/
|
||||
packages/PrintRecommendationService/
|
||||
packages/PrintSpooler/
|
||||
services/print/
|
||||
services/usb/
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android-support-test \
|
||||
apct-perftests-utils \
|
||||
legacy-android-test
|
||||
|
||||
LOCAL_PACKAGE_NAME := CorePerfTests
|
||||
|
||||
LOCAL_JNI_SHARED_LIBRARIES := libperftestscore_jni
|
||||
|
||||
# Use google-fonts/dancing-script for the performance metrics
|
||||
LOCAL_ASSET_DIR := $(TOP)/external/google-fonts/dancing-script
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
include $(call all-makefiles-under, $(LOCAL_PATH))
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.perftests.core">
|
||||
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
<activity android:name="android.perftests.utils.StubActivity" />
|
||||
</application>
|
||||
|
||||
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||
android:targetPackage="com.android.perftests.core"/>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,17 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SDK_VERSION := 21
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
SystemPerfTest.cpp \
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(JNI_H_INCLUDE)
|
||||
|
||||
LOCAL_MODULE := libperftestscore_jni
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
|
||||
|
||||
static void jintarrayArgumentNoop(JNIEnv*, jclass, jintArray, jint) {
|
||||
}
|
||||
|
||||
static jint jintarrayGetLength(JNIEnv* env, jclass, jintArray jarray) {
|
||||
const jsize len = env->GetArrayLength(jarray);
|
||||
return static_cast<jint>(len);
|
||||
}
|
||||
|
||||
static jint jintarrayCriticalAccess(JNIEnv* env, jclass, jintArray jarray, jint index) {
|
||||
const jsize len = env->GetArrayLength(jarray);
|
||||
if (index < 0 || index >= len) {
|
||||
return -1;
|
||||
}
|
||||
jint* data = (jint*) env->GetPrimitiveArrayCritical(jarray, 0);
|
||||
jint ret = data[index];
|
||||
env->ReleasePrimitiveArrayCritical(jarray, data, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static jint jintarrayBasicAccess(JNIEnv* env, jclass, jintArray jarray, jint index) {
|
||||
const jsize len = env->GetArrayLength(jarray);
|
||||
if (index < 0 || index >= len) {
|
||||
return -1;
|
||||
}
|
||||
jint* data = env->GetIntArrayElements(jarray, 0);
|
||||
jint ret = data[index];
|
||||
env->ReleaseIntArrayElements(jarray, data, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const JNINativeMethod sMethods[] = {
|
||||
{"jintarrayArgumentNoop", "([II)V", (void *) jintarrayArgumentNoop},
|
||||
{"jintarrayGetLength", "([I)I", (void *) jintarrayGetLength},
|
||||
{"jintarrayCriticalAccess", "([II)I", (void *) jintarrayCriticalAccess},
|
||||
{"jintarrayBasicAccess", "([II)I", (void *) jintarrayBasicAccess},
|
||||
};
|
||||
|
||||
static int registerNativeMethods(JNIEnv* env, const char* className,
|
||||
const JNINativeMethod* gMethods, int numMethods) {
|
||||
jclass clazz = env->FindClass(className);
|
||||
if (clazz == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
jint JNI_OnLoad(JavaVM* jvm, void*) {
|
||||
JNIEnv *env = NULL;
|
||||
if (jvm->GetEnv((void**) &env, JNI_VERSION_1_6)) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (registerNativeMethods(env, "android/perftests/SystemPerfTest",
|
||||
sMethods, NELEM(sMethods)) == -1) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="48dp"
|
||||
android:width="48dp"
|
||||
android:viewportHeight="480"
|
||||
android:viewportWidth="480" >
|
||||
|
||||
<group>
|
||||
<path
|
||||
android:name="box0"
|
||||
android:pathData="m0,0l480,0l0,480l-480,0l0-480z"
|
||||
android:fillColor="@android:color/white" />
|
||||
<path
|
||||
android:name="box1"
|
||||
android:pathData="m20,200l100,90l180-180l-35-35l-145,145l-60-60l-40,40z"
|
||||
android:fillColor="@android:color/black"
|
||||
android:strokeColor="@android:color/black"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</group>
|
||||
</vector>
|
Binary file not shown.
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.0">
|
||||
|
||||
<GlyphOrder>
|
||||
<GlyphID id="0" name=".notdef"/>
|
||||
<GlyphID id="1" name="a"/>
|
||||
</GlyphOrder>
|
||||
|
||||
<head>
|
||||
<tableVersion value="1.0"/>
|
||||
<fontRevision value="1.0"/>
|
||||
<checkSumAdjustment value="0x640cdb2f"/>
|
||||
<magicNumber value="0x5f0f3cf5"/>
|
||||
<flags value="00000000 00000011"/>
|
||||
<unitsPerEm value="1000"/>
|
||||
<created value="Fri Mar 17 07:26:00 2017"/>
|
||||
<macStyle value="00000000 00000000"/>
|
||||
<lowestRecPPEM value="7"/>
|
||||
<fontDirectionHint value="2"/>
|
||||
<glyphDataFormat value="0"/>
|
||||
</head>
|
||||
|
||||
<hhea>
|
||||
<tableVersion value="1.0"/>
|
||||
<ascent value="1000"/>
|
||||
<descent value="-200"/>
|
||||
<lineGap value="0"/>
|
||||
<caretSlopeRise value="1"/>
|
||||
<caretSlopeRun value="0"/>
|
||||
<caretOffset value="0"/>
|
||||
<reserved0 value="0"/>
|
||||
<reserved1 value="0"/>
|
||||
<reserved2 value="0"/>
|
||||
<reserved3 value="0"/>
|
||||
<metricDataFormat value="0"/>
|
||||
</hhea>
|
||||
|
||||
<maxp>
|
||||
<tableVersion value="0x10000"/>
|
||||
<maxZones value="0"/>
|
||||
<maxTwilightPoints value="0"/>
|
||||
<maxStorage value="0"/>
|
||||
<maxFunctionDefs value="0"/>
|
||||
<maxInstructionDefs value="0"/>
|
||||
<maxStackElements value="0"/>
|
||||
<maxSizeOfInstructions value="0"/>
|
||||
<maxComponentElements value="0"/>
|
||||
</maxp>
|
||||
|
||||
<OS_2>
|
||||
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
|
||||
will be recalculated by the compiler -->
|
||||
<version value="3"/>
|
||||
<xAvgCharWidth value="594"/>
|
||||
<usWeightClass value="400"/>
|
||||
<usWidthClass value="5"/>
|
||||
<fsType value="00000000 00001000"/>
|
||||
<ySubscriptXSize value="650"/>
|
||||
<ySubscriptYSize value="600"/>
|
||||
<ySubscriptXOffset value="0"/>
|
||||
<ySubscriptYOffset value="75"/>
|
||||
<ySuperscriptXSize value="650"/>
|
||||
<ySuperscriptYSize value="600"/>
|
||||
<ySuperscriptXOffset value="0"/>
|
||||
<ySuperscriptYOffset value="350"/>
|
||||
<yStrikeoutSize value="50"/>
|
||||
<yStrikeoutPosition value="300"/>
|
||||
<sFamilyClass value="0"/>
|
||||
<panose>
|
||||
<bFamilyType value="0"/>
|
||||
<bSerifStyle value="0"/>
|
||||
<bWeight value="5"/>
|
||||
<bProportion value="0"/>
|
||||
<bContrast value="0"/>
|
||||
<bStrokeVariation value="0"/>
|
||||
<bArmStyle value="0"/>
|
||||
<bLetterForm value="0"/>
|
||||
<bMidline value="0"/>
|
||||
<bXHeight value="0"/>
|
||||
</panose>
|
||||
<ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
|
||||
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
|
||||
<achVendID value="UKWN"/>
|
||||
<fsSelection value="00000000 01000000"/>
|
||||
<usFirstCharIndex value="32"/>
|
||||
<usLastCharIndex value="122"/>
|
||||
<sTypoAscender value="800"/>
|
||||
<sTypoDescender value="-200"/>
|
||||
<sTypoLineGap value="200"/>
|
||||
<usWinAscent value="1000"/>
|
||||
<usWinDescent value="200"/>
|
||||
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
|
||||
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
|
||||
<sxHeight value="500"/>
|
||||
<sCapHeight value="700"/>
|
||||
<usDefaultChar value="0"/>
|
||||
<usBreakChar value="32"/>
|
||||
<usMaxContext value="0"/>
|
||||
</OS_2>
|
||||
|
||||
<hmtx>
|
||||
<mtx name=".notdef" width="500" lsb="93"/>
|
||||
<mtx name="a" width="500" lsb="93"/>
|
||||
</hmtx>
|
||||
|
||||
<cmap>
|
||||
<tableVersion version="0"/>
|
||||
<cmap_format_4 platformID="3" platEncID="10" language="0">
|
||||
<map code="0x0061" name="a" />
|
||||
</cmap_format_4>
|
||||
</cmap>
|
||||
|
||||
<loca>
|
||||
<!-- The 'loca' table will be calculated by the compiler -->
|
||||
</loca>
|
||||
|
||||
<glyf>
|
||||
<TTGlyph name=".notdef" xMin="0" yMin="0" xMax="0" yMax="0" />
|
||||
<TTGlyph name="a" xMin="0" yMin="0" xMax="0" yMax="0" />
|
||||
</glyf>
|
||||
|
||||
<name>
|
||||
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
|
||||
Sample Font
|
||||
</namerecord>
|
||||
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
|
||||
Regular
|
||||
</namerecord>
|
||||
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
|
||||
Sample Font
|
||||
</namerecord>
|
||||
<namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True">
|
||||
SampleFont-Regular
|
||||
</namerecord>
|
||||
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
|
||||
Sample Font
|
||||
</namerecord>
|
||||
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
|
||||
Regular
|
||||
</namerecord>
|
||||
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
|
||||
Sample Font
|
||||
</namerecord>
|
||||
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
|
||||
SampleFont-Regular
|
||||
</namerecord>
|
||||
</name>
|
||||
|
||||
<post>
|
||||
<formatType value="3.0"/>
|
||||
<italicAngle value="0.0"/>
|
||||
<underlinePosition value="-75"/>
|
||||
<underlineThickness value="50"/>
|
||||
<isFixedPitch value="0"/>
|
||||
<minMemType42 value="0"/>
|
||||
<maxMemType42 value="0"/>
|
||||
<minMemType1 value="0"/>
|
||||
<maxMemType1 value="0"/>
|
||||
</post>
|
||||
|
||||
</ttFont>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<font android:font="@font/samplefont" />
|
||||
</font-family>
|
|
@ -0,0 +1,42 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 10 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="20px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 100 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="110px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 1000 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="1010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 10000 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="10010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 100000 sizes!!! to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="100010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 300 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="310px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,41 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 5 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="15px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 50 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="60px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<!-- Contains 500 sizes to choose from when auto-sizing -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="510px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="300dp"
|
||||
android:text="@string/long_text" />
|
|
@ -0,0 +1,87 @@
|
|||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linear_layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button2"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/button4"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button"
|
||||
android:layout_toEndOf="@+id/button"
|
||||
android:layout_toRightOf="@+id/button" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,89 @@
|
|||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/linear_layout_weighted_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_alignParentBottom="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button2"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/button4"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button"
|
||||
android:layout_toEndOf="@+id/button"
|
||||
android:layout_toRightOf="@+id/button" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,87 @@
|
|||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/relative_layout_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button2"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/button4"
|
||||
android:layout_centerHorizontal="true" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/button"
|
||||
android:layout_toEndOf="@+id/button"
|
||||
android:layout_toRightOf="@+id/button" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<View xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/simple_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
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
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="@string/short_text"
|
||||
android:fontFamily="@font/samplefont" />
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
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
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="@string/short_text"
|
||||
android:fontFamily="sans-serif" />
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
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
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="@string/short_text"
|
||||
android:fontFamily="@font/samplexmlfont" />
|
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2016, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="64dip"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/one"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/two"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/three"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="64dip"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/four"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/five"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/six"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="64dip"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/seven"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/eight"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/nine"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="64dip"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/cancel"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/cancel"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/zero"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/ok"
|
||||
android:layout_width="0sp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dip"
|
||||
android:layout_marginEnd="2dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:text="@android:string/ok"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2016 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
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="long_text">text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text typo text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text text text text text
|
||||
text text text text text text text text text text text text </string>
|
||||
<string name="short_text">text text</string>
|
||||
</resources>
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* 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,
|
||||
};
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.Paint;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.view.DisplayListCanvas;
|
||||
import android.view.RenderNode;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@LargeTest
|
||||
public class CanvasPerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testBasicViewGroupDraw() {
|
||||
// This test is a clone of BM_DisplayListCanvas_basicViewGroupDraw
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("benchmark", null);
|
||||
RenderNode child = RenderNode.create("child", null);
|
||||
child.setLeftTopRightBottom(50, 50, 100, 100);
|
||||
|
||||
DisplayListCanvas canvas = node.start(100, 100);
|
||||
node.end(canvas);
|
||||
canvas = child.start(50, 50);
|
||||
canvas.drawColor(Color.WHITE);
|
||||
child.end(canvas);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
canvas = node.start(200, 200);
|
||||
canvas.setHighContrastText(false);
|
||||
int save = canvas.save();
|
||||
canvas.clipRect(1, 1, 199, 199);
|
||||
canvas.insertReorderBarrier();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
canvas.drawRenderNode(child);
|
||||
}
|
||||
canvas.insertInorderBarrier();
|
||||
canvas.restoreToCount(save);
|
||||
node.end(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecordSimpleBitmapView() {
|
||||
// This test is a clone of BM_DisplayListCanvas_record_simpleBitmapView
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("benchmark", null);
|
||||
|
||||
DisplayListCanvas canvas = node.start(100, 100);
|
||||
node.end(canvas);
|
||||
Bitmap bitmap = Bitmap.createBitmap(80, 80, Config.ARGB_8888);
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(Color.BLACK);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
canvas = node.start(100, 100);
|
||||
{
|
||||
canvas.save();
|
||||
canvas.drawRect(0, 0, 100, 100, paint);
|
||||
canvas.restore();
|
||||
}
|
||||
{
|
||||
canvas.save();
|
||||
canvas.translate(10, 10);
|
||||
canvas.drawBitmap(bitmap, 0, 0, null);
|
||||
canvas.restore();
|
||||
}
|
||||
node.end(canvas);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Outline;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.view.RenderNode;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@LargeTest
|
||||
public class OutlinePerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testSetEmpty() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
Outline outline = new Outline();
|
||||
while (state.keepRunning()) {
|
||||
outline.setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetRoundRect() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Outline outline = new Outline();
|
||||
while (state.keepRunning()) {
|
||||
outline.setRoundRect(50, 50, 150, 150, 5);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class PaintHasGlyphPerfTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection glyphStrings() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "Latin", "A" },
|
||||
{ "Ligature", "fi" },
|
||||
{ "SurrogatePair", "\uD83D\uDE00" }, // U+1F600
|
||||
{ "Flags", "\uD83C\uDDFA\uD83C\uDDF8" }, // US
|
||||
{ "Ideograph_VariationSelector", "\u3402\uDB40\uDD00" }, // U+3402 U+E0100
|
||||
{ "Emoji_VariationSelector", "\u00A9\uFE0F" },
|
||||
{ "EmojiSequence",
|
||||
// U+1F468 U+200D U+2764 U+FE0F U+200D U+1F48B U+200D U+1F468
|
||||
"\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68" },
|
||||
});
|
||||
}
|
||||
|
||||
private final String mQuery;
|
||||
|
||||
public PaintHasGlyphPerfTest(String metricKey, String query) {
|
||||
mQuery = query;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testHasGlyph() {
|
||||
Paint paint = new Paint();
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
paint.hasGlyph(mQuery);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.text.TextPaint;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class PaintMeasureTextTest {
|
||||
|
||||
private static final int USE_CACHE = 0;
|
||||
private static final int DONT_USE_CACHE = 1;
|
||||
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Collection measureSpecs() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "alphabet_cached", USE_CACHE, "a" },
|
||||
{ "alphabet_not_cached", DONT_USE_CACHE, "a" },
|
||||
// U+4E80 is an ideograph.
|
||||
{ "ideograph_cached", USE_CACHE, "\u4E80" },
|
||||
{ "ideograph_not_cached", DONT_USE_CACHE, "\u4E80" },
|
||||
// U+20B9F(\uD842\uDF9F) is an ideograph.
|
||||
{ "surrogate_pairs_cached", USE_CACHE, "\uD842\uDF9F" },
|
||||
{ "surrogate_pairs_not_cached", DONT_USE_CACHE, "\uD842\uDF9F" },
|
||||
// U+303D is PART ALTERNATION MARK
|
||||
{ "emoji_cached", USE_CACHE, "\u231A" },
|
||||
{ "emoji_not_cached", DONT_USE_CACHE, "\u231A" },
|
||||
// U+1F368(\uD83C\uDF68) is ICE CREAM
|
||||
{ "emoji_surrogate_pairs_cached", USE_CACHE, "\uD83C\uDF68" },
|
||||
{ "emoji_surrogate_pairs_not_cached", DONT_USE_CACHE, "\uD83C\uDF68" },
|
||||
});
|
||||
}
|
||||
|
||||
private final String mText;
|
||||
private final int mCacheMode;
|
||||
|
||||
public PaintMeasureTextTest(String key, int cacheMode, String text) {
|
||||
mText = text;
|
||||
mCacheMode = cacheMode;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testMeasureTextPerf() {
|
||||
TextPaint paint = new TextPaint();
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
if (mCacheMode == USE_CACHE) {
|
||||
paint.measureText(mText);
|
||||
} else {
|
||||
Canvas.freeTextLayoutCaches();
|
||||
}
|
||||
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
if (mCacheMode == DONT_USE_CACHE) {
|
||||
Canvas.freeTextLayoutCaches();
|
||||
}
|
||||
state.resumeTiming();
|
||||
|
||||
paint.measureText(mText);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@LargeTest
|
||||
public class PathPerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testReset() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
while (state.keepRunning()) {
|
||||
path.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddReset() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
while (state.keepRunning()) {
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
path.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRewind() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
while (state.keepRunning()) {
|
||||
path.rewind();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddRewind() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
while (state.keepRunning()) {
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
path.rewind();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsEmpty() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
while (state.keepRunning()) {
|
||||
path.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsConvex() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
while (state.keepRunning()) {
|
||||
path.isConvex();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSetFillType() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
while (state.keepRunning()) {
|
||||
path.setFillType(Path.FillType.EVEN_ODD);
|
||||
path.getFillType();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRect() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Path path = new Path();
|
||||
path.addRect(0, 0, 100, 100, Path.Direction.CW);
|
||||
final RectF outRect = new RectF();
|
||||
while (state.keepRunning()) {
|
||||
path.isRect(outRect);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.graphics.Outline;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.view.DisplayListCanvas;
|
||||
import android.view.RenderNode;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@LargeTest
|
||||
public class RenderNodePerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testMeasureRenderNodeJniOverhead() {
|
||||
final RenderNode node = RenderNode.create("benchmark", null);
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
node.setTranslationX(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRenderNodeNoName() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
RenderNode node = RenderNode.create(null, null);
|
||||
node.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRenderNode() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||
node.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValid() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||
while (state.keepRunning()) {
|
||||
node.isValid();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartEnd() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||
while (state.keepRunning()) {
|
||||
DisplayListCanvas canvas = node.start(100, 100);
|
||||
node.end(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartEndDeepHierarchy() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode[] nodes = new RenderNode[30];
|
||||
DisplayListCanvas[] canvases = new DisplayListCanvas[nodes.length];
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
nodes[i] = RenderNode.create("LinearLayout", null);
|
||||
}
|
||||
|
||||
while (state.keepRunning()) {
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
canvases[i] = nodes[i].start(100, 100);
|
||||
}
|
||||
for (int i = nodes.length - 1; i >= 0; i--) {
|
||||
nodes[i].end(canvases[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasIdentityMatrix() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||
while (state.keepRunning()) {
|
||||
node.hasIdentityMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetOutline() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
RenderNode node = RenderNode.create("LinearLayout", null);
|
||||
Outline a = new Outline();
|
||||
a.setRoundRect(0, 0, 100, 100, 10);
|
||||
Outline b = new Outline();
|
||||
b.setRect(50, 50, 150, 150);
|
||||
b.setAlpha(0.5f);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
node.setOutline(a);
|
||||
node.setOutline(b);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Typeface;
|
||||
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 java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TypefaceCreatePerfTest {
|
||||
// A font file name in asset directory.
|
||||
private static final String TEST_FONT_NAME = "DancingScript-Regular.ttf";
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testCreate_fromFamily() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
Typeface face = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_fromFamilyName() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
Typeface face = Typeface.create("monospace", Typeface.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_fromAsset() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final Context context = InstrumentationRegistry.getContext();
|
||||
final AssetManager am = context.getAssets();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
Typeface face = Typeface.createFromAsset(am, TEST_FONT_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_fromFile() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final Context context = InstrumentationRegistry.getContext();
|
||||
final AssetManager am = context.getAssets();
|
||||
|
||||
File outFile = null;
|
||||
try {
|
||||
outFile = File.createTempFile("example", "ttf", context.getCacheDir());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
try (InputStream in = am.open(TEST_FONT_NAME);
|
||||
OutputStream out = new FileOutputStream(outFile)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int n = 0;
|
||||
while ((n = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, n);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
while (state.keepRunning()) {
|
||||
Typeface face = Typeface.createFromFile(outFile);
|
||||
}
|
||||
|
||||
outFile.delete();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.graphics.perftests;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.VectorDrawable;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.BitmapUtils;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import com.android.perftests.core.R;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class VectorDrawablePerfTest {
|
||||
|
||||
private static final boolean DUMP_BITMAP = false;
|
||||
|
||||
private int[] mTestWidths = {1024, 512};
|
||||
private int[] mTestHeights = {512, 1024};
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule =
|
||||
new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testBitmapDrawPerf() {
|
||||
int resId = R.drawable.vector_drawable01;
|
||||
Activity activity = mActivityRule.getActivity();
|
||||
VectorDrawable vd = (VectorDrawable) activity.getDrawable(resId);
|
||||
|
||||
int w = 1024, h = 1024;
|
||||
Bitmap.Config conf = Bitmap.Config.ARGB_8888;
|
||||
Bitmap bmp = Bitmap.createBitmap(w, h, conf);
|
||||
Canvas canvas = new Canvas(bmp);
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
int i = 0;
|
||||
while (state.keepRunning()) {
|
||||
// Use different width / height each to force the vectorDrawable abandon the cache.
|
||||
vd.setBounds(0, 0, mTestWidths[i % 2], mTestHeights[i % 2]);
|
||||
i++;
|
||||
vd.draw(canvas);
|
||||
}
|
||||
|
||||
// Double check the bitmap pixels to make sure we draw correct content.
|
||||
int backgroundColor = bmp.getPixel(w / 4, h / 2);
|
||||
int objColor = bmp.getPixel(w / 8, h / 2 + 1);
|
||||
int emptyColor = bmp.getPixel(w * 3 / 4, h * 3 / 4);
|
||||
assertTrue("The background should be white", backgroundColor == Color.WHITE);
|
||||
assertTrue("The object should be black", objColor == Color.BLACK);
|
||||
assertTrue("The right bottom part should be empty", emptyColor == Color.TRANSPARENT);
|
||||
|
||||
if (DUMP_BITMAP) {
|
||||
BitmapUtils.saveBitmapIntoPNG(activity, bmp, resId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.os;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@LargeTest
|
||||
public class ParcelArrayPerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Parameters(name = "size={0}")
|
||||
public static Collection<Object[]> data() {
|
||||
return Arrays.asList(new Object[][] { {1}, {10}, {100}, {1000} });
|
||||
}
|
||||
|
||||
private final int mSize;
|
||||
|
||||
private Parcel mWriteParcel;
|
||||
|
||||
private byte[] mByteArray;
|
||||
private int[] mIntArray;
|
||||
private long[] mLongArray;
|
||||
|
||||
private Parcel mByteParcel;
|
||||
private Parcel mIntParcel;
|
||||
private Parcel mLongParcel;
|
||||
|
||||
public ParcelArrayPerfTest(int size) {
|
||||
mSize = size;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mWriteParcel = Parcel.obtain();
|
||||
|
||||
mByteArray = new byte[mSize];
|
||||
mIntArray = new int[mSize];
|
||||
mLongArray = new long[mSize];
|
||||
|
||||
mByteParcel = Parcel.obtain();
|
||||
mByteParcel.writeByteArray(mByteArray);
|
||||
mIntParcel = Parcel.obtain();
|
||||
mIntParcel.writeIntArray(mIntArray);
|
||||
mLongParcel = Parcel.obtain();
|
||||
mLongParcel.writeLongArray(mLongArray);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mWriteParcel.recycle();
|
||||
mWriteParcel = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeWriteByteArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mWriteParcel.setDataPosition(0);
|
||||
mWriteParcel.writeByteArray(mByteArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeCreateByteArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mByteParcel.setDataPosition(0);
|
||||
mByteParcel.createByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadByteArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mByteParcel.setDataPosition(0);
|
||||
mByteParcel.readByteArray(mByteArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeWriteIntArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mWriteParcel.setDataPosition(0);
|
||||
mWriteParcel.writeIntArray(mIntArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeCreateIntArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mIntParcel.setDataPosition(0);
|
||||
mIntParcel.createIntArray();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadIntArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mIntParcel.setDataPosition(0);
|
||||
mIntParcel.readIntArray(mIntArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeWriteLongArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mWriteParcel.setDataPosition(0);
|
||||
mWriteParcel.writeLongArray(mLongArray);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeCreateLongArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mLongParcel.setDataPosition(0);
|
||||
mLongParcel.createLongArray();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadLongArray() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mLongParcel.setDataPosition(0);
|
||||
mLongParcel.readLongArray(mLongArray);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.os;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class ParcelPerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
private Parcel mParcel;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mParcel = Parcel.obtain();
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.setDataCapacity(8);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mParcel.recycle();
|
||||
mParcel = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeSetDataPosition() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
final byte val = 0xF;
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.writeByte(val);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadByte() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.readByte();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeWriteInt() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int val = 0xF;
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.writeInt(val);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadInt() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeWriteLong() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final long val = 0xF;
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
mParcel.writeLong(val);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeReadLong() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
mParcel.setDataPosition(0);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.os;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
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.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class SharedPreferencesTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void timeCachedGetSharedPreferences() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final Context context = InstrumentationRegistry.getTargetContext();
|
||||
// Do the real work once as we're only interested in cache-hit performance
|
||||
SharedPreferences prefs = context.getSharedPreferences("test", Context.MODE_PRIVATE);
|
||||
while (state.keepRunning()) {
|
||||
prefs = context.getSharedPreferences("test", Context.MODE_PRIVATE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import dalvik.annotation.optimization.FastNative;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class SystemPerfTest {
|
||||
|
||||
static {
|
||||
System.loadLibrary("perftestscore_jni");
|
||||
}
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testNanoTimePerf() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
System.nanoTime();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBenchmarkOverhead() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {}
|
||||
}
|
||||
|
||||
void spinBlock(long durationNs) {
|
||||
long start = System.nanoTime();
|
||||
while (System.nanoTime() - start < durationNs) {}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBenchmarkPauseResumeOverhead() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
spinBlock(TimeUnit.MICROSECONDS.toNanos(5));
|
||||
state.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJniArrayNoop() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int[] data = new int[450];
|
||||
while (state.keepRunning()) {
|
||||
jintarrayArgumentNoop(data, data.length);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJniArrayGetLength() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int[] data = new int[450];
|
||||
while (state.keepRunning()) {
|
||||
jintarrayGetLength(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJniArrayCriticalAccess() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int[] data = new int[450];
|
||||
while (state.keepRunning()) {
|
||||
jintarrayCriticalAccess(data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJniArrayBasicAccess() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int[] data = new int[450];
|
||||
while (state.keepRunning()) {
|
||||
jintarrayBasicAccess(data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@FastNative
|
||||
private static native void jintarrayArgumentNoop(int[] array, int length);
|
||||
@FastNative
|
||||
private static native int jintarrayGetLength(int[] array);
|
||||
@FastNative
|
||||
private static native int jintarrayCriticalAccess(int[] array, int index);
|
||||
@FastNative
|
||||
private static native int jintarrayBasicAccess(int[] array, int index);
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.text;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.FontMetricsInt;
|
||||
import android.os.Bundle;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.text.style.ReplacementSpan;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class DynamicLayoutPerfTest {
|
||||
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection cases() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "0%", 0.0f},
|
||||
{ "1%", 0.01f},
|
||||
{ "5%", 0.05f},
|
||||
{ "30%", 0.3f},
|
||||
{ "100%", 1.0f},
|
||||
});
|
||||
}
|
||||
|
||||
private final String mMetricKey;
|
||||
private final float mProbability;
|
||||
public DynamicLayoutPerfTest(String metricKey, float probability) {
|
||||
mMetricKey = metricKey;
|
||||
mProbability = probability;
|
||||
}
|
||||
|
||||
private static class MockReplacementSpan extends ReplacementSpan {
|
||||
@Override
|
||||
public int getSize(Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top,
|
||||
int y, int bottom, Paint paint) {
|
||||
}
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
|
||||
private final static String ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
private SpannableStringBuilder getText() {
|
||||
final long seed = 1234567890;
|
||||
final Random r = new Random(seed);
|
||||
final SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
|
||||
final int paragraphCount = 100;
|
||||
for (int i = 0; i < paragraphCount; i++) {
|
||||
final int wordCount = 5 + r.nextInt(20);
|
||||
final boolean containsReplacementSpan = r.nextFloat() < mProbability;
|
||||
final int replacedWordIndex = containsReplacementSpan ? r.nextInt(wordCount) : -1;
|
||||
for (int j = 0; j < wordCount; j++) {
|
||||
final int startIndex = builder.length();
|
||||
final int wordLength = 1 + r.nextInt(10);
|
||||
for (int k = 0; k < wordLength; k++) {
|
||||
char c = ALPHABETS.charAt(r.nextInt(ALPHABETS.length()));
|
||||
builder.append(c);
|
||||
}
|
||||
if (replacedWordIndex == j) {
|
||||
builder.setSpan(new MockReplacementSpan(), startIndex,
|
||||
builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
builder.append(' ');
|
||||
}
|
||||
builder.append('\n');
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBlocksAlwaysNeedToBeRedrawn() {
|
||||
final SpannableStringBuilder text = getText();
|
||||
final DynamicLayout layout = new DynamicLayout(text, new TextPaint(), 1000,
|
||||
ALIGN_NORMAL, 0, 0, false);
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final int steps = 10;
|
||||
while (state.keepRunning()) {
|
||||
for (int i = 0; i < steps; i++) {
|
||||
int offset = (text.length() * i) / steps;
|
||||
text.insert(offset, "\n");
|
||||
text.delete(offset, offset + 1);
|
||||
final ArraySet<Integer> set = layout.getBlocksAlwaysNeedToBeRedrawn();
|
||||
if (set != null) {
|
||||
for (int j = 0; j < set.size(); j++) {
|
||||
layout.getBlockIndex(set.valueAt(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.util.perftests;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class LogPerfTest {
|
||||
|
||||
private final String[] strings = new String[] {
|
||||
"This is a test log string 1",
|
||||
"This is a test log string 2",
|
||||
"This is a test log string 3",
|
||||
"This is a test log string 4",
|
||||
"This is a test log string 5",
|
||||
};
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testLogPerf() {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
int i = 0;
|
||||
while (state.keepRunning()) {
|
||||
Log.d("LogPerfTest", strings[(i++) % strings.length]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.perftests.core.R;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@LargeTest
|
||||
public class ViewPerfTest {
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testSimpleViewInflate() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
FrameLayout root = new FrameLayout(context);
|
||||
while (state.keepRunning()) {
|
||||
inflater.inflate(R.layout.test_simple_view, root, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwelveKeyInflate() {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
FrameLayout root = new FrameLayout(context);
|
||||
while (state.keepRunning()) {
|
||||
inflater.inflate(R.layout.twelve_key_entry, root, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.view;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@LargeTest
|
||||
public class ViewShowHidePerfTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
public Context getContext() {
|
||||
return InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
}
|
||||
|
||||
static abstract class SubTreeFactory {
|
||||
String mName;
|
||||
SubTreeFactory(String name) { mName = name; }
|
||||
|
||||
abstract View create(Context context, int depth);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mName;
|
||||
}
|
||||
}
|
||||
|
||||
private static SubTreeFactory[] sSubTreeFactories = new SubTreeFactory[] {
|
||||
new SubTreeFactory("NestedLinearLayoutTree") {
|
||||
private int mColorToggle = 0;
|
||||
|
||||
private void createNestedLinearLayoutTree(Context context, LinearLayout parent,
|
||||
int remainingDepth) {
|
||||
if (remainingDepth <= 0) {
|
||||
mColorToggle = (mColorToggle + 1) % 4;
|
||||
parent.setBackgroundColor((mColorToggle < 2) ? Color.RED : Color.BLUE);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean vertical = remainingDepth % 2 == 0;
|
||||
parent.setOrientation(vertical ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
LinearLayout child = new LinearLayout(context);
|
||||
// vertical: match parent in x axis, horizontal: y axis.
|
||||
parent.addView(child, new LinearLayout.LayoutParams(
|
||||
(vertical ? ViewGroup.LayoutParams.MATCH_PARENT : 0),
|
||||
(vertical ? 0 : ViewGroup.LayoutParams.MATCH_PARENT),
|
||||
1.0f));
|
||||
|
||||
createNestedLinearLayoutTree(context, child, remainingDepth - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View create(Context context, int depth) {
|
||||
LinearLayout root = new LinearLayout(context);
|
||||
createNestedLinearLayoutTree(context, root, depth - 1);
|
||||
return root;
|
||||
}
|
||||
},
|
||||
new SubTreeFactory("ImageViewList") {
|
||||
@Override
|
||||
public View create(Context context, int depth) {
|
||||
LinearLayout root = new LinearLayout(context);
|
||||
root.setOrientation(LinearLayout.HORIZONTAL);
|
||||
int childCount = (int) Math.pow(2, depth);
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
ImageView imageView = new ImageView(context);
|
||||
root.addView(imageView, new LinearLayout.LayoutParams(
|
||||
0, ViewGroup.LayoutParams.MATCH_PARENT, 1.0f));
|
||||
imageView.setImageDrawable(new ColorDrawable(Color.RED));
|
||||
}
|
||||
return root;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@Parameterized.Parameters(name = "Factory:{0},depth:{1}")
|
||||
public static Iterable<Object[]> params() {
|
||||
List<Object[]> params = new ArrayList<>();
|
||||
for (int depth : new int[] { 6 }) {
|
||||
for (SubTreeFactory subTreeFactory : sSubTreeFactories) {
|
||||
params.add(new Object[]{ subTreeFactory, depth });
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
private final View mChild;
|
||||
|
||||
public ViewShowHidePerfTest(SubTreeFactory subTreeFactory, int depth) {
|
||||
mChild = subTreeFactory.create(getContext(), depth);
|
||||
}
|
||||
|
||||
interface TestCallback {
|
||||
void run(BenchmarkState state, int width, int height, ViewGroup parent, View child);
|
||||
}
|
||||
|
||||
private void testParentWithChild(TestCallback callback) throws Throwable {
|
||||
mActivityRule.runOnUiThread(() -> {
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
FrameLayout parent = new FrameLayout(getContext());
|
||||
mActivityRule.getActivity().setContentView(parent);
|
||||
|
||||
final int width = 1000;
|
||||
final int height = 1000;
|
||||
layout(width, height, parent);
|
||||
|
||||
callback.run(state, width, height, parent, mChild);
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAndValidateDisplayList(View view) {
|
||||
boolean hasDisplayList = view.updateDisplayListIfDirty().isValid();
|
||||
assertTrue(hasDisplayList);
|
||||
}
|
||||
|
||||
private void layout(int width, int height, View view) {
|
||||
view.measure(
|
||||
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
view.layout(0, 0, height, width);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() throws Throwable {
|
||||
testParentWithChild((state, width, height, parent, child) -> {
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
updateAndValidateDisplayList(parent); // Note, done to be safe, likely not needed
|
||||
parent.addView(child);
|
||||
layout(width, height, child);
|
||||
updateAndValidateDisplayList(parent);
|
||||
state.resumeTiming();
|
||||
|
||||
parent.removeAllViews();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdd() throws Throwable {
|
||||
testParentWithChild((state, width, height, parent, child) -> {
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
layout(width, height, child); // Note, done to be safe, likely not needed
|
||||
updateAndValidateDisplayList(parent); // Note, done to be safe, likely not needed
|
||||
parent.removeAllViews();
|
||||
updateAndValidateDisplayList(parent);
|
||||
state.resumeTiming();
|
||||
|
||||
parent.addView(child);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecordAfterAdd() throws Throwable {
|
||||
testParentWithChild((state, width, height, parent, child) -> {
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
parent.removeAllViews();
|
||||
updateAndValidateDisplayList(parent); // Note, done to be safe, likely not needed
|
||||
parent.addView(child);
|
||||
layout(width, height, child);
|
||||
state.resumeTiming();
|
||||
|
||||
updateAndValidateDisplayList(parent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void testVisibility(int fromVisibility, int toVisibility) throws Throwable {
|
||||
testParentWithChild((state, width, height, parent, child) -> {
|
||||
parent.addView(child);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
state.pauseTiming();
|
||||
layout(width, height, parent);
|
||||
updateAndValidateDisplayList(parent);
|
||||
child.setVisibility(fromVisibility);
|
||||
layout(width, height, parent);
|
||||
updateAndValidateDisplayList(parent);
|
||||
state.resumeTiming();
|
||||
|
||||
child.setVisibility(toVisibility);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvisibleToVisible() throws Throwable {
|
||||
testVisibility(View.INVISIBLE, View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVisibleToInvisible() throws Throwable {
|
||||
testVisibility(View.VISIBLE, View.INVISIBLE);
|
||||
}
|
||||
@Test
|
||||
public void testGoneToVisible() throws Throwable {
|
||||
testVisibility(View.GONE, View.VISIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVisibleToGone() throws Throwable {
|
||||
testVisibility(View.VISIBLE, View.GONE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.text.Selection;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class EditTextBackspacePerfTest {
|
||||
|
||||
private static final String BOY = "\uD83D\uDC66"; // U+1F466
|
||||
private static final String US_FLAG = "\uD83C\uDDFA\uD83C\uDDF8"; // U+1F1FA U+1F1F8
|
||||
private static final String FAMILY =
|
||||
// U+1F469 U+200D U+1F469 U+200D U+1F467 U+200D U+1F467
|
||||
"\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC67";
|
||||
private static final String EMOJI_MODIFIER = "\uD83C\uDFFD"; // U+1F3FD
|
||||
private static final String KEYCAP = "\u20E3";
|
||||
private static final String COLOR_COPYRIGHT = "\u00A9\uFE0F";
|
||||
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection cases() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "Latin", "aaa", 1 },
|
||||
{ "Flags", US_FLAG + US_FLAG + US_FLAG, 4 },
|
||||
{ "EmojiModifier",
|
||||
BOY + EMOJI_MODIFIER + BOY + EMOJI_MODIFIER + BOY + EMOJI_MODIFIER, 4 },
|
||||
{ "KeyCap", "1" + KEYCAP + "1" + KEYCAP + "1" + KEYCAP, 2 },
|
||||
{ "ZwjSequence", FAMILY + FAMILY + FAMILY, 11 },
|
||||
{ "VariationSelector", COLOR_COPYRIGHT + COLOR_COPYRIGHT + COLOR_COPYRIGHT, 2 },
|
||||
});
|
||||
}
|
||||
|
||||
private final String mMetricKey;
|
||||
private final String mText;
|
||||
private final int mCursorPos;
|
||||
|
||||
private static final KeyEvent BACKSPACE_KEY_EVENT =
|
||||
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL);
|
||||
private static final KeyEvent RIGHT_ARROW_KEY_EVENT =
|
||||
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||
|
||||
public EditTextBackspacePerfTest(String metricKey, String text, int cursorPos) {
|
||||
mMetricKey = metricKey;
|
||||
mText = text;
|
||||
mCursorPos = cursorPos;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
private void prepareTextForBackspace(EditText editText) {
|
||||
editText.setText(mText, TextView.BufferType.EDITABLE);
|
||||
Selection.setSelection(editText.getText(), 0, 0);
|
||||
|
||||
// Do layout it here since the cursor movement requires layout information but it
|
||||
// happens asynchronously even if the view is attached to an Activity.
|
||||
editText.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
editText.invalidate();
|
||||
editText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
editText.layout(0, 0, 1024, 768);
|
||||
|
||||
// mText contains three grapheme clusters. Move the cursor to the 2nd grapheme
|
||||
// cluster by forwarding right arrow key event.
|
||||
editText.onKeyDown(RIGHT_ARROW_KEY_EVENT.getKeyCode(), RIGHT_ARROW_KEY_EVENT);
|
||||
Assert.assertEquals(mCursorPos, Selection.getSelectionStart(editText.getText()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBackspace() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
|
||||
EditText editText = new EditText(mActivityRule.getActivity());
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
// Prepare the test data for this iteration with pausing timer.
|
||||
state.pauseTiming();
|
||||
prepareTextForBackspace(editText);
|
||||
state.resumeTiming();
|
||||
|
||||
editText.onKeyDown(BACKSPACE_KEY_EVENT.getKeyCode(), BACKSPACE_KEY_EVENT);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.text.Selection;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class EditTextCursorMovementPerfTest {
|
||||
|
||||
private static final String BOY = "\uD83D\uDC66"; // U+1F466
|
||||
private static final String US_FLAG = "\uD83C\uDDFA\uD83C\uDDF8"; // U+1F1FA U+1F1F8
|
||||
private static final String FAMILY =
|
||||
// U+1F469 U+200D U+1F469 U+200D U+1F467 U+200D U+1F467
|
||||
"\uD83D\uDC69\u200D\uD83D\uDC69\u200D\uD83D\uDC67\u200D\uD83D\uDC67";
|
||||
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection cases() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "Latin", "aaa", 1 },
|
||||
{ "Emoji", BOY + BOY + BOY, 2 },
|
||||
{ "Flags", US_FLAG + US_FLAG + US_FLAG, 4 },
|
||||
{ "ZwjSequence", FAMILY + FAMILY + FAMILY, 11 },
|
||||
});
|
||||
}
|
||||
|
||||
private final String mMetricKey;
|
||||
private final String mText;
|
||||
private final int mCursorPos;
|
||||
|
||||
private static final KeyEvent LEFT_ARROW_KEY_EVENT =
|
||||
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT);
|
||||
private static final KeyEvent RIGHT_ARROW_KEY_EVENT =
|
||||
new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||
|
||||
public EditTextCursorMovementPerfTest(String metricKey, String text, int cursorPos) {
|
||||
mMetricKey = metricKey;
|
||||
mText = text;
|
||||
mCursorPos = cursorPos;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testCursorMovement() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditText editText = new EditText(mActivityRule.getActivity());
|
||||
|
||||
editText.setText(mText, TextView.BufferType.EDITABLE);
|
||||
Selection.setSelection(editText.getText(), 0, 0);
|
||||
|
||||
// Layout it here since the cursor movement requires layout information but it
|
||||
// happens asynchronously even if the view is attached to an Activity.
|
||||
editText.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
editText.invalidate();
|
||||
editText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
|
||||
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
editText.layout(0, 0, 1024, 768);
|
||||
|
||||
// mText contains three grapheme clusters. Move the cursor to the 2nd grapheme
|
||||
// cluster by forwarding right arrow key event.
|
||||
editText.onKeyDown(RIGHT_ARROW_KEY_EVENT.getKeyCode(), RIGHT_ARROW_KEY_EVENT);
|
||||
Assert.assertEquals(mCursorPos, Selection.getSelectionStart(editText.getText()));
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
while (state.keepRunning()) {
|
||||
editText.onKeyDown(RIGHT_ARROW_KEY_EVENT.getKeyCode(), RIGHT_ARROW_KEY_EVENT);
|
||||
editText.onKeyDown(LEFT_ARROW_KEY_EVENT.getKeyCode(), LEFT_ARROW_KEY_EVENT);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.RenderNodeAnimator;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.MeasureSpec;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class EditTextLongTextPerfTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection cases() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "10x30K", 10, 30000 },
|
||||
{ "300x1K", 300, 1000 },
|
||||
});
|
||||
}
|
||||
|
||||
private final String mMetricKey;
|
||||
private final int mChars;
|
||||
private final int mLines;
|
||||
|
||||
public EditTextLongTextPerfTest(String metricKey, int chars, int lines) {
|
||||
mMetricKey = metricKey;
|
||||
mChars = chars;
|
||||
mLines = lines;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
private EditText setupEditText() {
|
||||
final EditText editText = new EditText(mActivityRule.getActivity());
|
||||
|
||||
String alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
final long seed = 1234567890;
|
||||
Random r = new Random(seed);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mLines; i++) {
|
||||
for (int j = 0; j < mChars; j++) {
|
||||
char c = alphabet.charAt(r.nextInt(alphabet.length()));
|
||||
sb.append(c);
|
||||
}
|
||||
sb.append('\n');
|
||||
}
|
||||
|
||||
final int height = 1000;
|
||||
final int width = 1000;
|
||||
editText.setHeight(height);
|
||||
editText.setWidth(width);
|
||||
editText.setLayoutParams(new ViewGroup.LayoutParams(width, height));
|
||||
|
||||
Activity activity = mActivityRule.getActivity();
|
||||
activity.setContentView(editText);
|
||||
|
||||
editText.setText(sb.toString(), TextView.BufferType.EDITABLE);
|
||||
editText.invalidate();
|
||||
editText.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
editText.layout(0, 0, height, width);
|
||||
|
||||
return editText;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEditText() throws Throwable {
|
||||
mActivityRule.runOnUiThread(() -> {
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final EditText editText = setupEditText();
|
||||
final KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER);
|
||||
final int steps = 100;
|
||||
while (state.keepRunning()) {
|
||||
for (int i = 0; i < steps; i++) {
|
||||
int offset = (editText.getText().length() * i) / steps;
|
||||
editText.setSelection(offset);
|
||||
editText.bringPointIntoView(offset);
|
||||
editText.onKeyDown(keyEvent.getKeyCode(), keyEvent);
|
||||
editText.updateDisplayListIfDirty();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Looper;
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.annotation.UiThreadTest;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.perftests.core.R;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static android.perftests.utils.LayoutUtils.gatherViewTree;
|
||||
import static android.perftests.utils.LayoutUtils.requestLayoutForAllNodes;
|
||||
import static android.view.View.MeasureSpec.AT_MOST;
|
||||
import static android.view.View.MeasureSpec.EXACTLY;
|
||||
import static android.view.View.MeasureSpec.UNSPECIFIED;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class LayoutPerfTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Collection measureSpecs() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "relative", R.layout.test_relative_layout, R.id.relative_layout_root },
|
||||
{ "linear", R.layout.test_linear_layout, R.id.linear_layout_root },
|
||||
{ "linear_weighted", R.layout.test_linear_layout_weighted,
|
||||
R.id.linear_layout_weighted_root },
|
||||
});
|
||||
}
|
||||
|
||||
private int[] mMeasureSpecs = {EXACTLY, AT_MOST, UNSPECIFIED};
|
||||
|
||||
private int mLayoutId;
|
||||
private int mViewId;
|
||||
|
||||
public LayoutPerfTest(String key, int layoutId, int viewId) {
|
||||
// key is used in the final report automatically.
|
||||
mLayoutId = layoutId;
|
||||
mViewId = viewId;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule =
|
||||
new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void testLayoutPerf() throws Throwable {
|
||||
mActivityRule.runOnUiThread(() -> {
|
||||
assertTrue("We should be running on the main thread",
|
||||
Looper.getMainLooper().getThread() == Thread.currentThread());
|
||||
assertTrue("We should be running on the main thread",
|
||||
Looper.myLooper() == Looper.getMainLooper());
|
||||
|
||||
Activity activity = mActivityRule.getActivity();
|
||||
activity.setContentView(mLayoutId);
|
||||
|
||||
ViewGroup viewGroup = (ViewGroup) activity.findViewById(mViewId);
|
||||
|
||||
List<View> allNodes = gatherViewTree(viewGroup);
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
int length = mMeasureSpecs.length;
|
||||
while (state.keepRunning()) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
// The overhead of this call is ignorable, like within 1% difference.
|
||||
requestLayoutForAllNodes(allNodes);
|
||||
|
||||
viewGroup.measure(mMeasureSpecs[i % length], mMeasureSpecs[i % length]);
|
||||
viewGroup.layout(0, 0, viewGroup.getMeasuredWidth(), viewGroup.getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Looper;
|
||||
import android.os.Bundle;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
|
||||
import com.android.perftests.core.R;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Collection;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class TextViewAutoSizeLayoutPerfTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection layouts() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "Basic TextView - no autosize", R.layout.test_basic_textview_layout},
|
||||
{ "Autosize TextView 5 sizes", R.layout.test_autosize_textview_5},
|
||||
{ "Autosize TextView 10 sizes", R.layout.test_autosize_textview_10},
|
||||
{ "Autosize TextView 50 sizes", R.layout.test_autosize_textview_50},
|
||||
{ "Autosize TextView 100 sizes", R.layout.test_autosize_textview_100},
|
||||
{ "Autosize TextView 300 sizes", R.layout.test_autosize_textview_300},
|
||||
{ "Autosize TextView 500 sizes", R.layout.test_autosize_textview_500},
|
||||
{ "Autosize TextView 1000 sizes", R.layout.test_autosize_textview_1000},
|
||||
{ "Autosize TextView 10000 sizes", R.layout.test_autosize_textview_10000},
|
||||
{ "Autosize TextView 100000 sizes", R.layout.test_autosize_textview_100000}
|
||||
});
|
||||
}
|
||||
|
||||
private int mLayoutId;
|
||||
|
||||
public TextViewAutoSizeLayoutPerfTest(String key, int layoutId) {
|
||||
mLayoutId = layoutId;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule =
|
||||
new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testConstruction() throws Throwable {
|
||||
mActivityRule.runOnUiThread(() -> {
|
||||
assertTrue("We should be running on the main thread",
|
||||
Looper.getMainLooper().getThread() == Thread.currentThread());
|
||||
assertTrue("We should be running on the main thread",
|
||||
Looper.myLooper() == Looper.getMainLooper());
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
Activity activity = mActivityRule.getActivity();
|
||||
activity.setContentView(mLayoutId);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
TextView textView = new TextView(activity);
|
||||
// TextView#onLayout() gets called, which triggers TextView#autoSizeText()
|
||||
// which is the method we want to benchmark.
|
||||
textView.requestLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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.widget;
|
||||
|
||||
import android.content.Context;
|
||||
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 android.view.LayoutInflater;
|
||||
|
||||
import com.android.perftests.core.R;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class TextViewFontFamilyLayoutPerfTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection layouts() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "String fontFamily attribute", R.layout.test_textview_font_family_string},
|
||||
{ "File fontFamily attribute", R.layout.test_textview_font_family_file},
|
||||
{ "XML fontFamily attribute", R.layout.test_textview_font_family_xml},
|
||||
});
|
||||
}
|
||||
|
||||
private int mLayoutId;
|
||||
|
||||
public TextViewFontFamilyLayoutPerfTest(String key, int layoutId) {
|
||||
mLayoutId = layoutId;
|
||||
}
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testConstruction() throws Throwable {
|
||||
final Context context = InstrumentationRegistry.getTargetContext();
|
||||
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
final LayoutInflater inflator =
|
||||
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
while (state.keepRunning()) {
|
||||
inflator.inflate(mLayoutId, null, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.perftests.utils.PerfStatusReporter;
|
||||
import android.util.Log;
|
||||
|
||||
import android.perftests.utils.BenchmarkState;
|
||||
import android.perftests.utils.StubActivity;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Collection;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Rule;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(Parameterized.class)
|
||||
public class TextViewSetTextLocalePerfTest {
|
||||
@Parameters(name = "{0}")
|
||||
public static Collection locales() {
|
||||
return Arrays.asList(new Object[][] {
|
||||
{ "SameLocale", "en-US", "en-US" },
|
||||
{ "DifferentLocale", "en-US", "ja-JP"}
|
||||
});
|
||||
}
|
||||
|
||||
private String mMetricKey;
|
||||
private Locale mFirstLocale;
|
||||
private Locale mSecondLocale;
|
||||
|
||||
public TextViewSetTextLocalePerfTest(
|
||||
String metricKey, String firstLocale, String secondLocale) {
|
||||
mMetricKey = metricKey;
|
||||
mFirstLocale = Locale.forLanguageTag(firstLocale);
|
||||
mSecondLocale = Locale.forLanguageTag(secondLocale);
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
|
||||
|
||||
@Rule
|
||||
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
|
||||
@Test
|
||||
public void testSetTextLocale() {
|
||||
TextView textView = new TextView(mActivityRule.getActivity());
|
||||
|
||||
BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
|
||||
while (state.keepRunning()) {
|
||||
textView.setTextLocale(mFirstLocale);
|
||||
textView.setTextLocale(mSecondLocale);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright (C) 2016 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.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android-support-test
|
||||
|
||||
LOCAL_PACKAGE_NAME := MultiUserPerfTests
|
||||
|
||||
LOCAL_CERTIFICATE := platform
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.perftests.multiuser">
|
||||
|
||||
<uses-permission android:name="android.permission.MANAGE_USERS" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||
android:targetPackage="com.android.perftests.multiuser"/>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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.multiuser;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class BenchmarkResults {
|
||||
private final ArrayList<Long> mResults = new ArrayList<>();
|
||||
|
||||
public void addDuration(long duration) {
|
||||
mResults.add(TimeUnit.NANOSECONDS.toMillis(duration));
|
||||
}
|
||||
|
||||
public Bundle getStatsToReport() {
|
||||
final Bundle stats = new Bundle();
|
||||
stats.putDouble("Mean (ms)", mean());
|
||||
return stats;
|
||||
}
|
||||
|
||||
public Bundle getStatsToLog() {
|
||||
final Bundle stats = new Bundle();
|
||||
stats.putDouble("Mean (ms)", mean());
|
||||
stats.putDouble("Median (ms)", median());
|
||||
stats.putDouble("Sigma (ms)", standardDeviation());
|
||||
return stats;
|
||||
}
|
||||
|
||||
public ArrayList<Long> getAllDurations() {
|
||||
return mResults;
|
||||
}
|
||||
|
||||
private double mean() {
|
||||
final int size = mResults.size();
|
||||
long sum = 0;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
sum += mResults.get(i);
|
||||
}
|
||||
return (double) sum / size;
|
||||
}
|
||||
|
||||
private double median() {
|
||||
final int size = mResults.size();
|
||||
if (size == 0) {
|
||||
return 0f;
|
||||
}
|
||||
Collections.sort(mResults);
|
||||
final int idx = size / 2;
|
||||
return size % 2 == 0
|
||||
? (double) (mResults.get(idx) + mResults.get(idx - 1)) / 2
|
||||
: mResults.get(idx);
|
||||
}
|
||||
|
||||
private double standardDeviation() {
|
||||
final int size = mResults.size();
|
||||
if (size == 0) {
|
||||
return 0f;
|
||||
}
|
||||
final double mean = mean();
|
||||
double sd = 0;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
double diff = mResults.get(i) - mean;
|
||||
sd += diff * diff;
|
||||
}
|
||||
return Math.sqrt(sd / size);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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.multiuser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.os.Bundle;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BenchmarkResultsReporter implements TestRule {
|
||||
private final BenchmarkRunner mRunner;
|
||||
|
||||
public BenchmarkResultsReporter(BenchmarkRunner benchmarkRunner) {
|
||||
mRunner = benchmarkRunner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(final Statement base, final Description description) {
|
||||
return new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
base.evaluate();
|
||||
final Bundle stats = mRunner.getStatsToReport();
|
||||
final String summary = getSummaryString(description.getMethodName(),
|
||||
mRunner.getStatsToLog());
|
||||
logSummary(description.getTestClass().getSimpleName(), summary,
|
||||
mRunner.getAllDurations());
|
||||
stats.putString(Instrumentation.REPORT_KEY_STREAMRESULT, summary);
|
||||
InstrumentationRegistry.getInstrumentation().sendStatus(
|
||||
Activity.RESULT_OK, stats);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void logSummary(String tag, String summary, ArrayList<Long> durations) {
|
||||
final StringBuilder sb = new StringBuilder(summary);
|
||||
final int size = durations.size();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
sb.append("\n").append(i).append("->").append(durations.get(i));
|
||||
}
|
||||
Log.d(tag, sb.toString());
|
||||
}
|
||||
|
||||
private String getSummaryString(String testName, Bundle stats) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("\n\n").append(getKey(testName));
|
||||
for (String key : stats.keySet()) {
|
||||
sb.append("\n").append(key).append(": ").append(stats.get(key));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String getKey(String testName) {
|
||||
return testName.replaceAll("Perf$", "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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.multiuser;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
// Based on //platform/frameworks/base/apct-tests/perftests/utils/BenchmarkState.java
|
||||
public class BenchmarkRunner {
|
||||
|
||||
private static long COOL_OFF_PERIOD_MS = 2000;
|
||||
|
||||
private static final int NUM_ITERATIONS = 4;
|
||||
|
||||
private static final int NOT_STARTED = 0; // The benchmark has not started yet.
|
||||
private static final int RUNNING = 1; // The benchmark is running.
|
||||
private static final int PAUSED = 2; // The benchmark is paused
|
||||
private static final int FINISHED = 3; // The benchmark has stopped.
|
||||
|
||||
private final BenchmarkResults mResults = new BenchmarkResults();
|
||||
private int mState = NOT_STARTED; // Current benchmark state.
|
||||
private int mIteration;
|
||||
|
||||
public long mStartTimeNs;
|
||||
public long mPausedDurationNs;
|
||||
public long mPausedTimeNs;
|
||||
|
||||
public boolean keepRunning() {
|
||||
switch (mState) {
|
||||
case NOT_STARTED:
|
||||
mState = RUNNING;
|
||||
prepareForNextRun();
|
||||
return true;
|
||||
case RUNNING:
|
||||
mIteration++;
|
||||
return startNextTestRun();
|
||||
case PAUSED:
|
||||
throw new IllegalStateException("Benchmarking is in paused state");
|
||||
case FINISHED:
|
||||
throw new IllegalStateException("Benchmarking is finished");
|
||||
default:
|
||||
throw new IllegalStateException("BenchmarkRunner is in unknown state");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean startNextTestRun() {
|
||||
mResults.addDuration(System.nanoTime() - mStartTimeNs - mPausedDurationNs);
|
||||
if (mIteration == NUM_ITERATIONS) {
|
||||
mState = FINISHED;
|
||||
return false;
|
||||
} else {
|
||||
prepareForNextRun();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareForNextRun() {
|
||||
// TODO: Once http://b/63115387 is fixed, look into using "am wait-for-broadcast-idle"
|
||||
// command instead of waiting for a fixed amount of time.
|
||||
SystemClock.sleep(COOL_OFF_PERIOD_MS);
|
||||
mStartTimeNs = System.nanoTime();
|
||||
mPausedDurationNs = 0;
|
||||
}
|
||||
|
||||
public void pauseTiming() {
|
||||
if (mState != RUNNING) {
|
||||
throw new IllegalStateException("Unable to pause the runner: not running currently");
|
||||
}
|
||||
mPausedTimeNs = System.nanoTime();
|
||||
mState = PAUSED;
|
||||
}
|
||||
|
||||
public void resumeTiming() {
|
||||
if (mState != PAUSED) {
|
||||
throw new IllegalStateException("Unable to resume the runner: already running");
|
||||
}
|
||||
mPausedDurationNs += System.nanoTime() - mPausedTimeNs;
|
||||
mState = RUNNING;
|
||||
}
|
||||
|
||||
public Bundle getStatsToReport() {
|
||||
return mResults.getStatsToReport();
|
||||
}
|
||||
|
||||
public Bundle getStatsToLog() {
|
||||
return mResults.getStatsToLog();
|
||||
}
|
||||
|
||||
public ArrayList<Long> getAllDurations() {
|
||||
return mResults.getAllDurations();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.multiuser;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.IStopUserCallback;
|
||||
import android.app.UserSwitchObserver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Perf tests for user life cycle events.
|
||||
*
|
||||
* Running the tests:
|
||||
*
|
||||
* make MultiUserPerfTests &&
|
||||
* adb install -r \
|
||||
* ${ANDROID_PRODUCT_OUT}/data/app/MultiUserPerfTests/MultiUserPerfTests.apk &&
|
||||
* adb shell am instrument -e class android.multiuser.UserLifecycleTests \
|
||||
* -w com.android.perftests.multiuser/android.support.test.runner.AndroidJUnitRunner
|
||||
*
|
||||
* or
|
||||
*
|
||||
* bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
|
||||
*
|
||||
* Note: If you use bit for running the tests, benchmark results won't be printed on the host side.
|
||||
* But in either case, results can be checked on the device side 'adb logcat -s UserLifecycleTests'
|
||||
*/
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class UserLifecycleTests {
|
||||
private static final String TAG = UserLifecycleTests.class.getSimpleName();
|
||||
|
||||
private final int TIMEOUT_IN_SECOND = 30;
|
||||
private final int CHECK_USER_REMOVED_INTERVAL_MS = 200;
|
||||
|
||||
private UserManager mUm;
|
||||
private ActivityManager mAm;
|
||||
private IActivityManager mIam;
|
||||
private ArrayList<Integer> mUsersToRemove;
|
||||
|
||||
private final BenchmarkRunner mRunner = new BenchmarkRunner();
|
||||
@Rule
|
||||
public BenchmarkResultsReporter mReporter = new BenchmarkResultsReporter(mRunner);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final Context context = InstrumentationRegistry.getContext();
|
||||
mUm = UserManager.get(context);
|
||||
mAm = context.getSystemService(ActivityManager.class);
|
||||
mIam = ActivityManager.getService();
|
||||
mUsersToRemove = new ArrayList<>();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
for (int userId : mUsersToRemove) {
|
||||
try {
|
||||
mUm.removeUser(userId);
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAndStartUser() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
final UserInfo userInfo = mUm.createUser("TestUser", 0);
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerBroadcastReceiver(Intent.ACTION_USER_STARTED, latch, userInfo.id);
|
||||
mIam.startUserInBackground(userInfo.id);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void switchUser() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final int startUser = mAm.getCurrentUser();
|
||||
final UserInfo userInfo = mUm.createUser("TestUser", 0);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
switchUser(userInfo.id);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
switchUser(startUser);
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stopUser() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final UserInfo userInfo = mUm.createUser("TestUser", 0);
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerBroadcastReceiver(Intent.ACTION_USER_STARTED, latch, userInfo.id);
|
||||
mIam.startUserInBackground(userInfo.id);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
stopUser(userInfo.id, false);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lockedBootCompleted() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final int startUser = mAm.getCurrentUser();
|
||||
final UserInfo userInfo = mUm.createUser("TestUser", 0);
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerUserSwitchObserver(null, latch, userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
mAm.switchUser(userInfo.id);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
switchUser(startUser);
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void managedProfileUnlock() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final UserInfo userInfo = mUm.createProfileForUser("TestUser",
|
||||
UserInfo.FLAG_MANAGED_PROFILE, mAm.getCurrentUser());
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch, userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
mIam.startUserInBackground(userInfo.id);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ephemeralUserStopped() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final int startUser = mAm.getCurrentUser();
|
||||
final UserInfo userInfo = mUm.createUser("TestUser",
|
||||
UserInfo.FLAG_EPHEMERAL | UserInfo.FLAG_DEMO);
|
||||
switchUser(userInfo.id);
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
InstrumentationRegistry.getContext().registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_USER_STOPPED.equals(intent.getAction()) && intent.getIntExtra(
|
||||
Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL) == userInfo.id) {
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
}, new IntentFilter(Intent.ACTION_USER_STOPPED));
|
||||
final CountDownLatch switchLatch = new CountDownLatch(1);
|
||||
registerUserSwitchObserver(switchLatch, null, startUser);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
mAm.switchUser(startUser);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
switchLatch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void managedProfileStopped() throws Exception {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final UserInfo userInfo = mUm.createProfileForUser("TestUser",
|
||||
UserInfo.FLAG_MANAGED_PROFILE, mAm.getCurrentUser());
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerBroadcastReceiver(Intent.ACTION_USER_UNLOCKED, latch, userInfo.id);
|
||||
mIam.startUserInBackground(userInfo.id);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
mRunner.resumeTiming();
|
||||
|
||||
stopUser(userInfo.id, true);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
removeUser(userInfo.id);
|
||||
mRunner.resumeTiming();
|
||||
}
|
||||
}
|
||||
|
||||
private void switchUser(int userId) throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
registerUserSwitchObserver(latch, null, userId);
|
||||
mAm.switchUser(userId);
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void stopUser(int userId, boolean force) throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
mIam.stopUser(userId, force /* force */, new IStopUserCallback.Stub() {
|
||||
@Override
|
||||
public void userStopped(int userId) throws RemoteException {
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userStopAborted(int userId) throws RemoteException {
|
||||
}
|
||||
});
|
||||
latch.await(TIMEOUT_IN_SECOND, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private void registerUserSwitchObserver(final CountDownLatch switchLatch,
|
||||
final CountDownLatch bootCompleteLatch, final int userId) throws Exception {
|
||||
ActivityManager.getService().registerUserSwitchObserver(
|
||||
new UserSwitchObserver() {
|
||||
@Override
|
||||
public void onUserSwitchComplete(int newUserId) throws RemoteException {
|
||||
if (switchLatch != null && userId == newUserId) {
|
||||
switchLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockedBootComplete(int newUserId) {
|
||||
if (bootCompleteLatch != null && userId == newUserId) {
|
||||
bootCompleteLatch.countDown();
|
||||
}
|
||||
}
|
||||
}, TAG);
|
||||
}
|
||||
|
||||
private void registerBroadcastReceiver(final String action, final CountDownLatch latch,
|
||||
final int userId) {
|
||||
InstrumentationRegistry.getContext().registerReceiverAsUser(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (action.equals(intent.getAction()) && intent.getIntExtra(
|
||||
Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL) == userId) {
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
}, UserHandle.of(userId), new IntentFilter(action), null, null);
|
||||
}
|
||||
|
||||
private void removeUser(int userId) {
|
||||
try {
|
||||
mUm.removeUser(userId);
|
||||
final long startTime = System.currentTimeMillis();
|
||||
final long timeoutInMs = TIMEOUT_IN_SECOND * 1000;
|
||||
while (mUm.getUserInfo(userId) != null &&
|
||||
System.currentTimeMillis() - startTime < timeoutInMs) {
|
||||
TimeUnit.MILLISECONDS.sleep(CHECK_USER_REMOVED_INTERVAL_MS);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
if (mUm.getUserInfo(userId) != null) {
|
||||
mUsersToRemove.add(userId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
|
||||
|
||||
# Build all java files in the java subdirectory
|
||||
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||
|
||||
# The name of the jar file to create
|
||||
LOCAL_MODULE := apct-perftests-utils
|
||||
|
||||
# Build a static jar file.
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Provides a benchmark framework.
|
||||
*
|
||||
* Example usage:
|
||||
* // Executes the code while keepRunning returning true.
|
||||
*
|
||||
* public void sampleMethod() {
|
||||
* BenchmarkState state = new BenchmarkState();
|
||||
*
|
||||
* int[] src = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
* while (state.keepRunning()) {
|
||||
* int[] dest = new int[src.length];
|
||||
* System.arraycopy(src, 0, dest, 0, src.length);
|
||||
* }
|
||||
* System.out.println(state.summaryLine());
|
||||
* }
|
||||
*/
|
||||
public final class BenchmarkState {
|
||||
|
||||
private static final String TAG = "BenchmarkState";
|
||||
private static final boolean ENABLE_PROFILING = false;
|
||||
|
||||
private static final int NOT_STARTED = 0; // The benchmark has not started yet.
|
||||
private static final int WARMUP = 1; // The benchmark is warming up.
|
||||
private static final int RUNNING = 2; // The benchmark is running.
|
||||
private static final int FINISHED = 3; // The benchmark has stopped.
|
||||
|
||||
private int mState = NOT_STARTED; // Current benchmark state.
|
||||
|
||||
private static final long WARMUP_DURATION_NS = ms2ns(250); // warm-up for at least 250ms
|
||||
private static final int WARMUP_MIN_ITERATIONS = 16; // minimum iterations to warm-up for
|
||||
|
||||
// TODO: Tune these values.
|
||||
private static final long TARGET_TEST_DURATION_NS = ms2ns(500); // target testing for 500 ms
|
||||
private static final int MAX_TEST_ITERATIONS = 1000000;
|
||||
private static final int MIN_TEST_ITERATIONS = 10;
|
||||
private static final int REPEAT_COUNT = 5;
|
||||
|
||||
private long mStartTimeNs = 0; // Previously captured System.nanoTime().
|
||||
private boolean mPaused;
|
||||
private long mPausedTimeNs = 0; // The System.nanoTime() when the pauseTiming() is called.
|
||||
private long mPausedDurationNs = 0; // The duration of paused state in nano sec.
|
||||
|
||||
private int mIteration = 0;
|
||||
private int mMaxIterations = 0;
|
||||
|
||||
private int mRepeatCount = 0;
|
||||
|
||||
// Statistics. These values will be filled when the benchmark has finished.
|
||||
// The computation needs double precision, but long int is fine for final reporting.
|
||||
private long mMedian = 0;
|
||||
private double mMean = 0.0;
|
||||
private double mStandardDeviation = 0.0;
|
||||
private long mMin = 0;
|
||||
|
||||
// Individual duration in nano seconds.
|
||||
private ArrayList<Long> mResults = new ArrayList<>();
|
||||
|
||||
private static final long ms2ns(long ms) {
|
||||
return TimeUnit.MILLISECONDS.toNanos(ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates statistics.
|
||||
*/
|
||||
private void calculateSatistics() {
|
||||
final int size = mResults.size();
|
||||
if (size <= 1) {
|
||||
throw new IllegalStateException("At least two results are necessary.");
|
||||
}
|
||||
|
||||
Collections.sort(mResults);
|
||||
mMedian = size % 2 == 0 ? (mResults.get(size / 2) + mResults.get(size / 2 + 1)) / 2 :
|
||||
mResults.get(size / 2);
|
||||
|
||||
mMin = mResults.get(0);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
long result = mResults.get(i);
|
||||
mMean += result;
|
||||
if (result < mMin) {
|
||||
mMin = result;
|
||||
}
|
||||
}
|
||||
mMean /= (double) size;
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
final double tmp = mResults.get(i) - mMean;
|
||||
mStandardDeviation += tmp * tmp;
|
||||
}
|
||||
mStandardDeviation = Math.sqrt(mStandardDeviation / (double) (size - 1));
|
||||
}
|
||||
|
||||
// Stops the benchmark timer.
|
||||
// This method can be called only when the timer is running.
|
||||
public void pauseTiming() {
|
||||
if (mPaused) {
|
||||
throw new IllegalStateException(
|
||||
"Unable to pause the benchmark. The benchmark has already paused.");
|
||||
}
|
||||
mPausedTimeNs = System.nanoTime();
|
||||
mPaused = true;
|
||||
}
|
||||
|
||||
// Starts the benchmark timer.
|
||||
// This method can be called only when the timer is stopped.
|
||||
public void resumeTiming() {
|
||||
if (!mPaused) {
|
||||
throw new IllegalStateException(
|
||||
"Unable to resume the benchmark. The benchmark is already running.");
|
||||
}
|
||||
mPausedDurationNs += System.nanoTime() - mPausedTimeNs;
|
||||
mPausedTimeNs = 0;
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
private void beginWarmup() {
|
||||
mStartTimeNs = System.nanoTime();
|
||||
mIteration = 0;
|
||||
mState = WARMUP;
|
||||
}
|
||||
|
||||
private void beginBenchmark(long warmupDuration, int iterations) {
|
||||
if (ENABLE_PROFILING) {
|
||||
File f = new File(InstrumentationRegistry.getContext().getDataDir(), "benchprof");
|
||||
Log.d(TAG, "Tracing to: " + f.getAbsolutePath());
|
||||
Debug.startMethodTracingSampling(f.getAbsolutePath(), 16 * 1024 * 1024, 100);
|
||||
}
|
||||
mMaxIterations = (int) (TARGET_TEST_DURATION_NS / (warmupDuration / iterations));
|
||||
mMaxIterations = Math.min(MAX_TEST_ITERATIONS,
|
||||
Math.max(mMaxIterations, MIN_TEST_ITERATIONS));
|
||||
mPausedDurationNs = 0;
|
||||
mIteration = 0;
|
||||
mRepeatCount = 0;
|
||||
mState = RUNNING;
|
||||
mStartTimeNs = System.nanoTime();
|
||||
}
|
||||
|
||||
private boolean startNextTestRun() {
|
||||
final long currentTime = System.nanoTime();
|
||||
mResults.add((currentTime - mStartTimeNs - mPausedDurationNs) / mMaxIterations);
|
||||
mRepeatCount++;
|
||||
if (mRepeatCount >= REPEAT_COUNT) {
|
||||
if (ENABLE_PROFILING) {
|
||||
Debug.stopMethodTracing();
|
||||
}
|
||||
calculateSatistics();
|
||||
mState = FINISHED;
|
||||
return false;
|
||||
}
|
||||
mPausedDurationNs = 0;
|
||||
mIteration = 0;
|
||||
mStartTimeNs = System.nanoTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judges whether the benchmark needs more samples.
|
||||
*
|
||||
* For the usage, see class comment.
|
||||
*/
|
||||
public boolean keepRunning() {
|
||||
switch (mState) {
|
||||
case NOT_STARTED:
|
||||
beginWarmup();
|
||||
return true;
|
||||
case WARMUP:
|
||||
mIteration++;
|
||||
// Only check nanoTime on every iteration in WARMUP since we
|
||||
// don't yet have a target iteration count.
|
||||
final long duration = System.nanoTime() - mStartTimeNs;
|
||||
if (mIteration >= WARMUP_MIN_ITERATIONS && duration >= WARMUP_DURATION_NS) {
|
||||
beginBenchmark(duration, mIteration);
|
||||
}
|
||||
return true;
|
||||
case RUNNING:
|
||||
mIteration++;
|
||||
if (mIteration >= mMaxIterations) {
|
||||
return startNextTestRun();
|
||||
}
|
||||
if (mPaused) {
|
||||
throw new IllegalStateException(
|
||||
"Benchmark step finished with paused state. " +
|
||||
"Resume the benchmark before finishing each step.");
|
||||
}
|
||||
return true;
|
||||
case FINISHED:
|
||||
throw new IllegalStateException("The benchmark has finished.");
|
||||
default:
|
||||
throw new IllegalStateException("The benchmark is in unknown state.");
|
||||
}
|
||||
}
|
||||
|
||||
private long mean() {
|
||||
if (mState != FINISHED) {
|
||||
throw new IllegalStateException("The benchmark hasn't finished");
|
||||
}
|
||||
return (long) mMean;
|
||||
}
|
||||
|
||||
private long median() {
|
||||
if (mState != FINISHED) {
|
||||
throw new IllegalStateException("The benchmark hasn't finished");
|
||||
}
|
||||
return mMedian;
|
||||
}
|
||||
|
||||
private long min() {
|
||||
if (mState != FINISHED) {
|
||||
throw new IllegalStateException("The benchmark hasn't finished");
|
||||
}
|
||||
return mMin;
|
||||
}
|
||||
|
||||
private long standardDeviation() {
|
||||
if (mState != FINISHED) {
|
||||
throw new IllegalStateException("The benchmark hasn't finished");
|
||||
}
|
||||
return (long) mStandardDeviation;
|
||||
}
|
||||
|
||||
private String summaryLine() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Summary: ");
|
||||
sb.append("median=").append(median()).append("ns, ");
|
||||
sb.append("mean=").append(mean()).append("ns, ");
|
||||
sb.append("min=").append(min()).append("ns, ");
|
||||
sb.append("sigma=").append(standardDeviation()).append(", ");
|
||||
sb.append("iteration=").append(mResults.size()).append(", ");
|
||||
// print out the first few iterations' number for double checking.
|
||||
int sampleNumber = Math.min(mResults.size(), 16);
|
||||
for (int i = 0; i < sampleNumber; i++) {
|
||||
sb.append("No ").append(i).append(" result is ").append(mResults.get(i)).append(", ");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void sendFullStatusReport(Instrumentation instrumentation, String key) {
|
||||
Log.i(TAG, key + summaryLine());
|
||||
Bundle status = new Bundle();
|
||||
status.putLong(key + "_median", median());
|
||||
status.putLong(key + "_mean", mean());
|
||||
status.putLong(key + "_min", min());
|
||||
status.putLong(key + "_standardDeviation", standardDeviation());
|
||||
instrumentation.sendStatus(Activity.RESULT_OK, status);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class BitmapUtils {
|
||||
private static final String TAG = "BitmapUtils";
|
||||
|
||||
public static void saveBitmapIntoPNG(Context context, Bitmap bitmap, int resId) {
|
||||
// Save the image to the disk.
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
String originalFilePath = context.getResources().getString(resId);
|
||||
File originalFile = new File(originalFilePath);
|
||||
String fileFullName = originalFile.getName();
|
||||
String fileTitle = fileFullName.substring(0, fileFullName.lastIndexOf("."));
|
||||
|
||||
File externalFilesDir = context.getExternalFilesDir(null);
|
||||
File outputFile = new File(externalFilesDir, fileTitle + "_generated.png");
|
||||
if (!outputFile.exists()) {
|
||||
outputFile.createNewFile();
|
||||
}
|
||||
|
||||
out = new FileOutputStream(outputFile, false);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
Log.v(TAG, "Write test No." + outputFile.getAbsolutePath() + " to file successfully.");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests.utils;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LayoutUtils {
|
||||
|
||||
private static void recursivelyGather(ViewGroup currentNode, List<View> nodeList) {
|
||||
nodeList.add(currentNode);
|
||||
int count = currentNode.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View view = currentNode.getChildAt(i);
|
||||
if (view instanceof ViewGroup) {
|
||||
recursivelyGather((ViewGroup) view, nodeList);
|
||||
} else {
|
||||
nodeList.add(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattern the whole view tree into a list of View.
|
||||
*/
|
||||
public static List<View> gatherViewTree(ViewGroup root) {
|
||||
List<View> result = new ArrayList<View>();
|
||||
recursivelyGather(root, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* For every node in the list, call requestLayout.
|
||||
*/
|
||||
public static void requestLayoutForAllNodes(List<View> nodeList) {
|
||||
int count = nodeList.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
nodeList.get(i).requestLayout();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests.utils;
|
||||
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Use this rule to make sure we report the status after the test success.
|
||||
*
|
||||
* <code>
|
||||
*
|
||||
* @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
|
||||
* @Test public void functionName() {
|
||||
* ...
|
||||
* BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
|
||||
* while (state.keepRunning()) {
|
||||
* // DO YOUR TEST HERE!
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* When test succeeded, the status report will use the key as
|
||||
* "functionName[optional subTestName]_*"
|
||||
*
|
||||
* Notice that optional subTestName can't be just numbers, that means each sub test needs to have a
|
||||
* name when using parameterization.
|
||||
*/
|
||||
|
||||
public class PerfStatusReporter implements TestRule {
|
||||
private final BenchmarkState mState = new BenchmarkState();
|
||||
|
||||
public BenchmarkState getBenchmarkState() {
|
||||
return mState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
String invokeMethodName = description.getMethodName();
|
||||
// validate and simplify the function name.
|
||||
// First, remove the "test" prefix which normally comes from CTS test.
|
||||
// Then make sure the [subTestName] is valid, not just numbers like [0].
|
||||
if (invokeMethodName.startsWith("test")) {
|
||||
assertTrue("The test name " + invokeMethodName + " is too short",
|
||||
invokeMethodName.length() > 5);
|
||||
invokeMethodName = invokeMethodName.substring(4, 5).toLowerCase()
|
||||
+ invokeMethodName.substring(5);
|
||||
}
|
||||
|
||||
int index = invokeMethodName.lastIndexOf('[');
|
||||
if (index > 0) {
|
||||
boolean allDigits = true;
|
||||
for (int i = index + 1; i < invokeMethodName.length() - 1; i++) {
|
||||
if (!Character.isDigit(invokeMethodName.charAt(i))) {
|
||||
allDigits = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertFalse("The name in [] can't contain only digits for " + invokeMethodName,
|
||||
allDigits);
|
||||
}
|
||||
|
||||
base.evaluate();
|
||||
|
||||
mState.sendFullStatusReport(InstrumentationRegistry.getInstrumentation(),
|
||||
invokeMethodName);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.perftests.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class StubActivity extends Activity {
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,513 @@
|
|||
package android.app {
|
||||
|
||||
public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
|
||||
method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
|
||||
}
|
||||
|
||||
public class ActivityManager {
|
||||
method public static deprecated int getMaxNumPictureInPictureActions();
|
||||
}
|
||||
|
||||
public class KeyguardManager {
|
||||
method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
|
||||
}
|
||||
|
||||
public class Notification implements android.os.Parcelable {
|
||||
method public deprecated java.lang.String getChannel();
|
||||
method public static java.lang.Class<? extends android.app.Notification.Style> getNotificationStyleClass(java.lang.String);
|
||||
method public deprecated long getTimeout();
|
||||
method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
|
||||
}
|
||||
|
||||
public static class Notification.Builder {
|
||||
method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
|
||||
method public deprecated android.app.Notification.Builder setTimeout(long);
|
||||
}
|
||||
|
||||
public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
|
||||
method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
|
||||
method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
|
||||
field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
|
||||
}
|
||||
|
||||
public static class PictureInPictureArgs.Builder {
|
||||
ctor public PictureInPictureArgs.Builder();
|
||||
method public android.app.PictureInPictureArgs build();
|
||||
method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
|
||||
method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
|
||||
method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.admin {
|
||||
|
||||
public class DevicePolicyManager {
|
||||
method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle);
|
||||
method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.usage {
|
||||
|
||||
public final class StorageStats implements android.os.Parcelable {
|
||||
method public deprecated long getCodeBytes();
|
||||
}
|
||||
|
||||
public class StorageStatsManager {
|
||||
method public deprecated long getFreeBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated long getTotalBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated boolean isQuotaSupported(java.lang.String);
|
||||
method public deprecated android.app.usage.ExternalStorageStats queryExternalStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForPackage(java.lang.String, java.lang.String, android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUid(java.lang.String, int) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content {
|
||||
|
||||
public class ClipData implements android.os.Parcelable {
|
||||
method public deprecated void addItem(android.content.ClipData.Item, android.content.ContentResolver);
|
||||
}
|
||||
|
||||
public abstract class Context {
|
||||
method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
|
||||
method public abstract java.io.File getSharedPreferencesPath(java.lang.String);
|
||||
}
|
||||
|
||||
public class Intent implements java.lang.Cloneable android.os.Parcelable {
|
||||
field public static final deprecated java.lang.String EXTRA_QUICK_VIEW_ADVANCED = "android.intent.extra.QUICK_VIEW_ADVANCED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content.pm {
|
||||
|
||||
public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
|
||||
field public deprecated java.lang.String volumeUuid;
|
||||
}
|
||||
|
||||
public class ComponentInfo extends android.content.pm.PackageItemInfo {
|
||||
field public deprecated boolean encryptionAware;
|
||||
}
|
||||
|
||||
public class PackageInfo implements android.os.Parcelable {
|
||||
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
|
||||
}
|
||||
|
||||
public abstract class PackageManager {
|
||||
method public abstract boolean setInstantAppCookie(byte[]);
|
||||
}
|
||||
|
||||
public class ResolveInfo implements android.os.Parcelable {
|
||||
field public deprecated boolean instantAppAvailable;
|
||||
}
|
||||
|
||||
public final class SharedLibraryInfo implements android.os.Parcelable {
|
||||
method public boolean isBuiltin();
|
||||
method public boolean isDynamic();
|
||||
method public boolean isStatic();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.database {
|
||||
|
||||
public abstract class AbstractCursor implements android.database.CrossProcessCursor {
|
||||
field protected java.lang.Long mCurrentRowID;
|
||||
field protected int mRowIdColumnIndex;
|
||||
field protected java.util.HashMap<java.lang.Long, java.util.Map<java.lang.String, java.lang.Object>> mUpdatedRows;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.graphics {
|
||||
|
||||
public deprecated class AvoidXfermode extends android.graphics.Xfermode {
|
||||
ctor public AvoidXfermode(int, int, android.graphics.AvoidXfermode.Mode);
|
||||
}
|
||||
|
||||
public static final class AvoidXfermode.Mode extends java.lang.Enum {
|
||||
method public static android.graphics.AvoidXfermode.Mode valueOf(java.lang.String);
|
||||
method public static final android.graphics.AvoidXfermode.Mode[] values();
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode AVOID;
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
|
||||
}
|
||||
|
||||
public class Canvas {
|
||||
method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
|
||||
method public deprecated boolean clipRegion(android.graphics.Region);
|
||||
}
|
||||
|
||||
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
|
||||
ctor public LayerRasterizer();
|
||||
method public void addLayer(android.graphics.Paint, float, float);
|
||||
method public void addLayer(android.graphics.Paint);
|
||||
}
|
||||
|
||||
public class Paint {
|
||||
method public deprecated android.graphics.Rasterizer getRasterizer();
|
||||
method public deprecated android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer);
|
||||
}
|
||||
|
||||
public deprecated class PixelXorXfermode extends android.graphics.Xfermode {
|
||||
ctor public PixelXorXfermode(int);
|
||||
}
|
||||
|
||||
public class Rasterizer {
|
||||
ctor public Rasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.hardware {
|
||||
|
||||
public final class HardwareBuffer implements java.lang.AutoCloseable android.os.Parcelable {
|
||||
method public deprecated void destroy();
|
||||
method public deprecated boolean isDestroyed();
|
||||
}
|
||||
|
||||
public final class SensorDirectChannel implements java.nio.channels.Channel {
|
||||
method public deprecated boolean isValid();
|
||||
}
|
||||
|
||||
public abstract class SensorManager {
|
||||
method public deprecated int configureDirectChannel(android.hardware.SensorDirectChannel, android.hardware.Sensor, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.location {
|
||||
|
||||
public class Location implements android.os.Parcelable {
|
||||
method public deprecated void removeBearingAccuracy();
|
||||
method public deprecated void removeSpeedAccuracy();
|
||||
method public deprecated void removeVerticalAccuracy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media {
|
||||
|
||||
public final class AudioFormat implements android.os.Parcelable {
|
||||
ctor public AudioFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media.tv {
|
||||
|
||||
public final class TvInputManager {
|
||||
method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo);
|
||||
}
|
||||
|
||||
public class TvView extends android.view.ViewGroup {
|
||||
method public void requestUnblockContent(android.media.tv.TvContentRating);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net {
|
||||
|
||||
public class ConnectivityManager {
|
||||
method public deprecated boolean requestRouteToHost(int, int);
|
||||
method public deprecated int startUsingNetworkFeature(int, java.lang.String);
|
||||
method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
|
||||
}
|
||||
|
||||
public deprecated class NetworkBadging {
|
||||
method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
|
||||
field public static final int BADGING_4K = 30; // 0x1e
|
||||
field public static final int BADGING_HD = 20; // 0x14
|
||||
field public static final int BADGING_NONE = 0; // 0x0
|
||||
field public static final int BADGING_SD = 10; // 0xa
|
||||
}
|
||||
|
||||
public abstract class PskKeyManager {
|
||||
ctor public PskKeyManager();
|
||||
field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_IDENTITY_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
|
||||
}
|
||||
|
||||
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
|
||||
method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os {
|
||||
|
||||
public class BatteryManager {
|
||||
ctor public BatteryManager();
|
||||
}
|
||||
|
||||
public final class PowerManager {
|
||||
method public void goToSleep(long);
|
||||
method public deprecated void userActivity(long, boolean);
|
||||
method public void wakeUp(long);
|
||||
}
|
||||
|
||||
public class RecoverySystem {
|
||||
ctor public RecoverySystem();
|
||||
}
|
||||
|
||||
public class TestLooperManager {
|
||||
method public deprecated android.os.MessageQueue getQueue();
|
||||
}
|
||||
|
||||
public class UserManager {
|
||||
method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
|
||||
method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
|
||||
method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os.storage {
|
||||
|
||||
public class StorageManager {
|
||||
method public android.os.storage.StorageVolume getPrimaryVolume();
|
||||
method public android.os.storage.StorageVolume[] getVolumeList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.provider {
|
||||
|
||||
public class Browser {
|
||||
method public static final void addSearchUrl(android.content.ContentResolver, java.lang.String);
|
||||
method public static final boolean canClearHistory(android.content.ContentResolver);
|
||||
method public static final void clearHistory(android.content.ContentResolver);
|
||||
method public static final void clearSearches(android.content.ContentResolver);
|
||||
method public static final void deleteFromHistory(android.content.ContentResolver, java.lang.String);
|
||||
method public static final void deleteHistoryTimeFrame(android.content.ContentResolver, long, long);
|
||||
method public static final android.database.Cursor getAllBookmarks(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final android.database.Cursor getAllVisitedUrls(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final void requestAllIcons(android.content.ContentResolver, java.lang.String, android.webkit.WebIconDatabase.IconListener);
|
||||
method public static final void saveBookmark(android.content.Context, java.lang.String, java.lang.String);
|
||||
method public static final void truncateHistory(android.content.ContentResolver);
|
||||
method public static final void updateVisitedHistory(android.content.ContentResolver, java.lang.String, boolean);
|
||||
field public static final android.net.Uri BOOKMARKS_URI;
|
||||
field public static final java.lang.String[] HISTORY_PROJECTION;
|
||||
field public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4; // 0x4
|
||||
field public static final int HISTORY_PROJECTION_DATE_INDEX = 3; // 0x3
|
||||
field public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6; // 0x6
|
||||
field public static final int HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int HISTORY_PROJECTION_TITLE_INDEX = 5; // 0x5
|
||||
field public static final int HISTORY_PROJECTION_URL_INDEX = 1; // 0x1
|
||||
field public static final int HISTORY_PROJECTION_VISITS_INDEX = 2; // 0x2
|
||||
field public static final java.lang.String[] SEARCHES_PROJECTION;
|
||||
field public static final int SEARCHES_PROJECTION_DATE_INDEX = 2; // 0x2
|
||||
field public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1; // 0x1
|
||||
field public static final android.net.Uri SEARCHES_URI;
|
||||
field public static final java.lang.String[] TRUNCATE_HISTORY_PROJECTION;
|
||||
field public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int TRUNCATE_N_OLDEST = 5; // 0x5
|
||||
}
|
||||
|
||||
public static class Browser.BookmarkColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.BookmarkColumns();
|
||||
field public static final java.lang.String BOOKMARK = "bookmark";
|
||||
field public static final java.lang.String CREATED = "created";
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String FAVICON = "favicon";
|
||||
field public static final java.lang.String TITLE = "title";
|
||||
field public static final java.lang.String URL = "url";
|
||||
field public static final java.lang.String VISITS = "visits";
|
||||
}
|
||||
|
||||
public static class Browser.SearchColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.SearchColumns();
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String SEARCH = "search";
|
||||
field public static final deprecated java.lang.String URL = "url";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.Contacts.StreamItems {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String PHOTO = "photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
|
||||
field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
|
||||
field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
|
||||
field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
|
||||
field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
|
||||
field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_URI;
|
||||
field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
|
||||
field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
|
||||
field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
|
||||
field public static final deprecated java.lang.String COMMENTS = "comments";
|
||||
field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
|
||||
field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
|
||||
field public static final deprecated java.lang.String DATA_SET = "data_set";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
|
||||
field public static final deprecated java.lang.String RES_ICON = "icon";
|
||||
field public static final deprecated java.lang.String RES_LABEL = "label";
|
||||
field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
|
||||
field public static final deprecated java.lang.String TEXT = "text";
|
||||
field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
|
||||
}
|
||||
|
||||
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
|
||||
field public static final deprecated java.lang.String CONTACT_METADATA_SYNC = "contact_metadata_sync";
|
||||
}
|
||||
|
||||
public static final class Settings.System extends android.provider.Settings.NameValueTable {
|
||||
field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
|
||||
field public static final java.lang.String VOLUME_ALARM = "volume_alarm";
|
||||
field public static final java.lang.String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
|
||||
field public static final java.lang.String VOLUME_MUSIC = "volume_music";
|
||||
field public static final java.lang.String VOLUME_NOTIFICATION = "volume_notification";
|
||||
field public static final java.lang.String VOLUME_RING = "volume_ring";
|
||||
field public static final java.lang.String[] VOLUME_SETTINGS;
|
||||
field public static final java.lang.String VOLUME_SYSTEM = "volume_system";
|
||||
field public static final java.lang.String VOLUME_VOICE = "volume_voice";
|
||||
}
|
||||
|
||||
public static final class Telephony.Sms.Intents {
|
||||
field public static final java.lang.String SMS_EMERGENCY_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.speech.tts {
|
||||
|
||||
public abstract class UtteranceProgressListener {
|
||||
method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.test.mock {
|
||||
|
||||
public deprecated class MockPackageManager extends android.content.pm.PackageManager {
|
||||
method public deprecated java.lang.String getDefaultBrowserPackageName(int);
|
||||
method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.format {
|
||||
|
||||
public class DateFormat {
|
||||
field public static final deprecated char AM_PM = 97; // 0x0061 'a'
|
||||
field public static final deprecated char CAPITAL_AM_PM = 65; // 0x0041 'A'
|
||||
field public static final deprecated char DATE = 100; // 0x0064 'd'
|
||||
field public static final deprecated char DAY = 69; // 0x0045 'E'
|
||||
field public static final deprecated char HOUR = 104; // 0x0068 'h'
|
||||
field public static final deprecated char HOUR_OF_DAY = 107; // 0x006b 'k'
|
||||
field public static final deprecated char MINUTE = 109; // 0x006d 'm'
|
||||
field public static final deprecated char MONTH = 77; // 0x004d 'M'
|
||||
field public static final deprecated char QUOTE = 39; // 0x0027 '\''
|
||||
field public static final deprecated char SECONDS = 115; // 0x0073 's'
|
||||
field public static final deprecated char STANDALONE_MONTH = 76; // 0x004c 'L'
|
||||
field public static final deprecated char TIME_ZONE = 122; // 0x007a 'z'
|
||||
field public static final deprecated char YEAR = 121; // 0x0079 'y'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.style {
|
||||
|
||||
public class RasterizerSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance {
|
||||
ctor public RasterizerSpan(android.graphics.Rasterizer);
|
||||
method public android.graphics.Rasterizer getRasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.util {
|
||||
|
||||
public deprecated class FloatMath {
|
||||
method public static float ceil(float);
|
||||
method public static float cos(float);
|
||||
method public static float exp(float);
|
||||
method public static float floor(float);
|
||||
method public static float hypot(float, float);
|
||||
method public static float pow(float, float);
|
||||
method public static float sin(float);
|
||||
method public static float sqrt(float);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view {
|
||||
|
||||
public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
|
||||
method protected void initializeFadingEdge(android.content.res.TypedArray);
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view.accessibility {
|
||||
|
||||
public final class AccessibilityWindowInfo implements android.os.Parcelable {
|
||||
method public boolean inPictureInPicture();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.webkit {
|
||||
|
||||
public class WebViewClient {
|
||||
method public void onUnhandledInputEvent(android.webkit.WebView, android.view.InputEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.widget {
|
||||
|
||||
public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
|
||||
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
|
||||
method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,638 @@
|
|||
package android.app {
|
||||
|
||||
public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
|
||||
method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
|
||||
}
|
||||
|
||||
public class ActivityManager {
|
||||
method public static deprecated int getMaxNumPictureInPictureActions();
|
||||
}
|
||||
|
||||
public abstract deprecated class EphemeralResolverService extends android.app.InstantAppResolverService {
|
||||
ctor public EphemeralResolverService();
|
||||
method public abstract deprecated java.util.List<android.content.pm.EphemeralResolveInfo> onEphemeralResolveInfoList(int[], int);
|
||||
method public android.content.pm.EphemeralResolveInfo onGetEphemeralIntentFilter(java.lang.String);
|
||||
method public java.util.List<android.content.pm.EphemeralResolveInfo> onGetEphemeralResolveInfo(int[]);
|
||||
}
|
||||
|
||||
public class KeyguardManager {
|
||||
method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
|
||||
}
|
||||
|
||||
public class Notification implements android.os.Parcelable {
|
||||
method public deprecated java.lang.String getChannel();
|
||||
method public static java.lang.Class<? extends android.app.Notification.Style> getNotificationStyleClass(java.lang.String);
|
||||
method public deprecated long getTimeout();
|
||||
method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
|
||||
}
|
||||
|
||||
public static class Notification.Builder {
|
||||
method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
|
||||
method public deprecated android.app.Notification.Builder setTimeout(long);
|
||||
}
|
||||
|
||||
public static final class Notification.TvExtender implements android.app.Notification.Extender {
|
||||
method public deprecated java.lang.String getChannel();
|
||||
}
|
||||
|
||||
public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
|
||||
method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
|
||||
method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
|
||||
field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
|
||||
}
|
||||
|
||||
public static class PictureInPictureArgs.Builder {
|
||||
ctor public PictureInPictureArgs.Builder();
|
||||
method public android.app.PictureInPictureArgs build();
|
||||
method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
|
||||
method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
|
||||
method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.admin {
|
||||
|
||||
public class DevicePolicyManager {
|
||||
method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle);
|
||||
method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String);
|
||||
method public deprecated java.lang.String getDeviceInitializerApp();
|
||||
method public deprecated android.content.ComponentName getDeviceInitializerComponent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.usage {
|
||||
|
||||
public final class StorageStats implements android.os.Parcelable {
|
||||
method public deprecated long getCodeBytes();
|
||||
}
|
||||
|
||||
public class StorageStatsManager {
|
||||
method public deprecated long getFreeBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated long getTotalBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated boolean isQuotaSupported(java.lang.String);
|
||||
method public deprecated android.app.usage.ExternalStorageStats queryExternalStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForPackage(java.lang.String, java.lang.String, android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUid(java.lang.String, int) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content {
|
||||
|
||||
public class ClipData implements android.os.Parcelable {
|
||||
method public deprecated void addItem(android.content.ClipData.Item, android.content.ContentResolver);
|
||||
}
|
||||
|
||||
public abstract class Context {
|
||||
method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
|
||||
method public abstract java.io.File getSharedPreferencesPath(java.lang.String);
|
||||
}
|
||||
|
||||
public class Intent implements java.lang.Cloneable android.os.Parcelable {
|
||||
field public static final deprecated java.lang.String ACTION_DEVICE_INITIALIZATION_WIZARD = "android.intent.action.DEVICE_INITIALIZATION_WIZARD";
|
||||
field public static final deprecated java.lang.String ACTION_EPHEMERAL_RESOLVER_SETTINGS = "android.intent.action.EPHEMERAL_RESOLVER_SETTINGS";
|
||||
field public static final deprecated java.lang.String ACTION_INSTALL_EPHEMERAL_PACKAGE = "android.intent.action.INSTALL_EPHEMERAL_PACKAGE";
|
||||
field public static final deprecated java.lang.String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR";
|
||||
field public static final deprecated java.lang.String ACTION_RESOLVE_EPHEMERAL_PACKAGE = "android.intent.action.RESOLVE_EPHEMERAL_PACKAGE";
|
||||
field public static final deprecated java.lang.String ACTION_SERVICE_STATE = "android.intent.action.SERVICE_STATE";
|
||||
field public static final deprecated java.lang.String EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR = "cdmaDefaultRoamingIndicator";
|
||||
field public static final deprecated java.lang.String EXTRA_CDMA_ROAMING_INDICATOR = "cdmaRoamingIndicator";
|
||||
field public static final deprecated java.lang.String EXTRA_CSS_INDICATOR = "cssIndicator";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_OPERATOR_ALPHA_LONG = "data-operator-alpha-long";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_OPERATOR_ALPHA_SHORT = "data-operator-alpha-short";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_OPERATOR_NUMERIC = "data-operator-numeric";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_RADIO_TECH = "dataRadioTechnology";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_REG_STATE = "dataRegState";
|
||||
field public static final deprecated java.lang.String EXTRA_DATA_ROAMING_TYPE = "dataRoamingType";
|
||||
field public static final deprecated java.lang.String EXTRA_EMERGENCY_ONLY = "emergencyOnly";
|
||||
field public static final deprecated java.lang.String EXTRA_IS_DATA_ROAMING_FROM_REGISTRATION = "isDataRoamingFromRegistration";
|
||||
field public static final deprecated java.lang.String EXTRA_IS_USING_CARRIER_AGGREGATION = "isUsingCarrierAggregation";
|
||||
field public static final deprecated java.lang.String EXTRA_LTE_EARFCN_RSRP_BOOST = "LteEarfcnRsrpBoost";
|
||||
field public static final deprecated java.lang.String EXTRA_MANUAL = "manual";
|
||||
field public static final deprecated java.lang.String EXTRA_NETWORK_ID = "networkId";
|
||||
field public static final deprecated java.lang.String EXTRA_OPERATOR_ALPHA_LONG = "operator-alpha-long";
|
||||
field public static final deprecated java.lang.String EXTRA_OPERATOR_ALPHA_SHORT = "operator-alpha-short";
|
||||
field public static final deprecated java.lang.String EXTRA_OPERATOR_NUMERIC = "operator-numeric";
|
||||
field public static final deprecated java.lang.String EXTRA_QUICK_VIEW_ADVANCED = "android.intent.extra.QUICK_VIEW_ADVANCED";
|
||||
field public static final deprecated java.lang.String EXTRA_SYSTEM_ID = "systemId";
|
||||
field public static final deprecated java.lang.String EXTRA_VOICE_RADIO_TECH = "radioTechnology";
|
||||
field public static final deprecated java.lang.String EXTRA_VOICE_REG_STATE = "voiceRegState";
|
||||
field public static final deprecated java.lang.String EXTRA_VOICE_ROAMING_TYPE = "voiceRoamingType";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content.pm {
|
||||
|
||||
public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
|
||||
field public deprecated java.lang.String volumeUuid;
|
||||
}
|
||||
|
||||
public class ComponentInfo extends android.content.pm.PackageItemInfo {
|
||||
field public deprecated boolean encryptionAware;
|
||||
}
|
||||
|
||||
public final deprecated class EphemeralIntentFilter implements android.os.Parcelable {
|
||||
ctor public EphemeralIntentFilter(java.lang.String, java.util.List<android.content.IntentFilter>);
|
||||
method public java.util.List<android.content.IntentFilter> getFilters();
|
||||
method public java.lang.String getSplitName();
|
||||
field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralIntentFilter> CREATOR;
|
||||
}
|
||||
|
||||
public final deprecated class EphemeralResolveInfo implements android.os.Parcelable {
|
||||
ctor public deprecated EphemeralResolveInfo(android.net.Uri, java.lang.String, java.util.List<android.content.IntentFilter>);
|
||||
ctor public deprecated EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo.EphemeralDigest, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>);
|
||||
ctor public EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo.EphemeralDigest, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>, int);
|
||||
ctor public EphemeralResolveInfo(java.lang.String, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>);
|
||||
method public byte[] getDigestBytes();
|
||||
method public int getDigestPrefix();
|
||||
method public deprecated java.util.List<android.content.IntentFilter> getFilters();
|
||||
method public java.util.List<android.content.pm.EphemeralIntentFilter> getIntentFilters();
|
||||
method public java.lang.String getPackageName();
|
||||
method public int getVersionCode();
|
||||
field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralResolveInfo> CREATOR;
|
||||
field public static final java.lang.String SHA_ALGORITHM = "SHA-256";
|
||||
}
|
||||
|
||||
public static final class EphemeralResolveInfo.EphemeralDigest implements android.os.Parcelable {
|
||||
ctor public EphemeralResolveInfo.EphemeralDigest(java.lang.String);
|
||||
method public byte[][] getDigestBytes();
|
||||
method public int[] getDigestPrefix();
|
||||
field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralResolveInfo.EphemeralDigest> CREATOR;
|
||||
}
|
||||
|
||||
public class PackageInfo implements android.os.Parcelable {
|
||||
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
|
||||
}
|
||||
|
||||
public abstract class PackageManager {
|
||||
method public abstract boolean setInstantAppCookie(byte[]);
|
||||
}
|
||||
|
||||
public class ResolveInfo implements android.os.Parcelable {
|
||||
field public deprecated boolean instantAppAvailable;
|
||||
}
|
||||
|
||||
public final class SharedLibraryInfo implements android.os.Parcelable {
|
||||
method public boolean isBuiltin();
|
||||
method public boolean isDynamic();
|
||||
method public boolean isStatic();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.database {
|
||||
|
||||
public abstract class AbstractCursor implements android.database.CrossProcessCursor {
|
||||
field protected java.lang.Long mCurrentRowID;
|
||||
field protected int mRowIdColumnIndex;
|
||||
field protected java.util.HashMap<java.lang.Long, java.util.Map<java.lang.String, java.lang.Object>> mUpdatedRows;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.graphics {
|
||||
|
||||
public deprecated class AvoidXfermode extends android.graphics.Xfermode {
|
||||
ctor public AvoidXfermode(int, int, android.graphics.AvoidXfermode.Mode);
|
||||
}
|
||||
|
||||
public static final class AvoidXfermode.Mode extends java.lang.Enum {
|
||||
method public static android.graphics.AvoidXfermode.Mode valueOf(java.lang.String);
|
||||
method public static final android.graphics.AvoidXfermode.Mode[] values();
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode AVOID;
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
|
||||
}
|
||||
|
||||
public class Canvas {
|
||||
method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
|
||||
method public deprecated boolean clipRegion(android.graphics.Region);
|
||||
}
|
||||
|
||||
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
|
||||
ctor public LayerRasterizer();
|
||||
method public void addLayer(android.graphics.Paint, float, float);
|
||||
method public void addLayer(android.graphics.Paint);
|
||||
}
|
||||
|
||||
public class Paint {
|
||||
method public deprecated android.graphics.Rasterizer getRasterizer();
|
||||
method public deprecated android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer);
|
||||
}
|
||||
|
||||
public deprecated class PixelXorXfermode extends android.graphics.Xfermode {
|
||||
ctor public PixelXorXfermode(int);
|
||||
}
|
||||
|
||||
public class Rasterizer {
|
||||
ctor public Rasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.hardware {
|
||||
|
||||
public final class HardwareBuffer implements java.lang.AutoCloseable android.os.Parcelable {
|
||||
method public deprecated void destroy();
|
||||
method public deprecated boolean isDestroyed();
|
||||
}
|
||||
|
||||
public final class SensorDirectChannel implements java.nio.channels.Channel {
|
||||
method public deprecated boolean isValid();
|
||||
}
|
||||
|
||||
public abstract class SensorManager {
|
||||
method public deprecated int configureDirectChannel(android.hardware.SensorDirectChannel, android.hardware.Sensor, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.location {
|
||||
|
||||
public class Location implements android.os.Parcelable {
|
||||
method public deprecated void removeBearingAccuracy();
|
||||
method public deprecated void removeSpeedAccuracy();
|
||||
method public deprecated void removeVerticalAccuracy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media {
|
||||
|
||||
public final class AudioFormat implements android.os.Parcelable {
|
||||
ctor public AudioFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media.tv {
|
||||
|
||||
public final class TvInputManager {
|
||||
method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo);
|
||||
}
|
||||
|
||||
public class TvView extends android.view.ViewGroup {
|
||||
method public void requestUnblockContent(android.media.tv.TvContentRating);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net {
|
||||
|
||||
public class ConnectivityManager {
|
||||
method public deprecated boolean requestRouteToHost(int, int);
|
||||
method public deprecated int startUsingNetworkFeature(int, java.lang.String);
|
||||
method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
|
||||
}
|
||||
|
||||
public deprecated class NetworkBadging {
|
||||
method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
|
||||
field public static final int BADGING_4K = 30; // 0x1e
|
||||
field public static final int BADGING_HD = 20; // 0x14
|
||||
field public static final int BADGING_NONE = 0; // 0x0
|
||||
field public static final int BADGING_SD = 10; // 0xa
|
||||
}
|
||||
|
||||
public abstract class PskKeyManager {
|
||||
ctor public PskKeyManager();
|
||||
field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_IDENTITY_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
|
||||
}
|
||||
|
||||
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
|
||||
method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net.wifi {
|
||||
|
||||
public class ScanResult implements android.os.Parcelable {
|
||||
field public boolean untrusted;
|
||||
}
|
||||
|
||||
public class WifiConnectionStatistics implements android.os.Parcelable {
|
||||
ctor public WifiConnectionStatistics();
|
||||
ctor public WifiConnectionStatistics(android.net.wifi.WifiConnectionStatistics);
|
||||
method public void incrementOrAddUntrusted(java.lang.String, int, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiConnectionStatistics> CREATOR;
|
||||
field public int num24GhzConnected;
|
||||
field public int num5GhzConnected;
|
||||
field public int numAutoJoinAttempt;
|
||||
field public int numAutoRoamAttempt;
|
||||
field public int numWifiManagerJoinAttempt;
|
||||
field public java.util.HashMap<java.lang.String, android.net.wifi.WifiNetworkConnectionStatistics> untrustedNetworkHistory;
|
||||
}
|
||||
|
||||
public class WifiManager {
|
||||
method public deprecated java.util.List<android.net.wifi.BatchedScanResult> getBatchedScanResults();
|
||||
method public android.net.wifi.WifiConnectionStatistics getConnectionStatistics();
|
||||
method public deprecated boolean isBatchedScanSupported();
|
||||
method public deprecated boolean setWifiApEnabled(android.net.wifi.WifiConfiguration, boolean);
|
||||
method public deprecated boolean startLocationRestrictedScan(android.os.WorkSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os {
|
||||
|
||||
public class BatteryManager {
|
||||
ctor public BatteryManager();
|
||||
}
|
||||
|
||||
public class Build {
|
||||
field public static final boolean PERMISSIONS_REVIEW_REQUIRED;
|
||||
}
|
||||
|
||||
public final class PowerManager {
|
||||
method public void goToSleep(long);
|
||||
method public deprecated boolean isScreenBrightnessBoosted();
|
||||
method public deprecated void userActivity(long, boolean);
|
||||
method public void wakeUp(long);
|
||||
field public static final deprecated java.lang.String ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED = "android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED";
|
||||
}
|
||||
|
||||
public class RecoverySystem {
|
||||
ctor public RecoverySystem();
|
||||
}
|
||||
|
||||
public class TestLooperManager {
|
||||
method public deprecated android.os.MessageQueue getQueue();
|
||||
}
|
||||
|
||||
public class UserManager {
|
||||
method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
|
||||
method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
|
||||
method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os.storage {
|
||||
|
||||
public class StorageManager {
|
||||
method public android.os.storage.StorageVolume getPrimaryVolume();
|
||||
method public android.os.storage.StorageVolume[] getVolumeList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.provider {
|
||||
|
||||
public class Browser {
|
||||
method public static final void addSearchUrl(android.content.ContentResolver, java.lang.String);
|
||||
method public static final boolean canClearHistory(android.content.ContentResolver);
|
||||
method public static final void clearHistory(android.content.ContentResolver);
|
||||
method public static final void clearSearches(android.content.ContentResolver);
|
||||
method public static final void deleteFromHistory(android.content.ContentResolver, java.lang.String);
|
||||
method public static final void deleteHistoryTimeFrame(android.content.ContentResolver, long, long);
|
||||
method public static final android.database.Cursor getAllBookmarks(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final android.database.Cursor getAllVisitedUrls(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final void requestAllIcons(android.content.ContentResolver, java.lang.String, android.webkit.WebIconDatabase.IconListener);
|
||||
method public static final void saveBookmark(android.content.Context, java.lang.String, java.lang.String);
|
||||
method public static final void truncateHistory(android.content.ContentResolver);
|
||||
method public static final void updateVisitedHistory(android.content.ContentResolver, java.lang.String, boolean);
|
||||
field public static final android.net.Uri BOOKMARKS_URI;
|
||||
field public static final java.lang.String[] HISTORY_PROJECTION;
|
||||
field public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4; // 0x4
|
||||
field public static final int HISTORY_PROJECTION_DATE_INDEX = 3; // 0x3
|
||||
field public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6; // 0x6
|
||||
field public static final int HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int HISTORY_PROJECTION_TITLE_INDEX = 5; // 0x5
|
||||
field public static final int HISTORY_PROJECTION_URL_INDEX = 1; // 0x1
|
||||
field public static final int HISTORY_PROJECTION_VISITS_INDEX = 2; // 0x2
|
||||
field public static final java.lang.String[] SEARCHES_PROJECTION;
|
||||
field public static final int SEARCHES_PROJECTION_DATE_INDEX = 2; // 0x2
|
||||
field public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1; // 0x1
|
||||
field public static final android.net.Uri SEARCHES_URI;
|
||||
field public static final java.lang.String[] TRUNCATE_HISTORY_PROJECTION;
|
||||
field public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int TRUNCATE_N_OLDEST = 5; // 0x5
|
||||
}
|
||||
|
||||
public static class Browser.BookmarkColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.BookmarkColumns();
|
||||
field public static final java.lang.String BOOKMARK = "bookmark";
|
||||
field public static final java.lang.String CREATED = "created";
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String FAVICON = "favicon";
|
||||
field public static final java.lang.String TITLE = "title";
|
||||
field public static final java.lang.String URL = "url";
|
||||
field public static final java.lang.String VISITS = "visits";
|
||||
}
|
||||
|
||||
public static class Browser.SearchColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.SearchColumns();
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String SEARCH = "search";
|
||||
field public static final deprecated java.lang.String URL = "url";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.Contacts.StreamItems {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String PHOTO = "photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
|
||||
field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
|
||||
field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
|
||||
field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
|
||||
field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
|
||||
field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_URI;
|
||||
field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
|
||||
field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
|
||||
field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
|
||||
field public static final deprecated java.lang.String COMMENTS = "comments";
|
||||
field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
|
||||
field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
|
||||
field public static final deprecated java.lang.String DATA_SET = "data_set";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
|
||||
field public static final deprecated java.lang.String RES_ICON = "icon";
|
||||
field public static final deprecated java.lang.String RES_LABEL = "label";
|
||||
field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
|
||||
field public static final deprecated java.lang.String TEXT = "text";
|
||||
field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
|
||||
}
|
||||
|
||||
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
|
||||
field public static final deprecated java.lang.String CONTACT_METADATA_SYNC = "contact_metadata_sync";
|
||||
}
|
||||
|
||||
public static final class Settings.System extends android.provider.Settings.NameValueTable {
|
||||
field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
|
||||
field public static final java.lang.String VOLUME_ALARM = "volume_alarm";
|
||||
field public static final java.lang.String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
|
||||
field public static final java.lang.String VOLUME_MUSIC = "volume_music";
|
||||
field public static final java.lang.String VOLUME_NOTIFICATION = "volume_notification";
|
||||
field public static final java.lang.String VOLUME_RING = "volume_ring";
|
||||
field public static final java.lang.String[] VOLUME_SETTINGS;
|
||||
field public static final java.lang.String VOLUME_SYSTEM = "volume_system";
|
||||
field public static final java.lang.String VOLUME_VOICE = "volume_voice";
|
||||
}
|
||||
|
||||
public static final class Telephony.Sms.Intents {
|
||||
field public static final java.lang.String SMS_EMERGENCY_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.service.notification {
|
||||
|
||||
public abstract class NotificationListenerService extends android.app.Service {
|
||||
method public android.service.notification.StatusBarNotification[] getActiveNotifications(int);
|
||||
method public android.service.notification.StatusBarNotification[] getActiveNotifications(java.lang.String[], int);
|
||||
method public void registerAsSystemService(android.content.Context, android.content.ComponentName, int) throws android.os.RemoteException;
|
||||
method public final void setOnNotificationPostedTrim(int);
|
||||
method public final void snoozeNotification(java.lang.String, java.lang.String);
|
||||
method public void unregisterAsSystemService() throws android.os.RemoteException;
|
||||
field public static final int TRIM_FULL = 0; // 0x0
|
||||
field public static final int TRIM_LIGHT = 1; // 0x1
|
||||
}
|
||||
|
||||
public static class NotificationListenerService.Ranking {
|
||||
method public java.util.List<java.lang.String> getAdditionalPeople();
|
||||
method public java.util.List<android.service.notification.SnoozeCriterion> getSnoozeCriteria();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.speech.tts {
|
||||
|
||||
public abstract class UtteranceProgressListener {
|
||||
method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.test.mock {
|
||||
|
||||
public deprecated class MockPackageManager extends android.content.pm.PackageManager {
|
||||
method public deprecated java.lang.String getDefaultBrowserPackageName(int);
|
||||
method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.format {
|
||||
|
||||
public class DateFormat {
|
||||
field public static final deprecated char AM_PM = 97; // 0x0061 'a'
|
||||
field public static final deprecated char CAPITAL_AM_PM = 65; // 0x0041 'A'
|
||||
field public static final deprecated char DATE = 100; // 0x0064 'd'
|
||||
field public static final deprecated char DAY = 69; // 0x0045 'E'
|
||||
field public static final deprecated char HOUR = 104; // 0x0068 'h'
|
||||
field public static final deprecated char HOUR_OF_DAY = 107; // 0x006b 'k'
|
||||
field public static final deprecated char MINUTE = 109; // 0x006d 'm'
|
||||
field public static final deprecated char MONTH = 77; // 0x004d 'M'
|
||||
field public static final deprecated char QUOTE = 39; // 0x0027 '\''
|
||||
field public static final deprecated char SECONDS = 115; // 0x0073 's'
|
||||
field public static final deprecated char STANDALONE_MONTH = 76; // 0x004c 'L'
|
||||
field public static final deprecated char TIME_ZONE = 122; // 0x007a 'z'
|
||||
field public static final deprecated char YEAR = 121; // 0x0079 'y'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.style {
|
||||
|
||||
public class RasterizerSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance {
|
||||
ctor public RasterizerSpan(android.graphics.Rasterizer);
|
||||
method public android.graphics.Rasterizer getRasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.util {
|
||||
|
||||
public deprecated class FloatMath {
|
||||
method public static float ceil(float);
|
||||
method public static float cos(float);
|
||||
method public static float exp(float);
|
||||
method public static float floor(float);
|
||||
method public static float hypot(float, float);
|
||||
method public static float pow(float, float);
|
||||
method public static float sin(float);
|
||||
method public static float sqrt(float);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view {
|
||||
|
||||
public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
|
||||
method protected void initializeFadingEdge(android.content.res.TypedArray);
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view.accessibility {
|
||||
|
||||
public final class AccessibilityWindowInfo implements android.os.Parcelable {
|
||||
method public boolean inPictureInPicture();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.webkit {
|
||||
|
||||
public class WebViewClient {
|
||||
method public void onUnhandledInputEvent(android.webkit.WebView, android.view.InputEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.widget {
|
||||
|
||||
public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
|
||||
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
|
||||
method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,513 @@
|
|||
package android.app {
|
||||
|
||||
public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public deprecated boolean enterPictureInPictureMode(android.app.PictureInPictureArgs);
|
||||
method public deprecated void setPictureInPictureArgs(android.app.PictureInPictureArgs);
|
||||
}
|
||||
|
||||
public class ActivityManager {
|
||||
method public static deprecated int getMaxNumPictureInPictureActions();
|
||||
}
|
||||
|
||||
public class KeyguardManager {
|
||||
method public deprecated void dismissKeyguard(android.app.Activity, android.app.KeyguardManager.KeyguardDismissCallback, android.os.Handler);
|
||||
}
|
||||
|
||||
public class Notification implements android.os.Parcelable {
|
||||
method public deprecated java.lang.String getChannel();
|
||||
method public static java.lang.Class<? extends android.app.Notification.Style> getNotificationStyleClass(java.lang.String);
|
||||
method public deprecated long getTimeout();
|
||||
method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
|
||||
}
|
||||
|
||||
public static class Notification.Builder {
|
||||
method public deprecated android.app.Notification.Builder setChannel(java.lang.String);
|
||||
method public deprecated android.app.Notification.Builder setTimeout(long);
|
||||
}
|
||||
|
||||
public final deprecated class PictureInPictureArgs implements android.os.Parcelable {
|
||||
method public static android.app.PictureInPictureArgs convert(android.app.PictureInPictureParams);
|
||||
method public static android.app.PictureInPictureParams convert(android.app.PictureInPictureArgs);
|
||||
field public static final android.os.Parcelable.Creator<android.app.PictureInPictureArgs> CREATOR;
|
||||
}
|
||||
|
||||
public static class PictureInPictureArgs.Builder {
|
||||
ctor public PictureInPictureArgs.Builder();
|
||||
method public android.app.PictureInPictureArgs build();
|
||||
method public android.app.PictureInPictureArgs.Builder setActions(java.util.List<android.app.RemoteAction>);
|
||||
method public android.app.PictureInPictureArgs.Builder setAspectRatio(android.util.Rational);
|
||||
method public android.app.PictureInPictureArgs.Builder setSourceRectHint(android.graphics.Rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.admin {
|
||||
|
||||
public class DevicePolicyManager {
|
||||
method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle);
|
||||
method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.app.usage {
|
||||
|
||||
public final class StorageStats implements android.os.Parcelable {
|
||||
method public deprecated long getCodeBytes();
|
||||
}
|
||||
|
||||
public class StorageStatsManager {
|
||||
method public deprecated long getFreeBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated long getTotalBytes(java.lang.String) throws java.io.IOException;
|
||||
method public deprecated boolean isQuotaSupported(java.lang.String);
|
||||
method public deprecated android.app.usage.ExternalStorageStats queryExternalStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForPackage(java.lang.String, java.lang.String, android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUid(java.lang.String, int) throws java.io.IOException;
|
||||
method public deprecated android.app.usage.StorageStats queryStatsForUser(java.lang.String, android.os.UserHandle) throws java.io.IOException;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content {
|
||||
|
||||
public class ClipData implements android.os.Parcelable {
|
||||
method public deprecated void addItem(android.content.ClipData.Item, android.content.ContentResolver);
|
||||
}
|
||||
|
||||
public abstract class Context {
|
||||
method public abstract android.content.SharedPreferences getSharedPreferences(java.io.File, int);
|
||||
method public abstract java.io.File getSharedPreferencesPath(java.lang.String);
|
||||
}
|
||||
|
||||
public class Intent implements java.lang.Cloneable android.os.Parcelable {
|
||||
field public static final deprecated java.lang.String EXTRA_QUICK_VIEW_ADVANCED = "android.intent.extra.QUICK_VIEW_ADVANCED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.content.pm {
|
||||
|
||||
public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
|
||||
field public deprecated java.lang.String volumeUuid;
|
||||
}
|
||||
|
||||
public class ComponentInfo extends android.content.pm.PackageItemInfo {
|
||||
field public deprecated boolean encryptionAware;
|
||||
}
|
||||
|
||||
public class PackageInfo implements android.os.Parcelable {
|
||||
field public static final int REQUESTED_PERMISSION_REQUIRED = 1; // 0x1
|
||||
}
|
||||
|
||||
public abstract class PackageManager {
|
||||
method public abstract boolean setInstantAppCookie(byte[]);
|
||||
}
|
||||
|
||||
public class ResolveInfo implements android.os.Parcelable {
|
||||
field public deprecated boolean instantAppAvailable;
|
||||
}
|
||||
|
||||
public final class SharedLibraryInfo implements android.os.Parcelable {
|
||||
method public boolean isBuiltin();
|
||||
method public boolean isDynamic();
|
||||
method public boolean isStatic();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.database {
|
||||
|
||||
public abstract class AbstractCursor implements android.database.CrossProcessCursor {
|
||||
field protected java.lang.Long mCurrentRowID;
|
||||
field protected int mRowIdColumnIndex;
|
||||
field protected java.util.HashMap<java.lang.Long, java.util.Map<java.lang.String, java.lang.Object>> mUpdatedRows;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.graphics {
|
||||
|
||||
public deprecated class AvoidXfermode extends android.graphics.Xfermode {
|
||||
ctor public AvoidXfermode(int, int, android.graphics.AvoidXfermode.Mode);
|
||||
}
|
||||
|
||||
public static final class AvoidXfermode.Mode extends java.lang.Enum {
|
||||
method public static android.graphics.AvoidXfermode.Mode valueOf(java.lang.String);
|
||||
method public static final android.graphics.AvoidXfermode.Mode[] values();
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode AVOID;
|
||||
enum_constant public static final android.graphics.AvoidXfermode.Mode TARGET;
|
||||
}
|
||||
|
||||
public class Canvas {
|
||||
method public deprecated boolean clipRegion(android.graphics.Region, android.graphics.Region.Op);
|
||||
method public deprecated boolean clipRegion(android.graphics.Region);
|
||||
}
|
||||
|
||||
public deprecated class LayerRasterizer extends android.graphics.Rasterizer {
|
||||
ctor public LayerRasterizer();
|
||||
method public void addLayer(android.graphics.Paint, float, float);
|
||||
method public void addLayer(android.graphics.Paint);
|
||||
}
|
||||
|
||||
public class Paint {
|
||||
method public deprecated android.graphics.Rasterizer getRasterizer();
|
||||
method public deprecated android.graphics.Rasterizer setRasterizer(android.graphics.Rasterizer);
|
||||
}
|
||||
|
||||
public deprecated class PixelXorXfermode extends android.graphics.Xfermode {
|
||||
ctor public PixelXorXfermode(int);
|
||||
}
|
||||
|
||||
public class Rasterizer {
|
||||
ctor public Rasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.hardware {
|
||||
|
||||
public final class HardwareBuffer implements java.lang.AutoCloseable android.os.Parcelable {
|
||||
method public deprecated void destroy();
|
||||
method public deprecated boolean isDestroyed();
|
||||
}
|
||||
|
||||
public final class SensorDirectChannel implements java.nio.channels.Channel {
|
||||
method public deprecated boolean isValid();
|
||||
}
|
||||
|
||||
public abstract class SensorManager {
|
||||
method public deprecated int configureDirectChannel(android.hardware.SensorDirectChannel, android.hardware.Sensor, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.location {
|
||||
|
||||
public class Location implements android.os.Parcelable {
|
||||
method public deprecated void removeBearingAccuracy();
|
||||
method public deprecated void removeSpeedAccuracy();
|
||||
method public deprecated void removeVerticalAccuracy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media {
|
||||
|
||||
public final class AudioFormat implements android.os.Parcelable {
|
||||
ctor public AudioFormat();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.media.tv {
|
||||
|
||||
public final class TvInputManager {
|
||||
method public android.media.tv.TvInputManager.Hardware acquireTvInputHardware(int, android.media.tv.TvInputManager.HardwareCallback, android.media.tv.TvInputInfo);
|
||||
}
|
||||
|
||||
public class TvView extends android.view.ViewGroup {
|
||||
method public void requestUnblockContent(android.media.tv.TvContentRating);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.net {
|
||||
|
||||
public class ConnectivityManager {
|
||||
method public deprecated boolean requestRouteToHost(int, int);
|
||||
method public deprecated int startUsingNetworkFeature(int, java.lang.String);
|
||||
method public deprecated int stopUsingNetworkFeature(int, java.lang.String);
|
||||
}
|
||||
|
||||
public deprecated class NetworkBadging {
|
||||
method public static android.graphics.drawable.Drawable getWifiIcon(int, int, android.content.res.Resources.Theme);
|
||||
field public static final int BADGING_4K = 30; // 0x1e
|
||||
field public static final int BADGING_HD = 20; // 0x14
|
||||
field public static final int BADGING_NONE = 0; // 0x0
|
||||
field public static final int BADGING_SD = 10; // 0xa
|
||||
}
|
||||
|
||||
public abstract class PskKeyManager {
|
||||
ctor public PskKeyManager();
|
||||
field public static final int MAX_IDENTITY_HINT_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_IDENTITY_LENGTH_BYTES = 128; // 0x80
|
||||
field public static final int MAX_KEY_LENGTH_BYTES = 256; // 0x100
|
||||
}
|
||||
|
||||
public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
|
||||
method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os {
|
||||
|
||||
public class BatteryManager {
|
||||
ctor public BatteryManager();
|
||||
}
|
||||
|
||||
public final class PowerManager {
|
||||
method public void goToSleep(long);
|
||||
method public deprecated void userActivity(long, boolean);
|
||||
method public void wakeUp(long);
|
||||
}
|
||||
|
||||
public class RecoverySystem {
|
||||
ctor public RecoverySystem();
|
||||
}
|
||||
|
||||
public class TestLooperManager {
|
||||
method public deprecated android.os.MessageQueue getQueue();
|
||||
}
|
||||
|
||||
public class UserManager {
|
||||
method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle, android.graphics.Rect, int);
|
||||
method public android.graphics.drawable.Drawable getBadgedIconForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
|
||||
method public java.lang.CharSequence getBadgedLabelForUser(java.lang.CharSequence, android.os.UserHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os.storage {
|
||||
|
||||
public class StorageManager {
|
||||
method public android.os.storage.StorageVolume getPrimaryVolume();
|
||||
method public android.os.storage.StorageVolume[] getVolumeList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.provider {
|
||||
|
||||
public class Browser {
|
||||
method public static final void addSearchUrl(android.content.ContentResolver, java.lang.String);
|
||||
method public static final boolean canClearHistory(android.content.ContentResolver);
|
||||
method public static final void clearHistory(android.content.ContentResolver);
|
||||
method public static final void clearSearches(android.content.ContentResolver);
|
||||
method public static final void deleteFromHistory(android.content.ContentResolver, java.lang.String);
|
||||
method public static final void deleteHistoryTimeFrame(android.content.ContentResolver, long, long);
|
||||
method public static final android.database.Cursor getAllBookmarks(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final android.database.Cursor getAllVisitedUrls(android.content.ContentResolver) throws java.lang.IllegalStateException;
|
||||
method public static final void requestAllIcons(android.content.ContentResolver, java.lang.String, android.webkit.WebIconDatabase.IconListener);
|
||||
method public static final void saveBookmark(android.content.Context, java.lang.String, java.lang.String);
|
||||
method public static final void truncateHistory(android.content.ContentResolver);
|
||||
method public static final void updateVisitedHistory(android.content.ContentResolver, java.lang.String, boolean);
|
||||
field public static final android.net.Uri BOOKMARKS_URI;
|
||||
field public static final java.lang.String[] HISTORY_PROJECTION;
|
||||
field public static final int HISTORY_PROJECTION_BOOKMARK_INDEX = 4; // 0x4
|
||||
field public static final int HISTORY_PROJECTION_DATE_INDEX = 3; // 0x3
|
||||
field public static final int HISTORY_PROJECTION_FAVICON_INDEX = 6; // 0x6
|
||||
field public static final int HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int HISTORY_PROJECTION_TITLE_INDEX = 5; // 0x5
|
||||
field public static final int HISTORY_PROJECTION_URL_INDEX = 1; // 0x1
|
||||
field public static final int HISTORY_PROJECTION_VISITS_INDEX = 2; // 0x2
|
||||
field public static final java.lang.String[] SEARCHES_PROJECTION;
|
||||
field public static final int SEARCHES_PROJECTION_DATE_INDEX = 2; // 0x2
|
||||
field public static final int SEARCHES_PROJECTION_SEARCH_INDEX = 1; // 0x1
|
||||
field public static final android.net.Uri SEARCHES_URI;
|
||||
field public static final java.lang.String[] TRUNCATE_HISTORY_PROJECTION;
|
||||
field public static final int TRUNCATE_HISTORY_PROJECTION_ID_INDEX = 0; // 0x0
|
||||
field public static final int TRUNCATE_N_OLDEST = 5; // 0x5
|
||||
}
|
||||
|
||||
public static class Browser.BookmarkColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.BookmarkColumns();
|
||||
field public static final java.lang.String BOOKMARK = "bookmark";
|
||||
field public static final java.lang.String CREATED = "created";
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String FAVICON = "favicon";
|
||||
field public static final java.lang.String TITLE = "title";
|
||||
field public static final java.lang.String URL = "url";
|
||||
field public static final java.lang.String VISITS = "visits";
|
||||
}
|
||||
|
||||
public static class Browser.SearchColumns implements android.provider.BaseColumns {
|
||||
ctor public Browser.SearchColumns();
|
||||
field public static final java.lang.String DATE = "date";
|
||||
field public static final java.lang.String SEARCH = "search";
|
||||
field public static final deprecated java.lang.String URL = "url";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.Contacts.StreamItems {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.RawContacts.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "stream_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String PHOTO = "photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemPhotosColumns {
|
||||
field public static final deprecated java.lang.String PHOTO_FILE_ID = "photo_file_id";
|
||||
field public static final deprecated java.lang.String PHOTO_URI = "photo_uri";
|
||||
field public static final deprecated java.lang.String SORT_INDEX = "sort_index";
|
||||
field public static final deprecated java.lang.String STREAM_ITEM_ID = "stream_item_id";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_photo_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_photo_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_photo_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_photo_sync4";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_LIMIT_URI;
|
||||
field public static final deprecated android.net.Uri CONTENT_PHOTO_URI;
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item";
|
||||
field public static final deprecated android.net.Uri CONTENT_URI;
|
||||
field public static final deprecated java.lang.String MAX_ITEMS = "max_items";
|
||||
}
|
||||
|
||||
public static final deprecated class ContactsContract.StreamItems.StreamItemPhotos implements android.provider.BaseColumns {
|
||||
field public static final deprecated java.lang.String CONTENT_DIRECTORY = "photo";
|
||||
field public static final deprecated java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/stream_item_photo";
|
||||
field public static final deprecated java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/stream_item_photo";
|
||||
}
|
||||
|
||||
protected static abstract deprecated interface ContactsContract.StreamItemsColumns {
|
||||
field public static final deprecated java.lang.String ACCOUNT_NAME = "account_name";
|
||||
field public static final deprecated java.lang.String ACCOUNT_TYPE = "account_type";
|
||||
field public static final deprecated java.lang.String COMMENTS = "comments";
|
||||
field public static final deprecated java.lang.String CONTACT_ID = "contact_id";
|
||||
field public static final deprecated java.lang.String CONTACT_LOOKUP_KEY = "contact_lookup";
|
||||
field public static final deprecated java.lang.String DATA_SET = "data_set";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_ID = "raw_contact_id";
|
||||
field public static final deprecated java.lang.String RAW_CONTACT_SOURCE_ID = "raw_contact_source_id";
|
||||
field public static final deprecated java.lang.String RES_ICON = "icon";
|
||||
field public static final deprecated java.lang.String RES_LABEL = "label";
|
||||
field public static final deprecated java.lang.String RES_PACKAGE = "res_package";
|
||||
field public static final deprecated java.lang.String SYNC1 = "stream_item_sync1";
|
||||
field public static final deprecated java.lang.String SYNC2 = "stream_item_sync2";
|
||||
field public static final deprecated java.lang.String SYNC3 = "stream_item_sync3";
|
||||
field public static final deprecated java.lang.String SYNC4 = "stream_item_sync4";
|
||||
field public static final deprecated java.lang.String TEXT = "text";
|
||||
field public static final deprecated java.lang.String TIMESTAMP = "timestamp";
|
||||
}
|
||||
|
||||
public static final class Settings.Global extends android.provider.Settings.NameValueTable {
|
||||
field public static final deprecated java.lang.String CONTACT_METADATA_SYNC = "contact_metadata_sync";
|
||||
}
|
||||
|
||||
public static final class Settings.System extends android.provider.Settings.NameValueTable {
|
||||
field public static final java.lang.String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
|
||||
field public static final java.lang.String VOLUME_ALARM = "volume_alarm";
|
||||
field public static final java.lang.String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
|
||||
field public static final java.lang.String VOLUME_MUSIC = "volume_music";
|
||||
field public static final java.lang.String VOLUME_NOTIFICATION = "volume_notification";
|
||||
field public static final java.lang.String VOLUME_RING = "volume_ring";
|
||||
field public static final java.lang.String[] VOLUME_SETTINGS;
|
||||
field public static final java.lang.String VOLUME_SYSTEM = "volume_system";
|
||||
field public static final java.lang.String VOLUME_VOICE = "volume_voice";
|
||||
}
|
||||
|
||||
public static final class Telephony.Sms.Intents {
|
||||
field public static final java.lang.String SMS_EMERGENCY_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.speech.tts {
|
||||
|
||||
public abstract class UtteranceProgressListener {
|
||||
method public deprecated void onUtteranceRangeStart(java.lang.String, int, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.test.mock {
|
||||
|
||||
public deprecated class MockPackageManager extends android.content.pm.PackageManager {
|
||||
method public deprecated java.lang.String getDefaultBrowserPackageName(int);
|
||||
method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.format {
|
||||
|
||||
public class DateFormat {
|
||||
field public static final deprecated char AM_PM = 97; // 0x0061 'a'
|
||||
field public static final deprecated char CAPITAL_AM_PM = 65; // 0x0041 'A'
|
||||
field public static final deprecated char DATE = 100; // 0x0064 'd'
|
||||
field public static final deprecated char DAY = 69; // 0x0045 'E'
|
||||
field public static final deprecated char HOUR = 104; // 0x0068 'h'
|
||||
field public static final deprecated char HOUR_OF_DAY = 107; // 0x006b 'k'
|
||||
field public static final deprecated char MINUTE = 109; // 0x006d 'm'
|
||||
field public static final deprecated char MONTH = 77; // 0x004d 'M'
|
||||
field public static final deprecated char QUOTE = 39; // 0x0027 '\''
|
||||
field public static final deprecated char SECONDS = 115; // 0x0073 's'
|
||||
field public static final deprecated char STANDALONE_MONTH = 76; // 0x004c 'L'
|
||||
field public static final deprecated char TIME_ZONE = 122; // 0x007a 'z'
|
||||
field public static final deprecated char YEAR = 121; // 0x0079 'y'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.text.style {
|
||||
|
||||
public class RasterizerSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance {
|
||||
ctor public RasterizerSpan(android.graphics.Rasterizer);
|
||||
method public android.graphics.Rasterizer getRasterizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.util {
|
||||
|
||||
public deprecated class FloatMath {
|
||||
method public static float ceil(float);
|
||||
method public static float cos(float);
|
||||
method public static float exp(float);
|
||||
method public static float floor(float);
|
||||
method public static float hypot(float, float);
|
||||
method public static float pow(float, float);
|
||||
method public static float sin(float);
|
||||
method public static float sqrt(float);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view {
|
||||
|
||||
public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
|
||||
method protected void initializeFadingEdge(android.content.res.TypedArray);
|
||||
method protected void initializeScrollbars(android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
public class ViewConfiguration {
|
||||
method public int getScaledScrollFactor();
|
||||
}
|
||||
|
||||
public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
|
||||
field public static final int TYPE_KEYGUARD = 2004; // 0x7d4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.view.accessibility {
|
||||
|
||||
public final class AccessibilityWindowInfo implements android.os.Parcelable {
|
||||
method public boolean inPictureInPicture();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.webkit {
|
||||
|
||||
public class WebViewClient {
|
||||
method public void onUnhandledInputEvent(android.webkit.WebView, android.view.InputEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.widget {
|
||||
|
||||
public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
|
||||
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
|
||||
method public static android.content.res.ColorStateList getTextColors(android.content.Context, android.content.res.TypedArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright 2008 The Android Open Source Project
|
||||
#
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := \
|
||||
$(call all-java-files-under, src) \
|
||||
$(call all-proto-files-under, proto)
|
||||
LOCAL_MODULE := am
|
||||
LOCAL_PROTOC_OPTIMIZE_TYPE := stream
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := am
|
||||
LOCAL_SRC_FILES := am
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := \
|
||||
$(call all-proto-files-under, proto)
|
||||
LOCAL_MODULE := libinstrumentation
|
||||
LOCAL_PROTOC_OPTIMIZE_TYPE := full
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
||||
$(call intermediates-dir-for,STATIC_LIBRARIES,libinstrumentation,HOST,,,)/proto/$(LOCAL_PATH)/proto
|
||||
include $(BUILD_HOST_STATIC_LIBRARY)
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
Copyright (c) 2005-2008, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/system/bin/sh
|
||||
|
||||
if [ "$1" != "instrument" ] ; then
|
||||
cmd activity "$@"
|
||||
else
|
||||
base=/system
|
||||
export CLASSPATH=$base/framework/am.jar
|
||||
exec app_process $base/bin com.android.commands.am.Am "$@"
|
||||
fi
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
syntax = "proto2";
|
||||
package android.am;
|
||||
|
||||
option java_package = "com.android.commands.am";
|
||||
|
||||
message ResultsBundleEntry {
|
||||
optional string key = 1;
|
||||
|
||||
optional string value_string = 2;
|
||||
optional sint32 value_int = 3;
|
||||
optional float value_float = 4;
|
||||
optional double value_double = 5;
|
||||
optional sint64 value_long = 6;
|
||||
optional ResultsBundle value_bundle = 7;
|
||||
}
|
||||
|
||||
message ResultsBundle {
|
||||
repeated ResultsBundleEntry entries = 1;
|
||||
}
|
||||
|
||||
message TestStatus {
|
||||
optional sint32 result_code = 3;
|
||||
optional ResultsBundle results = 4;
|
||||
}
|
||||
|
||||
enum SessionStatusCode {
|
||||
/**
|
||||
* The command ran successfully. This does not imply that the tests passed.
|
||||
*/
|
||||
SESSION_FINISHED = 0;
|
||||
|
||||
/**
|
||||
* There was an unrecoverable error running the tests.
|
||||
*/
|
||||
SESSION_ABORTED = 1;
|
||||
}
|
||||
|
||||
message SessionStatus {
|
||||
optional SessionStatusCode status_code = 1;
|
||||
optional string error_text = 2;
|
||||
optional sint32 result_code = 3;
|
||||
optional ResultsBundle results = 4;
|
||||
}
|
||||
|
||||
message Session {
|
||||
repeated TestStatus test_status = 1;
|
||||
optional SessionStatus session_status = 2;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (C) 2007 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 com.android.commands.am;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.IActivityManager;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ResultReceiver;
|
||||
import android.os.SELinux;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.ShellCallback;
|
||||
import android.os.UserHandle;
|
||||
import android.util.AndroidException;
|
||||
|
||||
import com.android.internal.os.BaseCommand;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class Am extends BaseCommand {
|
||||
|
||||
private IActivityManager mAm;
|
||||
private IPackageManager mPm;
|
||||
|
||||
/**
|
||||
* Command-line entry point.
|
||||
*
|
||||
* @param args The command-line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
(new Am()).run(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowUsage(PrintStream out) {
|
||||
try {
|
||||
runAmCmd(new String[] { "help" });
|
||||
} catch (AndroidException e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRun() throws Exception {
|
||||
|
||||
mAm = ActivityManager.getService();
|
||||
if (mAm == null) {
|
||||
System.err.println(NO_SYSTEM_ERROR_CODE);
|
||||
throw new AndroidException("Can't connect to activity manager; is the system running?");
|
||||
}
|
||||
|
||||
mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
|
||||
if (mPm == null) {
|
||||
System.err.println(NO_SYSTEM_ERROR_CODE);
|
||||
throw new AndroidException("Can't connect to package manager; is the system running?");
|
||||
}
|
||||
|
||||
String op = nextArgRequired();
|
||||
|
||||
if (op.equals("instrument")) {
|
||||
runInstrument();
|
||||
} else {
|
||||
runAmCmd(getRawArgs());
|
||||
}
|
||||
}
|
||||
|
||||
int parseUserArg(String arg) {
|
||||
int userId;
|
||||
if ("all".equals(arg)) {
|
||||
userId = UserHandle.USER_ALL;
|
||||
} else if ("current".equals(arg) || "cur".equals(arg)) {
|
||||
userId = UserHandle.USER_CURRENT;
|
||||
} else {
|
||||
userId = Integer.parseInt(arg);
|
||||
}
|
||||
return userId;
|
||||
}
|
||||
|
||||
static final class MyShellCallback extends ShellCallback {
|
||||
boolean mActive = true;
|
||||
|
||||
@Override public ParcelFileDescriptor onOpenOutputFile(String path, String seLinuxContext) {
|
||||
if (!mActive) {
|
||||
System.err.println("Open attempt after active for: " + path);
|
||||
return null;
|
||||
}
|
||||
File file = new File(path);
|
||||
//System.err.println("Opening file: " + file.getAbsolutePath());
|
||||
//Log.i("Am", "Opening file: " + file.getAbsolutePath());
|
||||
final ParcelFileDescriptor fd;
|
||||
try {
|
||||
fd = ParcelFileDescriptor.open(file,
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_TRUNCATE |
|
||||
ParcelFileDescriptor.MODE_WRITE_ONLY);
|
||||
} catch (FileNotFoundException e) {
|
||||
String msg = "Unable to open file " + path + ": " + e;
|
||||
System.err.println(msg);
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
if (seLinuxContext != null) {
|
||||
final String tcon = SELinux.getFileContext(file.getAbsolutePath());
|
||||
if (!SELinux.checkSELinuxAccess(seLinuxContext, tcon, "file", "write")) {
|
||||
try {
|
||||
fd.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
String msg = "System server has no access to file context " + tcon;
|
||||
System.err.println(msg + " (from path " + file.getAbsolutePath()
|
||||
+ ", context " + seLinuxContext + ")");
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
||||
void runAmCmd(String[] args) throws AndroidException {
|
||||
final MyShellCallback cb = new MyShellCallback();
|
||||
try {
|
||||
mAm.asBinder().shellCommand(FileDescriptor.in, FileDescriptor.out, FileDescriptor.err,
|
||||
args, cb, new ResultReceiver(null) { });
|
||||
} catch (RemoteException e) {
|
||||
System.err.println(NO_SYSTEM_ERROR_CODE);
|
||||
throw new AndroidException("Can't call activity manager; is the system running?");
|
||||
} finally {
|
||||
cb.mActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void runInstrument() throws Exception {
|
||||
Instrument instrument = new Instrument(mAm, mPm);
|
||||
|
||||
String opt;
|
||||
while ((opt=nextOption()) != null) {
|
||||
if (opt.equals("-p")) {
|
||||
instrument.profileFile = nextArgRequired();
|
||||
} else if (opt.equals("-w")) {
|
||||
instrument.wait = true;
|
||||
} else if (opt.equals("-r")) {
|
||||
instrument.rawMode = true;
|
||||
} else if (opt.equals("-m")) {
|
||||
instrument.proto = true;
|
||||
} else if (opt.equals("-e")) {
|
||||
final String argKey = nextArgRequired();
|
||||
final String argValue = nextArgRequired();
|
||||
instrument.args.putString(argKey, argValue);
|
||||
} else if (opt.equals("--no_window_animation")
|
||||
|| opt.equals("--no-window-animation")) {
|
||||
instrument.noWindowAnimation = true;
|
||||
} else if (opt.equals("--user")) {
|
||||
instrument.userId = parseUserArg(nextArgRequired());
|
||||
} else if (opt.equals("--abi")) {
|
||||
instrument.abi = nextArgRequired();
|
||||
} else {
|
||||
System.err.println("Error: Unknown option: " + opt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (instrument.userId == UserHandle.USER_ALL) {
|
||||
System.err.println("Error: Can't start instrumentation with user 'all'");
|
||||
return;
|
||||
}
|
||||
|
||||
instrument.componentNameArg = nextArgRequired();
|
||||
|
||||
instrument.run();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,447 @@
|
|||
/*
|
||||
* Copyright (C) 2007 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 com.android.commands.am;
|
||||
|
||||
import android.app.IActivityManager;
|
||||
import android.app.IInstrumentationWatcher;
|
||||
import android.app.Instrumentation;
|
||||
import android.app.UiAutomationConnection;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.InstrumentationInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.util.AndroidException;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
import android.view.IWindowManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Runs the am instrument command
|
||||
*/
|
||||
public class Instrument {
|
||||
private final IActivityManager mAm;
|
||||
private final IPackageManager mPm;
|
||||
private final IWindowManager mWm;
|
||||
|
||||
// Command line arguments
|
||||
public String profileFile = null;
|
||||
public boolean wait = false;
|
||||
public boolean rawMode = false;
|
||||
public boolean proto = false;
|
||||
public boolean noWindowAnimation = false;
|
||||
public String abi = null;
|
||||
public int userId = UserHandle.USER_CURRENT;
|
||||
public Bundle args = new Bundle();
|
||||
// Required
|
||||
public String componentNameArg;
|
||||
|
||||
/**
|
||||
* Construct the instrument command runner.
|
||||
*/
|
||||
public Instrument(IActivityManager am, IPackageManager pm) {
|
||||
mAm = am;
|
||||
mPm = pm;
|
||||
mWm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for status reporting.
|
||||
*
|
||||
* All the methods on this interface are called within the synchronized block
|
||||
* of the InstrumentationWatcher, so calls are in order. However, that means
|
||||
* you must be careful not to do blocking operations because you don't know
|
||||
* exactly the locking dependencies.
|
||||
*/
|
||||
private interface StatusReporter {
|
||||
/**
|
||||
* Status update for tests.
|
||||
*/
|
||||
public void onInstrumentationStatusLocked(ComponentName name, int resultCode,
|
||||
Bundle results);
|
||||
|
||||
/**
|
||||
* The tests finished.
|
||||
*/
|
||||
public void onInstrumentationFinishedLocked(ComponentName name, int resultCode,
|
||||
Bundle results);
|
||||
|
||||
/**
|
||||
* @param errorText a description of the error
|
||||
* @param commandError True if the error is related to the commandline, as opposed
|
||||
* to a test failing.
|
||||
*/
|
||||
public void onError(String errorText, boolean commandError);
|
||||
}
|
||||
|
||||
private static Collection<String> sorted(Collection<String> list) {
|
||||
final ArrayList<String> copy = new ArrayList<>(list);
|
||||
Collections.sort(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Printer for the 'classic' text based status reporting.
|
||||
*/
|
||||
private class TextStatusReporter implements StatusReporter {
|
||||
private boolean mRawMode;
|
||||
|
||||
/**
|
||||
* Human-ish readable output.
|
||||
*
|
||||
* @param rawMode In "raw mode" (true), all bundles are dumped.
|
||||
* In "pretty mode" (false), if a bundle includes
|
||||
* Instrumentation.REPORT_KEY_STREAMRESULT, just print that.
|
||||
*/
|
||||
public TextStatusReporter(boolean rawMode) {
|
||||
mRawMode = rawMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInstrumentationStatusLocked(ComponentName name, int resultCode,
|
||||
Bundle results) {
|
||||
// pretty printer mode?
|
||||
String pretty = null;
|
||||
if (!mRawMode && results != null) {
|
||||
pretty = results.getString(Instrumentation.REPORT_KEY_STREAMRESULT);
|
||||
}
|
||||
if (pretty != null) {
|
||||
System.out.print(pretty);
|
||||
} else {
|
||||
if (results != null) {
|
||||
for (String key : sorted(results.keySet())) {
|
||||
System.out.println(
|
||||
"INSTRUMENTATION_STATUS: " + key + "=" + results.get(key));
|
||||
}
|
||||
}
|
||||
System.out.println("INSTRUMENTATION_STATUS_CODE: " + resultCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInstrumentationFinishedLocked(ComponentName name, int resultCode,
|
||||
Bundle results) {
|
||||
// pretty printer mode?
|
||||
String pretty = null;
|
||||
if (!mRawMode && results != null) {
|
||||
pretty = results.getString(Instrumentation.REPORT_KEY_STREAMRESULT);
|
||||
}
|
||||
if (pretty != null) {
|
||||
System.out.println(pretty);
|
||||
} else {
|
||||
if (results != null) {
|
||||
for (String key : sorted(results.keySet())) {
|
||||
System.out.println(
|
||||
"INSTRUMENTATION_RESULT: " + key + "=" + results.get(key));
|
||||
}
|
||||
}
|
||||
System.out.println("INSTRUMENTATION_CODE: " + resultCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String errorText, boolean commandError) {
|
||||
if (mRawMode) {
|
||||
System.out.println("onError: commandError=" + commandError + " message="
|
||||
+ errorText);
|
||||
}
|
||||
// The regular BaseCommand error printing will print the commandErrors.
|
||||
if (!commandError) {
|
||||
System.out.println(errorText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Printer for the protobuf based status reporting.
|
||||
*/
|
||||
private class ProtoStatusReporter implements StatusReporter {
|
||||
@Override
|
||||
public void onInstrumentationStatusLocked(ComponentName name, int resultCode,
|
||||
Bundle results) {
|
||||
final ProtoOutputStream proto = new ProtoOutputStream();
|
||||
|
||||
final long token = proto.startRepeatedObject(InstrumentationData.Session.TEST_STATUS);
|
||||
|
||||
proto.writeSInt32(InstrumentationData.TestStatus.RESULT_CODE, resultCode);
|
||||
writeBundle(proto, InstrumentationData.TestStatus.RESULTS, results);
|
||||
|
||||
proto.endRepeatedObject(token);
|
||||
writeProtoToStdout(proto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInstrumentationFinishedLocked(ComponentName name, int resultCode,
|
||||
Bundle results) {
|
||||
final ProtoOutputStream proto = new ProtoOutputStream();
|
||||
|
||||
final long token = proto.startObject(InstrumentationData.Session.SESSION_STATUS);
|
||||
|
||||
proto.writeEnum(InstrumentationData.SessionStatus.STATUS_CODE,
|
||||
InstrumentationData.SESSION_FINISHED);
|
||||
proto.writeSInt32(InstrumentationData.SessionStatus.RESULT_CODE, resultCode);
|
||||
writeBundle(proto, InstrumentationData.SessionStatus.RESULTS, results);
|
||||
|
||||
proto.endObject(token);
|
||||
writeProtoToStdout(proto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String errorText, boolean commandError) {
|
||||
final ProtoOutputStream proto = new ProtoOutputStream();
|
||||
|
||||
final long token = proto.startObject(InstrumentationData.Session.SESSION_STATUS);
|
||||
|
||||
proto.writeEnum(InstrumentationData.SessionStatus.STATUS_CODE,
|
||||
InstrumentationData.SESSION_ABORTED);
|
||||
proto.writeString(InstrumentationData.SessionStatus.ERROR_TEXT, errorText);
|
||||
|
||||
proto.endObject(token);
|
||||
writeProtoToStdout(proto);
|
||||
}
|
||||
|
||||
private void writeBundle(ProtoOutputStream proto, long fieldId, Bundle bundle) {
|
||||
final long bundleToken = proto.startObject(fieldId);
|
||||
|
||||
for (final String key: sorted(bundle.keySet())) {
|
||||
final long entryToken = proto.startRepeatedObject(
|
||||
InstrumentationData.ResultsBundle.ENTRIES);
|
||||
|
||||
proto.writeString(InstrumentationData.ResultsBundleEntry.KEY, key);
|
||||
|
||||
final Object val = bundle.get(key);
|
||||
if (val instanceof String) {
|
||||
proto.writeString(InstrumentationData.ResultsBundleEntry.VALUE_STRING,
|
||||
(String)val);
|
||||
} else if (val instanceof Byte) {
|
||||
proto.writeSInt32(InstrumentationData.ResultsBundleEntry.VALUE_INT,
|
||||
((Byte)val).intValue());
|
||||
} else if (val instanceof Double) {
|
||||
proto.writeDouble(InstrumentationData.ResultsBundleEntry.VALUE_DOUBLE,
|
||||
((Double)val).doubleValue());
|
||||
} else if (val instanceof Float) {
|
||||
proto.writeFloat(InstrumentationData.ResultsBundleEntry.VALUE_FLOAT,
|
||||
((Float)val).floatValue());
|
||||
} else if (val instanceof Integer) {
|
||||
proto.writeSInt32(InstrumentationData.ResultsBundleEntry.VALUE_INT,
|
||||
((Integer)val).intValue());
|
||||
} else if (val instanceof Long) {
|
||||
proto.writeSInt64(InstrumentationData.ResultsBundleEntry.VALUE_LONG,
|
||||
((Long)val).longValue());
|
||||
} else if (val instanceof Short) {
|
||||
proto.writeSInt32(InstrumentationData.ResultsBundleEntry.VALUE_INT,
|
||||
((Short)val).intValue());
|
||||
} else if (val instanceof Bundle) {
|
||||
writeBundle(proto, InstrumentationData.ResultsBundleEntry.VALUE_BUNDLE,
|
||||
(Bundle)val);
|
||||
}
|
||||
|
||||
proto.endRepeatedObject(entryToken);
|
||||
}
|
||||
|
||||
proto.endObject(bundleToken);
|
||||
}
|
||||
|
||||
private void writeProtoToStdout(ProtoOutputStream proto) {
|
||||
try {
|
||||
System.out.write(proto.getBytes());
|
||||
System.out.flush();
|
||||
} catch (IOException ex) {
|
||||
System.err.println("Error writing finished response: ");
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callbacks from the remote instrumentation instance.
|
||||
*/
|
||||
private class InstrumentationWatcher extends IInstrumentationWatcher.Stub {
|
||||
private final StatusReporter mReporter;
|
||||
|
||||
private boolean mFinished = false;
|
||||
|
||||
public InstrumentationWatcher(StatusReporter reporter) {
|
||||
mReporter = reporter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instrumentationStatus(ComponentName name, int resultCode, Bundle results) {
|
||||
synchronized (this) {
|
||||
mReporter.onInstrumentationStatusLocked(name, resultCode, results);
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instrumentationFinished(ComponentName name, int resultCode, Bundle results) {
|
||||
synchronized (this) {
|
||||
mReporter.onInstrumentationFinishedLocked(name, resultCode, results);
|
||||
mFinished = true;
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean waitForFinish() {
|
||||
synchronized (this) {
|
||||
while (!mFinished) {
|
||||
try {
|
||||
if (!mAm.asBinder().pingBinder()) {
|
||||
return false;
|
||||
}
|
||||
wait(1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out which component they really meant.
|
||||
*/
|
||||
private ComponentName parseComponentName(String cnArg) throws Exception {
|
||||
if (cnArg.contains("/")) {
|
||||
ComponentName cn = ComponentName.unflattenFromString(cnArg);
|
||||
if (cn == null) throw new IllegalArgumentException("Bad component name: " + cnArg);
|
||||
return cn;
|
||||
} else {
|
||||
List<InstrumentationInfo> infos = mPm.queryInstrumentation(null, 0).getList();
|
||||
|
||||
final int numInfos = infos == null ? 0: infos.size();
|
||||
ArrayList<ComponentName> cns = new ArrayList<>();
|
||||
for (int i = 0; i < numInfos; i++) {
|
||||
InstrumentationInfo info = infos.get(i);
|
||||
|
||||
ComponentName c = new ComponentName(info.packageName, info.name);
|
||||
if (cnArg.equals(info.packageName)) {
|
||||
cns.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (cns.size() == 0) {
|
||||
throw new IllegalArgumentException("No instrumentation found for: " + cnArg);
|
||||
} else if (cns.size() == 1) {
|
||||
return cns.get(0);
|
||||
} else {
|
||||
StringBuilder cnsStr = new StringBuilder();
|
||||
final int numCns = cns.size();
|
||||
for (int i = 0; i < numCns; i++) {
|
||||
cnsStr.append(cns.get(i).flattenToString());
|
||||
cnsStr.append(", ");
|
||||
}
|
||||
|
||||
// Remove last ", "
|
||||
cnsStr.setLength(cnsStr.length() - 2);
|
||||
|
||||
throw new IllegalArgumentException("Found multiple instrumentations: "
|
||||
+ cnsStr.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the instrumentation.
|
||||
*/
|
||||
public void run() throws Exception {
|
||||
StatusReporter reporter = null;
|
||||
float[] oldAnims = null;
|
||||
|
||||
try {
|
||||
// Choose which output we will do.
|
||||
if (proto) {
|
||||
reporter = new ProtoStatusReporter();
|
||||
} else if (wait) {
|
||||
reporter = new TextStatusReporter(rawMode);
|
||||
}
|
||||
|
||||
// Choose whether we have to wait for the results.
|
||||
InstrumentationWatcher watcher = null;
|
||||
UiAutomationConnection connection = null;
|
||||
if (reporter != null) {
|
||||
watcher = new InstrumentationWatcher(reporter);
|
||||
connection = new UiAutomationConnection();
|
||||
}
|
||||
|
||||
// Set the window animation if necessary
|
||||
if (noWindowAnimation) {
|
||||
oldAnims = mWm.getAnimationScales();
|
||||
mWm.setAnimationScale(0, 0.0f);
|
||||
mWm.setAnimationScale(1, 0.0f);
|
||||
mWm.setAnimationScale(2, 0.0f);
|
||||
}
|
||||
|
||||
// Figure out which component we are tring to do.
|
||||
final ComponentName cn = parseComponentName(componentNameArg);
|
||||
|
||||
// Choose an ABI if necessary
|
||||
if (abi != null) {
|
||||
final String[] supportedAbis = Build.SUPPORTED_ABIS;
|
||||
boolean matched = false;
|
||||
for (String supportedAbi : supportedAbis) {
|
||||
if (supportedAbi.equals(abi)) {
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
throw new AndroidException(
|
||||
"INSTRUMENTATION_FAILED: Unsupported instruction set " + abi);
|
||||
}
|
||||
}
|
||||
|
||||
// Start the instrumentation
|
||||
if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, connection, userId,
|
||||
abi)) {
|
||||
throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString());
|
||||
}
|
||||
|
||||
// If we have been requested to wait, do so until the instrumentation is finished.
|
||||
if (watcher != null) {
|
||||
if (!watcher.waitForFinish()) {
|
||||
reporter.onError("INSTRUMENTATION_ABORTED: System has crashed.", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// Report failures
|
||||
if (reporter != null) {
|
||||
reporter.onError(ex.getMessage(), true);
|
||||
}
|
||||
|
||||
// And re-throw the exception
|
||||
throw ex;
|
||||
} finally {
|
||||
// Clean up
|
||||
if (oldAnims != null) {
|
||||
mWm.setAnimationScales(oldAnims);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
app_process_common_shared_libs := \
|
||||
libandroid_runtime \
|
||||
libbinder \
|
||||
libcutils \
|
||||
libdl \
|
||||
libhwbinder \
|
||||
liblog \
|
||||
libnativeloader \
|
||||
libutils \
|
||||
|
||||
# This is a list of libraries that need to be included in order to avoid
|
||||
# bad apps. This prevents a library from having a mismatch when resolving
|
||||
# new/delete from an app shared library.
|
||||
# See b/21032018 for more details.
|
||||
app_process_common_shared_libs += \
|
||||
libwilhelm \
|
||||
|
||||
app_process_common_static_libs := \
|
||||
libsigchain \
|
||||
|
||||
app_process_src_files := \
|
||||
app_main.cpp \
|
||||
|
||||
app_process_cflags := \
|
||||
-Wall -Werror -Wunused -Wunreachable-code
|
||||
|
||||
app_process_ldflags_32 := \
|
||||
-Wl,--version-script,art/sigchainlib/version-script32.txt -Wl,--export-dynamic
|
||||
app_process_ldflags_64 := \
|
||||
-Wl,--version-script,art/sigchainlib/version-script64.txt -Wl,--export-dynamic
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= $(app_process_src_files)
|
||||
|
||||
LOCAL_LDFLAGS_32 := $(app_process_ldflags_32)
|
||||
LOCAL_LDFLAGS_64 := $(app_process_ldflags_64)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := $(app_process_common_shared_libs)
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(app_process_common_static_libs)
|
||||
|
||||
LOCAL_MODULE:= app_process
|
||||
LOCAL_MULTILIB := both
|
||||
LOCAL_MODULE_STEM_32 := app_process32
|
||||
LOCAL_MODULE_STEM_64 := app_process64
|
||||
|
||||
LOCAL_CFLAGS += $(app_process_cflags)
|
||||
|
||||
# In SANITIZE_LITE mode, we create the sanitized binary in a separate location (but reuse
|
||||
# the same module). Using the same module also works around an issue with make: binaries
|
||||
# that depend on sanitized libraries will be relinked, even if they set LOCAL_SANITIZE := never.
|
||||
#
|
||||
# Also pull in the asanwrapper helper.
|
||||
ifeq ($(SANITIZE_LITE),true)
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan
|
||||
LOCAL_REQUIRED_MODULES := asanwrapper
|
||||
endif
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# Create a symlink from app_process to app_process32 or 64
|
||||
# depending on the target configuration.
|
||||
ifneq ($(SANITIZE_LITE),true)
|
||||
include $(BUILD_SYSTEM)/executable_prefer_symlink.mk
|
||||
endif
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
Copyright (c) 2005-2008, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,358 @@
|
|||
/*
|
||||
* Main entry of app process.
|
||||
*
|
||||
* Starts the interpreted runtime, then starts up the application.
|
||||
*
|
||||
*/
|
||||
|
||||
#define LOG_TAG "appproc"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
#include <utils/Log.h>
|
||||
#include <cutils/memory.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <cutils/trace.h>
|
||||
#include <android_runtime/AndroidRuntime.h>
|
||||
#include <private/android_filesystem_config.h> // for AID_SYSTEM
|
||||
|
||||
namespace android {
|
||||
|
||||
static void app_usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: app_process [java-options] cmd-dir start-class-name [options]\n");
|
||||
}
|
||||
|
||||
class AppRuntime : public AndroidRuntime
|
||||
{
|
||||
public:
|
||||
AppRuntime(char* argBlockStart, const size_t argBlockLength)
|
||||
: AndroidRuntime(argBlockStart, argBlockLength)
|
||||
, mClass(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void setClassNameAndArgs(const String8& className, int argc, char * const *argv) {
|
||||
mClassName = className;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
mArgs.add(String8(argv[i]));
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onVmCreated(JNIEnv* env)
|
||||
{
|
||||
if (mClassName.isEmpty()) {
|
||||
return; // Zygote. Nothing to do here.
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a little awkward because the JNI FindClass call uses the
|
||||
* class loader associated with the native method we're executing in.
|
||||
* If called in onStarted (from RuntimeInit.finishInit because we're
|
||||
* launching "am", for example), FindClass would see that we're calling
|
||||
* from a boot class' native method, and so wouldn't look for the class
|
||||
* we're trying to look up in CLASSPATH. Unfortunately it needs to,
|
||||
* because the "am" classes are not boot classes.
|
||||
*
|
||||
* The easiest fix is to call FindClass here, early on before we start
|
||||
* executing boot class Java code and thereby deny ourselves access to
|
||||
* non-boot classes.
|
||||
*/
|
||||
char* slashClassName = toSlashClassName(mClassName.string());
|
||||
mClass = env->FindClass(slashClassName);
|
||||
if (mClass == NULL) {
|
||||
ALOGE("ERROR: could not find class '%s'\n", mClassName.string());
|
||||
}
|
||||
free(slashClassName);
|
||||
|
||||
mClass = reinterpret_cast<jclass>(env->NewGlobalRef(mClass));
|
||||
}
|
||||
|
||||
virtual void onStarted()
|
||||
{
|
||||
sp<ProcessState> proc = ProcessState::self();
|
||||
ALOGV("App process: starting thread pool.\n");
|
||||
proc->startThreadPool();
|
||||
|
||||
AndroidRuntime* ar = AndroidRuntime::getRuntime();
|
||||
ar->callMain(mClassName, mClass, mArgs);
|
||||
|
||||
IPCThreadState::self()->stopProcess();
|
||||
hardware::IPCThreadState::self()->stopProcess();
|
||||
}
|
||||
|
||||
virtual void onZygoteInit()
|
||||
{
|
||||
sp<ProcessState> proc = ProcessState::self();
|
||||
ALOGV("App process: starting thread pool.\n");
|
||||
proc->startThreadPool();
|
||||
}
|
||||
|
||||
virtual void onExit(int code)
|
||||
{
|
||||
if (mClassName.isEmpty()) {
|
||||
// if zygote
|
||||
IPCThreadState::self()->stopProcess();
|
||||
hardware::IPCThreadState::self()->stopProcess();
|
||||
}
|
||||
|
||||
AndroidRuntime::onExit(code);
|
||||
}
|
||||
|
||||
|
||||
String8 mClassName;
|
||||
Vector<String8> mArgs;
|
||||
jclass mClass;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using namespace android;
|
||||
|
||||
static size_t computeArgBlockSize(int argc, char* const argv[]) {
|
||||
// TODO: This assumes that all arguments are allocated in
|
||||
// contiguous memory. There isn't any documented guarantee
|
||||
// that this is the case, but this is how the kernel does it
|
||||
// (see fs/exec.c).
|
||||
//
|
||||
// Also note that this is a constant for "normal" android apps.
|
||||
// Since they're forked from zygote, the size of their command line
|
||||
// is the size of the zygote command line.
|
||||
//
|
||||
// We change the process name of the process by over-writing
|
||||
// the start of the argument block (argv[0]) with the new name of
|
||||
// the process, so we'd mysteriously start getting truncated process
|
||||
// names if the zygote command line decreases in size.
|
||||
uintptr_t start = reinterpret_cast<uintptr_t>(argv[0]);
|
||||
uintptr_t end = reinterpret_cast<uintptr_t>(argv[argc - 1]);
|
||||
end += strlen(argv[argc - 1]) + 1;
|
||||
return (end - start);
|
||||
}
|
||||
|
||||
static void maybeCreateDalvikCache() {
|
||||
#if defined(__aarch64__)
|
||||
static const char kInstructionSet[] = "arm64";
|
||||
#elif defined(__x86_64__)
|
||||
static const char kInstructionSet[] = "x86_64";
|
||||
#elif defined(__arm__)
|
||||
static const char kInstructionSet[] = "arm";
|
||||
#elif defined(__i386__)
|
||||
static const char kInstructionSet[] = "x86";
|
||||
#elif defined (__mips__) && !defined(__LP64__)
|
||||
static const char kInstructionSet[] = "mips";
|
||||
#elif defined (__mips__) && defined(__LP64__)
|
||||
static const char kInstructionSet[] = "mips64";
|
||||
#else
|
||||
#error "Unknown instruction set"
|
||||
#endif
|
||||
const char* androidRoot = getenv("ANDROID_DATA");
|
||||
LOG_ALWAYS_FATAL_IF(androidRoot == NULL, "ANDROID_DATA environment variable unset");
|
||||
|
||||
char dalvikCacheDir[PATH_MAX];
|
||||
const int numChars = snprintf(dalvikCacheDir, PATH_MAX,
|
||||
"%s/dalvik-cache/%s", androidRoot, kInstructionSet);
|
||||
LOG_ALWAYS_FATAL_IF((numChars >= PATH_MAX || numChars < 0),
|
||||
"Error constructing dalvik cache : %s", strerror(errno));
|
||||
|
||||
int result = mkdir(dalvikCacheDir, 0711);
|
||||
LOG_ALWAYS_FATAL_IF((result < 0 && errno != EEXIST),
|
||||
"Error creating cache dir %s : %s", dalvikCacheDir, strerror(errno));
|
||||
|
||||
// We always perform these steps because the directory might
|
||||
// already exist, with wider permissions and a different owner
|
||||
// than we'd like.
|
||||
result = chown(dalvikCacheDir, AID_ROOT, AID_ROOT);
|
||||
LOG_ALWAYS_FATAL_IF((result < 0), "Error changing dalvik-cache ownership : %s", strerror(errno));
|
||||
|
||||
result = chmod(dalvikCacheDir, 0711);
|
||||
LOG_ALWAYS_FATAL_IF((result < 0),
|
||||
"Error changing dalvik-cache permissions : %s", strerror(errno));
|
||||
}
|
||||
|
||||
#if defined(__LP64__)
|
||||
static const char ABI_LIST_PROPERTY[] = "ro.product.cpu.abilist64";
|
||||
static const char ZYGOTE_NICE_NAME[] = "zygote64";
|
||||
#else
|
||||
static const char ABI_LIST_PROPERTY[] = "ro.product.cpu.abilist32";
|
||||
static const char ZYGOTE_NICE_NAME[] = "zygote";
|
||||
#endif
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
{
|
||||
if (!LOG_NDEBUG) {
|
||||
String8 argv_String;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
argv_String.append("\"");
|
||||
argv_String.append(argv[i]);
|
||||
argv_String.append("\" ");
|
||||
}
|
||||
ALOGV("app_process main with argv: %s", argv_String.string());
|
||||
}
|
||||
|
||||
AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv));
|
||||
// Process command line arguments
|
||||
// ignore argv[0]
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
// Everything up to '--' or first non '-' arg goes to the vm.
|
||||
//
|
||||
// The first argument after the VM args is the "parent dir", which
|
||||
// is currently unused.
|
||||
//
|
||||
// After the parent dir, we expect one or more the following internal
|
||||
// arguments :
|
||||
//
|
||||
// --zygote : Start in zygote mode
|
||||
// --start-system-server : Start the system server.
|
||||
// --application : Start in application (stand alone, non zygote) mode.
|
||||
// --nice-name : The nice name for this process.
|
||||
//
|
||||
// For non zygote starts, these arguments will be followed by
|
||||
// the main class name. All remaining arguments are passed to
|
||||
// the main method of this class.
|
||||
//
|
||||
// For zygote starts, all remaining arguments are passed to the zygote.
|
||||
// main function.
|
||||
//
|
||||
// Note that we must copy argument string values since we will rewrite the
|
||||
// entire argument block when we apply the nice name to argv0.
|
||||
//
|
||||
// As an exception to the above rule, anything in "spaced commands"
|
||||
// goes to the vm even though it has a space in it.
|
||||
const char* spaced_commands[] = { "-cp", "-classpath" };
|
||||
// Allow "spaced commands" to be succeeded by exactly 1 argument (regardless of -s).
|
||||
bool known_command = false;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (known_command == true) {
|
||||
runtime.addOption(strdup(argv[i]));
|
||||
// The static analyzer gets upset that we don't ever free the above
|
||||
// string. Since the allocation is from main, leaking it doesn't seem
|
||||
// problematic. NOLINTNEXTLINE
|
||||
ALOGV("app_process main add known option '%s'", argv[i]);
|
||||
known_command = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 0;
|
||||
j < static_cast<int>(sizeof(spaced_commands) / sizeof(spaced_commands[0]));
|
||||
++j) {
|
||||
if (strcmp(argv[i], spaced_commands[j]) == 0) {
|
||||
known_command = true;
|
||||
ALOGV("app_process main found known command '%s'", argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (argv[i][0] != '-') {
|
||||
break;
|
||||
}
|
||||
if (argv[i][1] == '-' && argv[i][2] == 0) {
|
||||
++i; // Skip --.
|
||||
break;
|
||||
}
|
||||
|
||||
runtime.addOption(strdup(argv[i]));
|
||||
// The static analyzer gets upset that we don't ever free the above
|
||||
// string. Since the allocation is from main, leaking it doesn't seem
|
||||
// problematic. NOLINTNEXTLINE
|
||||
ALOGV("app_process main add option '%s'", argv[i]);
|
||||
}
|
||||
|
||||
// Parse runtime arguments. Stop at first unrecognized option.
|
||||
bool zygote = false;
|
||||
bool startSystemServer = false;
|
||||
bool application = false;
|
||||
String8 niceName;
|
||||
String8 className;
|
||||
|
||||
++i; // Skip unused "parent dir" argument.
|
||||
while (i < argc) {
|
||||
const char* arg = argv[i++];
|
||||
if (strcmp(arg, "--zygote") == 0) {
|
||||
zygote = true;
|
||||
niceName = ZYGOTE_NICE_NAME;
|
||||
} else if (strcmp(arg, "--start-system-server") == 0) {
|
||||
startSystemServer = true;
|
||||
} else if (strcmp(arg, "--application") == 0) {
|
||||
application = true;
|
||||
} else if (strncmp(arg, "--nice-name=", 12) == 0) {
|
||||
niceName.setTo(arg + 12);
|
||||
} else if (strncmp(arg, "--", 2) != 0) {
|
||||
className.setTo(arg);
|
||||
break;
|
||||
} else {
|
||||
--i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Vector<String8> args;
|
||||
if (!className.isEmpty()) {
|
||||
// We're not in zygote mode, the only argument we need to pass
|
||||
// to RuntimeInit is the application argument.
|
||||
//
|
||||
// The Remainder of args get passed to startup class main(). Make
|
||||
// copies of them before we overwrite them with the process name.
|
||||
args.add(application ? String8("application") : String8("tool"));
|
||||
runtime.setClassNameAndArgs(className, argc - i, argv + i);
|
||||
|
||||
if (!LOG_NDEBUG) {
|
||||
String8 restOfArgs;
|
||||
char* const* argv_new = argv + i;
|
||||
int argc_new = argc - i;
|
||||
for (int k = 0; k < argc_new; ++k) {
|
||||
restOfArgs.append("\"");
|
||||
restOfArgs.append(argv_new[k]);
|
||||
restOfArgs.append("\" ");
|
||||
}
|
||||
ALOGV("Class name = %s, args = %s", className.string(), restOfArgs.string());
|
||||
}
|
||||
} else {
|
||||
// We're in zygote mode.
|
||||
maybeCreateDalvikCache();
|
||||
|
||||
if (startSystemServer) {
|
||||
args.add(String8("start-system-server"));
|
||||
}
|
||||
|
||||
char prop[PROP_VALUE_MAX];
|
||||
if (property_get(ABI_LIST_PROPERTY, prop, NULL) == 0) {
|
||||
LOG_ALWAYS_FATAL("app_process: Unable to determine ABI list from property %s.",
|
||||
ABI_LIST_PROPERTY);
|
||||
return 11;
|
||||
}
|
||||
|
||||
String8 abiFlag("--abi-list=");
|
||||
abiFlag.append(prop);
|
||||
args.add(abiFlag);
|
||||
|
||||
// In zygote mode, pass all remaining arguments to the zygote
|
||||
// main() method.
|
||||
for (; i < argc; ++i) {
|
||||
args.add(String8(argv[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (!niceName.isEmpty()) {
|
||||
runtime.setArgv0(niceName.string(), true /* setProcName */);
|
||||
}
|
||||
|
||||
if (zygote) {
|
||||
runtime.start("com.android.internal.os.ZygoteInit", args, zygote);
|
||||
} else if (className) {
|
||||
runtime.start("com.android.internal.os.RuntimeInit", args, zygote);
|
||||
} else {
|
||||
fprintf(stderr, "Error: no class name or --zygote supplied.\n");
|
||||
app_usage();
|
||||
LOG_ALWAYS_FATAL("app_process: no class name or --zygote supplied.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# Copyright 2014 The Android Open Source Project
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := appops
|
||||
LOCAL_SRC_FILES := appops
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_PREBUILT)
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
Copyright (c) 2005-2014, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/system/bin/sh
|
||||
cmd appops "$@"
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright 2014 The Android Open Source Project
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||
LOCAL_MODULE := appwidget
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := appwidget
|
||||
LOCAL_SRC_FILES := appwidget
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_PREBUILT)
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
Copyright (c) 2005-2014, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Script to start "appwidget" on the device, which has a very rudimentary shell.
|
||||
base=/system
|
||||
export CLASSPATH=$base/framework/appwidget.jar
|
||||
exec app_process $base/bin com.android.commands.appwidget.AppWidget "$@"
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
** Copyright 2014, 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 com.android.commands.appwidget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.appwidget.IAppWidgetService;
|
||||
|
||||
/**
|
||||
* This class is a command line utility for manipulating app widgets. A client
|
||||
* can grant or revoke the permission for a given package to bind app widgets.
|
||||
*/
|
||||
public class AppWidget {
|
||||
|
||||
private static final String USAGE =
|
||||
"usage: adb shell appwidget [subcommand] [options]\n"
|
||||
+ "\n"
|
||||
+ "usage: adb shell appwidget grantbind --package <PACKAGE> "
|
||||
+ " [--user <USER_ID> | current]\n"
|
||||
+ " <PACKAGE> an Android package name.\n"
|
||||
+ " <USER_ID> The user id under which the package is installed.\n"
|
||||
+ " Example:\n"
|
||||
+ " # Grant the \"foo.bar.baz\" package to bind app widgets for the current user.\n"
|
||||
+ " adb shell grantbind --package foo.bar.baz --user current\n"
|
||||
+ "\n"
|
||||
+ "usage: adb shell appwidget revokebind --package <PACKAGE> "
|
||||
+ "[--user <USER_ID> | current]\n"
|
||||
+ " <PACKAGE> an Android package name.\n"
|
||||
+ " <USER_ID> The user id under which the package is installed.\n"
|
||||
+ " Example:\n"
|
||||
+ " # Revoke the permisison to bind app widgets from the \"foo.bar.baz\" package.\n"
|
||||
+ " adb shell revokebind --package foo.bar.baz --user current\n"
|
||||
+ "\n";
|
||||
|
||||
private static class Parser {
|
||||
private static final String ARGUMENT_GRANT_BIND = "grantbind";
|
||||
private static final String ARGUMENT_REVOKE_BIND = "revokebind";
|
||||
private static final String ARGUMENT_PACKAGE = "--package";
|
||||
private static final String ARGUMENT_USER = "--user";
|
||||
private static final String ARGUMENT_PREFIX = "--";
|
||||
private static final String VALUE_USER_CURRENT = "current";
|
||||
|
||||
private final Tokenizer mTokenizer;
|
||||
|
||||
public Parser(String[] args) {
|
||||
mTokenizer = new Tokenizer(args);
|
||||
}
|
||||
|
||||
public Runnable parseCommand() {
|
||||
try {
|
||||
String operation = mTokenizer.nextArg();
|
||||
if (ARGUMENT_GRANT_BIND.equals(operation)) {
|
||||
return parseSetGrantBindAppWidgetPermissionCommand(true);
|
||||
} else if (ARGUMENT_REVOKE_BIND.equals(operation)) {
|
||||
return parseSetGrantBindAppWidgetPermissionCommand(false);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported operation: " + operation);
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
System.out.println(USAGE);
|
||||
System.out.println("[ERROR] " + iae.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private SetBindAppWidgetPermissionCommand parseSetGrantBindAppWidgetPermissionCommand(
|
||||
boolean granted) {
|
||||
String packageName = null;
|
||||
int userId = UserHandle.USER_SYSTEM;
|
||||
for (String argument; (argument = mTokenizer.nextArg()) != null;) {
|
||||
if (ARGUMENT_PACKAGE.equals(argument)) {
|
||||
packageName = argumentValueRequired(argument);
|
||||
} else if (ARGUMENT_USER.equals(argument)) {
|
||||
String user = argumentValueRequired(argument);
|
||||
if (VALUE_USER_CURRENT.equals(user)) {
|
||||
userId = UserHandle.USER_CURRENT;
|
||||
} else {
|
||||
userId = Integer.parseInt(user);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported argument: " + argument);
|
||||
}
|
||||
}
|
||||
if (packageName == null) {
|
||||
throw new IllegalArgumentException("Package name not specified."
|
||||
+ " Did you specify --package argument?");
|
||||
}
|
||||
return new SetBindAppWidgetPermissionCommand(packageName, granted, userId);
|
||||
}
|
||||
|
||||
private String argumentValueRequired(String argument) {
|
||||
String value = mTokenizer.nextArg();
|
||||
if (TextUtils.isEmpty(value) || value.startsWith(ARGUMENT_PREFIX)) {
|
||||
throw new IllegalArgumentException("No value for argument: " + argument);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Tokenizer {
|
||||
private final String[] mArgs;
|
||||
private int mNextArg;
|
||||
|
||||
public Tokenizer(String[] args) {
|
||||
mArgs = args;
|
||||
}
|
||||
|
||||
private String nextArg() {
|
||||
if (mNextArg < mArgs.length) {
|
||||
return mArgs[mNextArg++];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class SetBindAppWidgetPermissionCommand implements Runnable {
|
||||
final String mPackageName;
|
||||
final boolean mGranted;
|
||||
final int mUserId;
|
||||
|
||||
public SetBindAppWidgetPermissionCommand(String packageName, boolean granted,
|
||||
int userId) {
|
||||
mPackageName = packageName;
|
||||
mGranted = granted;
|
||||
mUserId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IBinder binder = ServiceManager.getService(Context.APPWIDGET_SERVICE);
|
||||
IAppWidgetService appWidgetService = IAppWidgetService.Stub.asInterface(binder);
|
||||
try {
|
||||
appWidgetService.setBindAppWidgetPermission(mPackageName, mUserId, mGranted);
|
||||
} catch (RemoteException re) {
|
||||
re.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Parser parser = new Parser(args);
|
||||
Runnable command = parser.parseCommand();
|
||||
if (command != null) {
|
||||
command.run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright 2009 The Android Open Source Project
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= backup.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libutils libandroidfw
|
||||
|
||||
LOCAL_MODULE:= btool
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
|
@ -0,0 +1,190 @@
|
|||
|
||||
Copyright (c) 2005-2008, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (C) 2009 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.
|
||||
*/
|
||||
|
||||
#include <androidfw/BackupHelpers.h>
|
||||
#include <utils/String8.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace android;
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static int usage(int /* argc */, const char** argv)
|
||||
{
|
||||
const char* p = argv[0];
|
||||
|
||||
fprintf(stderr, "%s: Backs up your data.\n"
|
||||
"\n"
|
||||
"usage: %s\n"
|
||||
" Prints all of the data that can be backed up to stdout.\n"
|
||||
"\n"
|
||||
"usage: %s list FILE\n"
|
||||
" Lists the backup entities in the file.\n"
|
||||
"\n"
|
||||
"usage: %s print NAME FILE\n"
|
||||
" Prints the entity named NAME in FILE.\n",
|
||||
p, p, p, p);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int perform_full_backup()
|
||||
{
|
||||
printf("this would have written all of your data to stdout\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perform_list(const char* filename)
|
||||
{
|
||||
int err;
|
||||
int fd;
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "Error opening: %s\n", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
BackupDataReader reader(fd);
|
||||
bool done;
|
||||
int type;
|
||||
|
||||
while (reader.ReadNextHeader(&done, &type) == 0) {
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
case BACKUP_HEADER_ENTITY_V1:
|
||||
{
|
||||
String8 key;
|
||||
size_t dataSize;
|
||||
err = reader.ReadEntityHeader(&key, &dataSize);
|
||||
if (err == 0) {
|
||||
printf(" entity: %s (%zu bytes)\n", key.string(), dataSize);
|
||||
} else {
|
||||
printf(" Error reading entity header\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf("Unknown chunk type: 0x%08x\n", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perform_print(const char* entityname, const char* filename)
|
||||
{
|
||||
printf("perform_print(%s, %s);", entityname, filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
if (argc <= 1) {
|
||||
return perform_full_backup();
|
||||
}
|
||||
if (argc == 3 && 0 == strcmp(argv[1], "list")) {
|
||||
return perform_list(argv[2]);
|
||||
}
|
||||
if (argc == 4 && 0 == strcmp(argv[1], "print")) {
|
||||
return perform_print(argv[2], argv[3]);
|
||||
}
|
||||
return usage(argc, argv);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright 2007 The Android Open Source Project
|
||||
#
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES := $(call all-subdir-java-files)
|
||||
LOCAL_MODULE := bmgrlib
|
||||
LOCAL_MODULE_STEM := bmgr
|
||||
include $(BUILD_JAVA_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := bmgr
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_SRC_FILES := bmgr
|
||||
LOCAL_REQUIRED_MODULES := bmgrlib
|
||||
include $(BUILD_PREBUILT)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue