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

Commit 8968f6a9 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

IPC StrictMode

This CL introduces a way of blocking IPCs on the main thread.
This is enforced by StrictMode, and enabled on tests and eng
builds.

All current blocking IPCs were whitelisted and bugs will be
filed, in order to fix them for R.

Bug: 139360025
Test: adb logcat
Test: atest SystemUITests
Change-Id: I45af2619605ee36b6bae83ef080272c62754b654
parent 72d6d459
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -641,6 +641,17 @@ public class Binder implements IBinder {
     */
    @SystemApi
    public interface ProxyTransactListener {
        /**
         * Called before onTransact.
         *
         * @return an object that will be passed back to #onTransactEnded (or null).
         * @hide
         */
        @Nullable
        default Object onTransactStarted(@NonNull IBinder binder, int transactionCode, int flags) {
            return onTransactStarted(binder, transactionCode);
        }

        /**
         * Called before onTransact.
         *
+1 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ public final class BinderProxy implements IBinder {

        if (transactListener != null) {
            final int origWorkSourceUid = Binder.getCallingWorkSourceUid();
            session = transactListener.onTransactStarted(this, code);
            session = transactListener.onTransactStarted(this, code, flags);

            // Allow the listener to update the work source uid. We need to update the request
            // header if the uid is updated.
+7 −4
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.keyguard;
import static android.telephony.PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE;
import static android.telephony.PhoneStateListener.LISTEN_NONE;

import static com.android.systemui.DejankUtils.whitelistIpcs;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -33,6 +35,8 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.VisibleForTesting;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.WirelessUtils;
@@ -42,8 +46,6 @@ import com.android.systemui.keyguard.WakefulnessLifecycle;
import java.util.List;
import java.util.Objects;

import androidx.annotation.VisibleForTesting;

/**
 * Controller that generates text including the carrier names and/or the status of all the SIM
 * interfaces in the device. Through a callback, the updates can be retrieved either as a list or
@@ -220,8 +222,9 @@ public class CarrierTextController {
                .getSystemService(Context.TELEPHONY_SERVICE));
        if (callback != null) {
            mCarrierTextCallback = callback;
            if (ConnectivityManager.from(mContext).isNetworkSupported(
                    ConnectivityManager.TYPE_MOBILE)) {
            // TODO(b/140034799)
            if (whitelistIpcs(() -> ConnectivityManager.from(mContext).isNetworkSupported(
                    ConnectivityManager.TYPE_MOBILE))) {
                mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
                mKeyguardUpdateMonitor.registerCallback(mCallback);
                mWakefulnessLifecycle.addObserver(mWakefulnessObserver);
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.keyguard;

import static com.android.systemui.DejankUtils.whitelistIpcs;

import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.content.Context;
@@ -132,7 +134,7 @@ public class EmergencyButton extends Button {
                return false;
            }
        });
        updateEmergencyCallButton();
        whitelistIpcs(this::updateEmergencyCallButton);
    }

    @Override
+4 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.keyguard;

import static com.android.systemui.DejankUtils.whitelistIpcs;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
@@ -467,8 +469,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
     * @param turningOff true if the device is being turned off
     */
    void showPrimarySecurityScreen(boolean turningOff) {
        SecurityMode securityMode = mSecurityModel.getSecurityMode(
                KeyguardUpdateMonitor.getCurrentUser());
        SecurityMode securityMode = whitelistIpcs(() -> mSecurityModel.getSecurityMode(
                KeyguardUpdateMonitor.getCurrentUser()));
        if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
        showSecurityScreen(securityMode);
    }
Loading