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

Commit fa3b3a76 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Change SharedConnectivityService's permission check to use...

Merge "Change SharedConnectivityService's permission check to use checkCallingOrSelfPermission" into udc-dev am: 68e79acf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21564426



Change-Id: I987bba81b5f67990b5a8202864a6827ffd99f4cc
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c01aff77 68e79acf
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -130,9 +130,16 @@ public abstract class SharedConnectivityService extends Service {

            @RequiresPermission(anyOf = {android.Manifest.permission.NETWORK_SETTINGS,
                    android.Manifest.permission.NETWORK_SETUP_WIZARD})
            /**
             * checkPermissions is using checkCallingOrSelfPermission to support CTS testing of this
             * service. This does allow a process to bind to itself if it holds the proper
             * permission. We do not consider this to be an issue given that the process can already
             * access the service data since they are in the same process.
             */
            private void checkPermissions() {
                if (checkCallingPermission(NETWORK_SETTINGS) != PackageManager.PERMISSION_GRANTED
                        && checkCallingPermission(NETWORK_SETUP_WIZARD)
                if (checkCallingOrSelfPermission(NETWORK_SETTINGS)
                        != PackageManager.PERMISSION_GRANTED
                        && checkCallingOrSelfPermission(NETWORK_SETUP_WIZARD)
                        != PackageManager.PERMISSION_GRANTED) {
                    throw new SecurityException("Calling process must have NETWORK_SETTINGS or"
                            + " NETWORK_SETUP_WIZARD permission");