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

Commit e8f538b0 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Use exposed permission defintion in Tethering" am: f1a0c3ab

Change-Id: I1cf7f1077687f6a7cad2f4d0d6a99d9091bf0a37
parents 5c7bc206 f1a0c3ab
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.connectivity.tethering;

import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.Manifest.permission.NETWORK_STACK;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.hardware.usb.UsbManager.USB_CONFIGURED;
import static android.hardware.usb.UsbManager.USB_CONNECTED;
@@ -150,10 +152,6 @@ public class Tethering {
    private static final boolean DBG = false;
    private static final boolean VDBG = false;

    // TODO: add the below permissions to @SystemApi
    private static final String PERMISSION_NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
    private static final String PERMISSION_NETWORK_STACK = "android.permission.NETWORK_STACK";

    private static final Class[] sMessageClasses = {
            Tethering.class, TetherMasterSM.class, IpServer.class
    };
@@ -1987,9 +1985,9 @@ public class Tethering {
    /** Register tethering event callback */
    void registerTetheringEventCallback(ITetheringEventCallback callback) {
        final boolean hasListPermission =
                hasCallingPermission(PERMISSION_NETWORK_SETTINGS)
                hasCallingPermission(NETWORK_SETTINGS)
                        || hasCallingPermission(PERMISSION_MAINLINE_NETWORK_STACK)
                        || hasCallingPermission(PERMISSION_NETWORK_STACK);
                        || hasCallingPermission(NETWORK_STACK);
        mHandler.post(() -> {
            mTetheringEventCallbacks.register(callback, new CallbackCookie(hasListPermission));
            final TetheringCallbackStartedParcel parcel = new TetheringCallbackStartedParcel();