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

Commit c39b8b11 authored by Chris Tate's avatar Chris Tate
Browse files

Revert "Put broadcast timekeeping on its own thread"

This reverts commit 9c277557.

Reason for revert: Unanticipated performance degradation observed in user-switching scenarios; investigation will follow.

Change-Id: Ie06e909a92be45a24cc46b458a372eadf302e6c4
parent 9c277557
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -35,8 +35,6 @@
            android:label="@string/permlab_testDenied"
            android:label="@string/permlab_testDenied"
            android:description="@string/permdesc_testDenied" />
            android:description="@string/permdesc_testDenied" />


    <uses-permission android:name="com.android.frameworks.coretests.permission.TEST_GRANTED" />

    <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" />
    <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED" />
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED" />
@@ -78,6 +76,7 @@
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SMS"/>
    <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="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.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" />
@@ -1456,7 +1455,6 @@
            </intent-filter>
            </intent-filter>
        </receiver>
        </receiver>
        <receiver android:name="android.app.activity.RemoteGrantedReceiver"
        <receiver android:name="android.app.activity.RemoteGrantedReceiver"
                android:process=":remoteReceiver"
                android:permission="com.android.frameworks.coretests.permission.TEST_GRANTED"
                android:permission="com.android.frameworks.coretests.permission.TEST_GRANTED"
                android:exported="true">
                android:exported="true">
            <intent-filter android:priority="2">
            <intent-filter android:priority="2">
@@ -1464,7 +1462,6 @@
            </intent-filter>
            </intent-filter>
        </receiver>
        </receiver>
        <receiver android:name="android.app.activity.RemoteDeniedReceiver"
        <receiver android:name="android.app.activity.RemoteDeniedReceiver"
                android:process=":remoteReceiver"
                android:permission="com.android.frameworks.coretests.permission.TEST_DENIED"
                android:permission="com.android.frameworks.coretests.permission.TEST_DENIED"
                android:exported="true">
                android:exported="true">
            <intent-filter android:priority="2">
            <intent-filter android:priority="2">
+11 −28
Original line number Original line Diff line number Diff line
@@ -56,8 +56,6 @@ public class BroadcastTest extends ActivityTestsBase {
            "com.android.frameworks.coretests.activity.BROADCAST_MULTI";
            "com.android.frameworks.coretests.activity.BROADCAST_MULTI";
    public static final String BROADCAST_ABORT =
    public static final String BROADCAST_ABORT =
            "com.android.frameworks.coretests.activity.BROADCAST_ABORT";
            "com.android.frameworks.coretests.activity.BROADCAST_ABORT";
    public static final String BROADCAST_RESULT =
            "com.android.frameworks.coretests.activity.BROADCAST_RESULT";


    public static final String BROADCAST_STICKY1 =
    public static final String BROADCAST_STICKY1 =
            "com.android.frameworks.coretests.activity.BROADCAST_STICKY1";
            "com.android.frameworks.coretests.activity.BROADCAST_STICKY1";
@@ -108,14 +106,7 @@ public class BroadcastTest extends ActivityTestsBase {
    }
    }


    public Intent makeBroadcastIntent(String action) {
    public Intent makeBroadcastIntent(String action) {
        return makeBroadcastIntent(action, false);
    }

    public Intent makeBroadcastIntent(String action, boolean makeImplicit) {
        Intent intent = new Intent(action, null);
        Intent intent = new Intent(action, null);
        if (makeImplicit) {
            intent.addFlags(intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        }
        intent.putExtra("caller", mCallTarget);
        intent.putExtra("caller", mCallTarget);
        return intent;
        return intent;
    }
    }
@@ -286,7 +277,7 @@ public class BroadcastTest extends ActivityTestsBase {
            map.putString("foo", "you");
            map.putString("foo", "you");
            map.putString("remove", "me");
            map.putString("remove", "me");
            getContext().sendOrderedBroadcast(
            getContext().sendOrderedBroadcast(
                    makeBroadcastIntent(BROADCAST_RESULT, true),
                    new Intent("com.android.frameworks.coretests.activity.BROADCAST_RESULT"),
                    null, broadcastReceiver, null, 1, "foo", map);
                    null, broadcastReceiver, null, 1, "foo", map);
            while (!broadcastReceiver.mHaveResult) {
            while (!broadcastReceiver.mHaveResult) {
                try {
                try {
@@ -433,13 +424,10 @@ public class BroadcastTest extends ActivityTestsBase {


    public void testLocalReceivePermissionGranted() throws Exception {
    public void testLocalReceivePermissionGranted() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_LOCAL_GRANTED, true));
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_LOCAL_GRANTED));
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }


    /*
    // TODO: multi-package test b/c self-target broadcasts are always allowed
    // even when gated on ungranted permissions
    public void testLocalReceivePermissionDenied() throws Exception {
    public void testLocalReceivePermissionDenied() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_RESULTS});
        setExpectedReceivers(new String[]{RECEIVER_RESULTS});


@@ -450,17 +438,16 @@ public class BroadcastTest extends ActivityTestsBase {
        };
        };


        getContext().sendOrderedBroadcast(
        getContext().sendOrderedBroadcast(
                makeBroadcastIntent(BROADCAST_LOCAL_DENIED, true),
                makeBroadcastIntent(BROADCAST_LOCAL_DENIED),
                null, finish, null, Activity.RESULT_CANCELED,
                null, finish, null, Activity.RESULT_CANCELED,
                null, null);
                null, null);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }
    */


    public void testLocalBroadcastPermissionGranted() throws Exception {
    public void testLocalBroadcastPermissionGranted() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        getContext().sendBroadcast(
        getContext().sendBroadcast(
                makeBroadcastIntent(BROADCAST_LOCAL, true),
                makeBroadcastIntent(BROADCAST_LOCAL),
                PERMISSION_GRANTED);
                PERMISSION_GRANTED);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }
@@ -475,7 +462,7 @@ public class BroadcastTest extends ActivityTestsBase {
        };
        };


        getContext().sendOrderedBroadcast(
        getContext().sendOrderedBroadcast(
                makeBroadcastIntent(BROADCAST_LOCAL, true),
                makeBroadcastIntent(BROADCAST_LOCAL),
                PERMISSION_DENIED, finish, null, Activity.RESULT_CANCELED,
                PERMISSION_DENIED, finish, null, Activity.RESULT_CANCELED,
                null, null);
                null, null);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
@@ -483,13 +470,10 @@ public class BroadcastTest extends ActivityTestsBase {


    public void testRemoteReceivePermissionGranted() throws Exception {
    public void testRemoteReceivePermissionGranted() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_REMOTE});
        setExpectedReceivers(new String[]{RECEIVER_REMOTE});
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_REMOTE_GRANTED, true));
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_REMOTE_GRANTED));
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }


    /*
    // TODO: multi-package test b/c self-target broadcasts are always allowed
    // even when gated on ungranted permissions
    public void testRemoteReceivePermissionDenied() throws Exception {
    public void testRemoteReceivePermissionDenied() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_RESULTS});
        setExpectedReceivers(new String[]{RECEIVER_RESULTS});


@@ -500,17 +484,16 @@ public class BroadcastTest extends ActivityTestsBase {
        };
        };


        getContext().sendOrderedBroadcast(
        getContext().sendOrderedBroadcast(
                makeBroadcastIntent(BROADCAST_REMOTE_DENIED, true),
                makeBroadcastIntent(BROADCAST_REMOTE_DENIED),
                null, finish, null, Activity.RESULT_CANCELED,
                null, finish, null, Activity.RESULT_CANCELED,
                null, null);
                null, null);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }
    */


    public void testRemoteBroadcastPermissionGranted() throws Exception {
    public void testRemoteBroadcastPermissionGranted() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_REMOTE});
        setExpectedReceivers(new String[]{RECEIVER_REMOTE});
        getContext().sendBroadcast(
        getContext().sendBroadcast(
                makeBroadcastIntent(BROADCAST_REMOTE, true),
                makeBroadcastIntent(BROADCAST_REMOTE),
                PERMISSION_GRANTED);
                PERMISSION_GRANTED);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }
@@ -525,7 +508,7 @@ public class BroadcastTest extends ActivityTestsBase {
        };
        };


        getContext().sendOrderedBroadcast(
        getContext().sendOrderedBroadcast(
                makeBroadcastIntent(BROADCAST_REMOTE, true),
                makeBroadcastIntent(BROADCAST_REMOTE),
                PERMISSION_DENIED, finish, null, Activity.RESULT_CANCELED,
                PERMISSION_DENIED, finish, null, Activity.RESULT_CANCELED,
                null, null);
                null, null);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
@@ -533,13 +516,13 @@ public class BroadcastTest extends ActivityTestsBase {


    public void testReceiverCanNotRegister() throws Exception {
    public void testReceiverCanNotRegister() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_FAIL_REGISTER, true));
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_FAIL_REGISTER));
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }


    public void testReceiverCanNotBind() throws Exception {
    public void testReceiverCanNotBind() throws Exception {
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        setExpectedReceivers(new String[]{RECEIVER_LOCAL});
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_FAIL_BIND, true));
        getContext().sendBroadcast(makeBroadcastIntent(BROADCAST_FAIL_BIND));
        waitForResultOrThrow(BROADCAST_TIMEOUT);
        waitForResultOrThrow(BROADCAST_TIMEOUT);
    }
    }


+15 −25
Original line number Original line Diff line number Diff line
@@ -253,16 +253,16 @@ public class LaunchpadActivity extends Activity {
                sendBroadcast(makeBroadcastIntent(BROADCAST_REGISTERED));
                sendBroadcast(makeBroadcastIntent(BROADCAST_REGISTERED));
            } else if (BROADCAST_LOCAL.equals(action)) {
            } else if (BROADCAST_LOCAL.equals(action)) {
                setExpectedReceivers(new String[]{RECEIVER_LOCAL});
                setExpectedReceivers(new String[]{RECEIVER_LOCAL});
                sendBroadcast(makeBroadcastIntent(BROADCAST_LOCAL, true));
                sendBroadcast(makeBroadcastIntent(BROADCAST_LOCAL));
            } else if (BROADCAST_REMOTE.equals(action)) {
            } else if (BROADCAST_REMOTE.equals(action)) {
                setExpectedReceivers(new String[]{RECEIVER_REMOTE});
                setExpectedReceivers(new String[]{RECEIVER_REMOTE});
                sendBroadcast(makeBroadcastIntent(BROADCAST_REMOTE, true));
                sendBroadcast(makeBroadcastIntent(BROADCAST_REMOTE));
            } else if (BROADCAST_ALL.equals(action)) {
            } else if (BROADCAST_ALL.equals(action)) {
                setExpectedReceivers(new String[]{
                setExpectedReceivers(new String[]{
                        RECEIVER_REMOTE, RECEIVER_REG, RECEIVER_LOCAL});
                        RECEIVER_REMOTE, RECEIVER_REG, RECEIVER_LOCAL});
                registerMyReceiver(new IntentFilter(BROADCAST_ALL));
                registerMyReceiver(new IntentFilter(BROADCAST_ALL));
                sCallingTest.addIntermediate("after-register");
                sCallingTest.addIntermediate("after-register");
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL, true), null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
            } else if (BROADCAST_MULTI.equals(action)) {
            } else if (BROADCAST_MULTI.equals(action)) {
                setExpectedReceivers(new String[]{
                setExpectedReceivers(new String[]{
                        RECEIVER_REMOTE, RECEIVER_REG, RECEIVER_LOCAL,
                        RECEIVER_REMOTE, RECEIVER_REG, RECEIVER_LOCAL,
@@ -277,26 +277,23 @@ public class LaunchpadActivity extends Activity {
                        RECEIVER_REMOTE, RECEIVER_LOCAL});
                        RECEIVER_REMOTE, RECEIVER_LOCAL});
                registerMyReceiver(new IntentFilter(BROADCAST_ALL));
                registerMyReceiver(new IntentFilter(BROADCAST_ALL));
                sCallingTest.addIntermediate("after-register");
                sCallingTest.addIntermediate("after-register");
                final Intent allIntent = makeBroadcastIntent(BROADCAST_ALL, true);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                final Intent localIntent = makeBroadcastIntent(BROADCAST_LOCAL, true);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                final Intent remoteIntent = makeBroadcastIntent(BROADCAST_REMOTE, true);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_LOCAL), null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_REMOTE), null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_LOCAL), null);
                sendOrderedBroadcast(localIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_REMOTE), null);
                sendOrderedBroadcast(remoteIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                sendOrderedBroadcast(localIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                sendOrderedBroadcast(remoteIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ALL), null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_REPEAT), null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(allIntent, null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_REPEAT, true), null);
            } else if (BROADCAST_ABORT.equals(action)) {
            } else if (BROADCAST_ABORT.equals(action)) {
                setExpectedReceivers(new String[]{
                setExpectedReceivers(new String[]{
                        RECEIVER_REMOTE, RECEIVER_ABORT});
                        RECEIVER_REMOTE, RECEIVER_ABORT});
                registerMyReceiver(new IntentFilter(BROADCAST_ABORT));
                registerMyReceiver(new IntentFilter(BROADCAST_ABORT));
                sCallingTest.addIntermediate("after-register");
                sCallingTest.addIntermediate("after-register");
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ABORT, true), null);
                sendOrderedBroadcast(makeBroadcastIntent(BROADCAST_ABORT), null);
            } else if (BROADCAST_STICKY1.equals(action)) {
            } else if (BROADCAST_STICKY1.equals(action)) {
                setExpectedReceivers(new String[]{RECEIVER_REG});
                setExpectedReceivers(new String[]{RECEIVER_REG});
                setExpectedData(new String[]{DATA_1});
                setExpectedData(new String[]{DATA_1});
@@ -439,14 +436,7 @@ public class LaunchpadActivity extends Activity {
    }
    }


    private Intent makeBroadcastIntent(String action) {
    private Intent makeBroadcastIntent(String action) {
        return makeBroadcastIntent(action, false);
    }

    private Intent makeBroadcastIntent(String action, boolean makeImplicit) {
        Intent intent = new Intent(action, null);
        Intent intent = new Intent(action, null);
        if (makeImplicit) {
            intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        }
        intent.putExtra("caller", mCallTarget);
        intent.putExtra("caller", mCallTarget);
        return intent;
        return intent;
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ import android.os.RemoteException;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcel;


public class LocalDeniedReceiver extends BroadcastReceiver {
class LocalDeniedReceiver extends BroadcastReceiver {
    public LocalDeniedReceiver() {
    public LocalDeniedReceiver() {
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ import android.os.RemoteException;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcel;


public class RemoteDeniedReceiver extends BroadcastReceiver {
class RemoteDeniedReceiver extends BroadcastReceiver {
    public RemoteDeniedReceiver() {
    public RemoteDeniedReceiver() {
    }
    }


Loading