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

Commit fb39f7b0 authored by Anil Admal's avatar Anil Admal Committed by android-build-merger
Browse files

Merge "Fix permission mismatch logging of NfwNotification when GNSS HAL is disabled" into qt-dev

am: 2ef04806

Change-Id: I09448f4e9ced3bcbe41031f7eb95b6832a4915da
parents c6f2a4f4 2ef04806
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -456,9 +456,8 @@ class GnssVisibilityControl {
        final String proxyAppPkgName = nfwNotification.mProxyAppPackageName;
        final String proxyAppPkgName = nfwNotification.mProxyAppPackageName;
        final ProxyAppState proxyAppState = mProxyAppsState.get(proxyAppPkgName);
        final ProxyAppState proxyAppState = mProxyAppsState.get(proxyAppPkgName);
        final boolean isLocationRequestAccepted = nfwNotification.isRequestAccepted();
        final boolean isLocationRequestAccepted = nfwNotification.isRequestAccepted();
        final boolean isPermissionMismatched =
        final boolean isPermissionMismatched = isPermissionMismatched(proxyAppState,
                (proxyAppState == null) ? isLocationRequestAccepted
                nfwNotification);
                        : (proxyAppState.mHasLocationPermission != isLocationRequestAccepted);
        logEvent(nfwNotification, isPermissionMismatched);
        logEvent(nfwNotification, isPermissionMismatched);


        if (!nfwNotification.isRequestAttributedToProxyApp()) {
        if (!nfwNotification.isRequestAttributedToProxyApp()) {
@@ -506,14 +505,24 @@ class GnssVisibilityControl {


        // Log proxy app permission mismatch between framework and GNSS HAL.
        // Log proxy app permission mismatch between framework and GNSS HAL.
        if (isPermissionMismatched) {
        if (isPermissionMismatched) {
            Log.w(TAG, "Permission mismatch. Framework proxy app " + proxyAppPkgName
            Log.w(TAG, "Permission mismatch. Proxy app " + proxyAppPkgName
                    + " location permission is set to " + proxyAppState.mHasLocationPermission
                    + " location permission is set to " + proxyAppState.mHasLocationPermission
                    + " and GNSS HAL enabled is set to " + mIsGpsEnabled
                    + " but GNSS non-framework location access response type is "
                    + " but GNSS non-framework location access response type is "
                    + nfwNotification.getResponseTypeAsString() + " for notification: "
                    + nfwNotification.getResponseTypeAsString() + " for notification: "
                    + nfwNotification);
                    + nfwNotification);
        }
        }
    }
    }


    private boolean isPermissionMismatched(ProxyAppState proxyAppState,
            NfwNotification nfwNotification) {
        // Non-framework non-emergency location requests must be accepted only when IGnss.hal
        // is enabled and the proxy app has location permission.
        final boolean isLocationRequestAccepted = nfwNotification.isRequestAccepted();
        return (proxyAppState == null || !mIsGpsEnabled) ? isLocationRequestAccepted
                        : (proxyAppState.mHasLocationPermission != isLocationRequestAccepted);
    }

    private void showLocationIcon(ProxyAppState proxyAppState, NfwNotification nfwNotification,
    private void showLocationIcon(ProxyAppState proxyAppState, NfwNotification nfwNotification,
            int uid, String proxyAppPkgName) {
            int uid, String proxyAppPkgName) {
        // If we receive a new NfwNotification before the location icon is turned off for the
        // If we receive a new NfwNotification before the location icon is turned off for the