Loading services/usage/java/com/android/server/usage/IntervalStats.java +8 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,9 @@ import android.util.ArraySet; import java.util.List; class IntervalStats { import com.android.internal.annotations.VisibleForTesting; public class IntervalStats { public long beginTime; public long endTime; public long lastTimeSaved; Loading Loading @@ -149,7 +151,11 @@ class IntervalStats { && eventType != UsageEvents.Event.STANDBY_BUCKET_CHANGED; } void update(String packageName, long timeStamp, int eventType) { /** * @hide */ @VisibleForTesting public void update(String packageName, long timeStamp, int eventType) { UsageStats usageStats = getOrCreateUsageStats(packageName); // TODO(adamlesinski): Ensure that we recover from incorrect event sequences Loading services/usage/java/com/android/server/usage/UsageStatsDatabase.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ import java.util.List; /** * Provides an interface to query for UsageStat data from an XML database. */ class UsageStatsDatabase { public class UsageStatsDatabase { private static final int CURRENT_VERSION = 3; // Current version of the backup schema Loading Loading @@ -369,7 +369,7 @@ class UsageStatsDatabase { /** * Figures out what to extract from the given IntervalStats object. */ interface StatCombiner<T> { public interface StatCombiner<T> { /** * Implementations should extract interesting from <code>stats</code> and add it Loading tests/UsageStatsPerfTests/Android.mk 0 → 100644 +34 −0 Original line number Diff line number Diff line # Copyright (C) 2018 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 \ apct-perftests-utils \ services.usage LOCAL_PACKAGE_NAME := UsageStatsPerfTests LOCAL_PRIVATE_PLATFORM_APIS := true # For android.permission.FORCE_STOP_PACKAGES permission LOCAL_CERTIFICATE := platform include $(BUILD_PACKAGE) tests/UsageStatsPerfTests/AndroidManifest.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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.frameworks.perftests.usage"> <uses-sdk android:minSdkVersion="21" /> <uses-permission android:name="android.permission.DUMP" /> <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES" /> <application> <uses-library android:name="android.test.runner" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.frameworks.perftests.usage"/> </manifest> tests/UsageStatsPerfTests/AndroidTest.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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. --> <configuration description="Runs UsageStats Performance Tests"> <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> <option name="test-file-name" value="UsageStatsPerfTests.apk"/> <option name="cleanup-apks" value="true"/> </target_preparer> <option name="test-suite-tag" value="apct"/> <option name="test-tag" value="UsageStatsPerfTests"/> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> <option name="package" value="com.android.frameworks.perftests.usage"/> <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/> </test> </configuration> No newline at end of file Loading
services/usage/java/com/android/server/usage/IntervalStats.java +8 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,9 @@ import android.util.ArraySet; import java.util.List; class IntervalStats { import com.android.internal.annotations.VisibleForTesting; public class IntervalStats { public long beginTime; public long endTime; public long lastTimeSaved; Loading Loading @@ -149,7 +151,11 @@ class IntervalStats { && eventType != UsageEvents.Event.STANDBY_BUCKET_CHANGED; } void update(String packageName, long timeStamp, int eventType) { /** * @hide */ @VisibleForTesting public void update(String packageName, long timeStamp, int eventType) { UsageStats usageStats = getOrCreateUsageStats(packageName); // TODO(adamlesinski): Ensure that we recover from incorrect event sequences Loading
services/usage/java/com/android/server/usage/UsageStatsDatabase.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ import java.util.List; /** * Provides an interface to query for UsageStat data from an XML database. */ class UsageStatsDatabase { public class UsageStatsDatabase { private static final int CURRENT_VERSION = 3; // Current version of the backup schema Loading Loading @@ -369,7 +369,7 @@ class UsageStatsDatabase { /** * Figures out what to extract from the given IntervalStats object. */ interface StatCombiner<T> { public interface StatCombiner<T> { /** * Implementations should extract interesting from <code>stats</code> and add it Loading
tests/UsageStatsPerfTests/Android.mk 0 → 100644 +34 −0 Original line number Diff line number Diff line # Copyright (C) 2018 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 \ apct-perftests-utils \ services.usage LOCAL_PACKAGE_NAME := UsageStatsPerfTests LOCAL_PRIVATE_PLATFORM_APIS := true # For android.permission.FORCE_STOP_PACKAGES permission LOCAL_CERTIFICATE := platform include $(BUILD_PACKAGE)
tests/UsageStatsPerfTests/AndroidManifest.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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.frameworks.perftests.usage"> <uses-sdk android:minSdkVersion="21" /> <uses-permission android:name="android.permission.DUMP" /> <uses-permission android:name="android.permission.FORCE_STOP_PACKAGES" /> <application> <uses-library android:name="android.test.runner" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.frameworks.perftests.usage"/> </manifest>
tests/UsageStatsPerfTests/AndroidTest.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2018 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. --> <configuration description="Runs UsageStats Performance Tests"> <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup"> <option name="test-file-name" value="UsageStatsPerfTests.apk"/> <option name="cleanup-apks" value="true"/> </target_preparer> <option name="test-suite-tag" value="apct"/> <option name="test-tag" value="UsageStatsPerfTests"/> <test class="com.android.tradefed.testtype.AndroidJUnitTest"> <option name="package" value="com.android.frameworks.perftests.usage"/> <option name="runner" value="android.support.test.runner.AndroidJUnitRunner"/> </test> </configuration> No newline at end of file