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

Commit 05422458 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Merge 24Q3 (ab/AP3A.240905.015) to aosp-main-future" into aosp-main-future

parents 61a2efc8 0b886fe3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@
    <uses-permission android:name="android.permission.REMAP_MODIFIER_KEYS" />
    <uses-permission android:name="android.permission.ACCESS_GPU_SERVICE" />
    <uses-permission android:name="android.permission.MANAGE_GAME_MODE" />
    <uses-permission android:name="android.permission.RESTART_PHONE_PROCESS" />
    <uses-permission android:name="android.permission.RESTART_TELEPHONY_PROCESS" />
    <uses-permission android:name="android.permission.MANAGE_ENHANCED_CONFIRMATION_STATES" />
    <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
+3 −3
Original line number Diff line number Diff line
@@ -271,12 +271,12 @@ public class ResetNetworkRequest {
            builder.resetIms(mSubscriptionIdToResetIms);
        }
        // Reset phone process and RILD may impact above components, keep them at the end
        if ((mResetOptions & RESET_PHONE_PROCESS) != 0) {
            builder.restartPhoneProcess();
        }
        if ((mResetOptions & RESET_RILD) != 0) {
            builder.restartRild();
        }
        if ((mResetOptions & RESET_PHONE_PROCESS) != 0) {
            builder.restartPhoneProcess();
        }
        return builder;
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -142,13 +142,23 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment
    }

    @VisibleForTesting
    @Nullable
    CachedBluetoothDevice getCachedDevice(String deviceAddress) {
        if (sTestDataFactory != null) {
            return sTestDataFactory.getDevice(deviceAddress);
        }
        BluetoothDevice remoteDevice =
                mManager.getBluetoothAdapter().getRemoteDevice(deviceAddress);
        return mManager.getCachedDeviceManager().findDevice(remoteDevice);
        if (remoteDevice == null) {
            return null;
        }
        CachedBluetoothDevice cachedDevice =
                mManager.getCachedDeviceManager().findDevice(remoteDevice);
        if (cachedDevice != null) {
            return cachedDevice;
        }
        Log.i(TAG, "Add device to cached device manager: " + remoteDevice.getAnonymizedAddress());
        return mManager.getCachedDeviceManager().addDevice(remoteDevice);
    }

    @VisibleForTesting
+7 −12
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.settings.development;

import android.annotation.Nullable;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -27,7 +26,6 @@ import android.debug.IAdbManager;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.net.wifi.WifiConfiguration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -49,6 +47,7 @@ import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.wifi.dpp.AdbQrCode;
import com.android.settings.wifi.dpp.WifiDppQrCodeBaseFragment;
import com.android.settings.wifi.dpp.WifiNetworkConfig;
import com.android.settingslib.qrcode.QrCamera;
import com.android.settingslib.qrcode.QrDecorateView;

@@ -82,8 +81,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen

    /** QR code data scanned by camera */
    private AdbQrCode mAdbQrCode;
    @Nullable
    private WifiConfiguration mAdbConfig;
    private WifiNetworkConfig mAdbConfig;

    private IAdbManager mAdbManager;

@@ -289,17 +287,14 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
        AdbQrCode.triggerVibrationForQrCodeRecognition(getContext());
        mVerifyingTextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
        try {
            if (mAdbConfig != null) {
                mAdbManager.enablePairingByQrCode(mAdbConfig.SSID,
                        mAdbConfig.preSharedKey);
                return;
            }
            mAdbManager.enablePairingByQrCode(mAdbConfig.getSsid(),
                    mAdbConfig.getPreSharedKey());
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to enable QR code pairing" + e);
        }
            Log.e(TAG, "Unable to enable QR code pairing");
            getActivity().setResult(Activity.RESULT_CANCELED);
            getActivity().finish();
        }
    }

    @Override
    public void handleCameraFailure() {
+31 −20
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings.network;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
@@ -28,11 +29,14 @@ import android.net.wifi.WifiManager;
import android.net.wifi.p2p.WifiP2pManager;
import android.os.Looper;
import android.os.RecoverySystem;
import android.os.RemoteException;
import android.os.SystemClock;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;

import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.ResetNetworkRequest;
@@ -257,15 +261,15 @@ public class ResetNetworkOperationBuilder {
     */
    public ResetNetworkOperationBuilder restartPhoneProcess() {
        Runnable runnable = () -> {
            try {
                mContext.getContentResolver().call(
                        getResetTelephonyContentProviderAuthority(),
                        METHOD_RESTART_PHONE_PROCESS,
                        /* arg= */ null,
                        /* extras= */ null);
            // Unstable content provider can avoid us getting killed together with phone process
            try (ContentProviderClient client = getUnstableTelephonyContentProviderClient()) {
                if (client != null) {
                    client.call(METHOD_RESTART_PHONE_PROCESS, /* arg= */ null, /* extra= */ null);
                    Log.i(TAG, "Phone process was restarted.");
            } catch (IllegalArgumentException iae) {
                Log.w(TAG, "Fail to restart phone process: " + iae);
                }
            } catch (RemoteException re) {
                // It's normal to throw RE since phone process immediately dies
                Log.i(TAG, "Phone process has been restarted: " + re);
            }
        };
        mResetSequence.add(runnable);
@@ -279,15 +283,13 @@ public class ResetNetworkOperationBuilder {
     */
    public ResetNetworkOperationBuilder restartRild() {
        Runnable runnable = () -> {
            try {
                mContext.getContentResolver().call(
                        getResetTelephonyContentProviderAuthority(),
                        METHOD_RESTART_RILD,
                        /* arg= */ null,
                        /* extras= */ null);
            try (ContentProviderClient client = getUnstableTelephonyContentProviderClient()) {
                if (client != null) {
                    client.call(METHOD_RESTART_RILD, /* arg= */ null, /* extra= */ null);
                    Log.i(TAG, "RILD was restarted.");
            } catch (IllegalArgumentException iae) {
                Log.w(TAG, "Fail to restart RILD: " + iae);
                }
            } catch (RemoteException re) {
                Log.w(TAG, "Fail to restart RILD: " + re);
            }
        };
        mResetSequence.add(runnable);
@@ -322,9 +324,18 @@ public class ResetNetworkOperationBuilder {
     * @return the authority of the telephony content provider that support methods
     * resetPhoneProcess and resetRild.
     */
    @VisibleForTesting
    String getResetTelephonyContentProviderAuthority() {
    private String getResetTelephonyContentProviderAuthority() {
        return mContext.getResources().getString(
                R.string.reset_telephony_stack_content_provider_authority);
    }

    /**
     * @return the unstable content provider to avoid us getting killed with phone process
     */
    @Nullable
    @VisibleForTesting
    public ContentProviderClient getUnstableTelephonyContentProviderClient() {
        return mContext.getContentResolver().acquireUnstableContentProviderClient(
                getResetTelephonyContentProviderAuthority());
    }
}
Loading