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

Commit a81df1b7 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Add tests for validating cpu freq times in batterystats dump."

parents 13a0dbc1 5205004e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SMS"/>
    <uses-permission android:name="android.permission.TEST_GRANTED" />
    <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
    <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
<configuration description="Runs Frameworks Core Tests.">
    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
        <option name="test-file-name" value="FrameworksCoreTests.apk" />
        <option name="test-file-name" value="BstatsTestApp.apk" />
    </target_preparer>

    <option name="test-suite-tag" value="apct" />
+32 −0
Original line number Diff line number Diff line
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests

LOCAL_COMPATIBILITY_SUITE := device-tests

LOCAL_STATIC_JAVA_LIBRARIES := coretests-aidl

LOCAL_SRC_FILES := $(call all-subdir-java-files)

LOCAL_PACKAGE_NAME := BstatsTestApp
LOCAL_CERTIFICATE := platform
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)
 No newline at end of file
+28 −0
Original line number Diff line number Diff line
<?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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.coretests.apps.bstatstestapp">

    <application>
        <activity android:name=".TestActivity"
                  android:exported="true" />
        <service android:name=".IsolatedTestService"
                 android:exported="true"
                 android:isolatedProcess="true" />
    </application>

</manifest>
 No newline at end of file
+60 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.coretests.apps.bstatstestapp;

import com.android.frameworks.coretests.aidl.ICmdReceiver;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.Process;
import android.os.SystemClock;
import android.util.Log;

public class IsolatedTestService extends Service {
    private static final String TAG = IsolatedTestService.class.getName();

    @Override
    public void onCreate() {
        Log.d(TAG, "onCreate called. myUid=" + Process.myUid());
    }

    @Override
    public IBinder onBind(Intent intent) {
        return mReceiver.asBinder();
    }

    private ICmdReceiver mReceiver = new ICmdReceiver.Stub() {
        @Override
        public void doSomeWork(int durationMs) {
            final long endTime = SystemClock.uptimeMillis() + durationMs;
            double x;
            double y;
            double z;
            while (SystemClock.uptimeMillis() <= endTime) {
                x = 0.02;
                x *= 1000;
                y = x % 5;
                z = Math.sqrt(y / 100);
            }
        };

        @Override
        public void finishHost() {
            stopSelf();
        }
    };
}
Loading