summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/Settings.java12
-rw-r--r--core/java/android/view/autofill/AutofillManager.java46
-rw-r--r--core/res/res/layout-car/car_preference.xml12
-rw-r--r--core/res/res/layout-car/car_preference_category.xml14
-rw-r--r--core/res/res/values/dimens_car.xml4
-rw-r--r--core/tests/coretests/src/android/provider/SettingsBackupTest.java3
-rw-r--r--location/java/com/android/internal/location/GpsNetInitiatedHandler.java14
-rw-r--r--media/java/android/media/AudioRecord.java1
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java7
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java10
-rw-r--r--services/core/java/com/android/server/location/GnssLocationProvider.java2
-rw-r--r--services/core/java/com/android/server/location/GnssVisibilityControl.java65
12 files changed, 147 insertions, 43 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 57223ab7efc4..de888d3f9a7f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8273,6 +8273,16 @@ public final class Settings {
BOOLEAN_VALIDATOR;
/**
+ * Whether or not the face unlock education screen has been shown to the user.
+ * @hide
+ */
+ public static final String FACE_UNLOCK_EDUCATION_INFO_DISPLAYED =
+ "face_unlock_education_info_displayed";
+
+ private static final Validator FACE_UNLOCK_EDUCATION_INFO_DISPLAYED_VALIDATOR =
+ BOOLEAN_VALIDATOR;
+
+ /**
* Whether or not debugging is enabled.
* @hide
*/
@@ -9079,6 +9089,8 @@ public final class Settings {
VALIDATORS.put(FACE_UNLOCK_APP_ENABLED, FACE_UNLOCK_APP_ENABLED_VALIDATOR);
VALIDATORS.put(FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION_VALIDATOR);
+ VALIDATORS.put(FACE_UNLOCK_EDUCATION_INFO_DISPLAYED,
+ FACE_UNLOCK_EDUCATION_INFO_DISPLAYED_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_ENABLED, ASSIST_GESTURE_ENABLED_VALIDATOR);
VALIDATORS.put(ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
ASSIST_GESTURE_SILENCE_ALERTS_ENABLED_VALIDATOR);
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 5872d3f7f785..35ea8964a342 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -48,6 +48,7 @@ import android.service.autofill.FillEventHistory;
import android.service.autofill.UserData;
import android.util.ArrayMap;
import android.util.ArraySet;
+import android.util.DebugUtils;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -229,7 +230,8 @@ public final class AutofillManager {
/** @hide */ public static final int FLAG_ADD_CLIENT_VERBOSE = 0x4;
/** @hide */ public static final int FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY = 0x8;
- /** @hide */ public static final int FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY = 0x1;
+ // NOTE: flag below is used by the session start receiver only, hence it can have values above
+ /** @hide */ public static final int RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY = 0x1;
/** @hide */
public static final int DEFAULT_LOGGING_LEVEL = Build.IS_DEBUGGABLE
@@ -521,7 +523,7 @@ public final class AutofillManager {
private boolean mForAugmentedAutofillOnly;
/**
- * When set, standard autofill is enabled, but sessions can still be created for augmented
+ * When set, standard autofill is disabled, but sessions can still be created for augmented
* autofill only.
*/
@GuardedBy("mLock")
@@ -969,6 +971,13 @@ public final class AutofillManager {
startSessionLocked(id, null, value, flags);
} else {
// Update focus on existing session.
+ if (mForAugmentedAutofillOnly && (flags & FLAG_MANUAL_REQUEST) != 0) {
+ if (sDebug) {
+ Log.d(TAG, "notifyViewEntered(" + id + "): resetting "
+ + "mForAugmentedAutofillOnly on manual request");
+ }
+ mForAugmentedAutofillOnly = false;
+ }
updateSessionLocked(id, null, value, ACTION_VIEW_ENTERED, flags);
}
addEnteredIdLocked(id);
@@ -1126,6 +1135,13 @@ public final class AutofillManager {
startSessionLocked(id, bounds, null, flags);
} else {
// Update focus on existing session.
+ if (mForAugmentedAutofillOnly && (flags & FLAG_MANUAL_REQUEST) != 0) {
+ if (sDebug) {
+ Log.d(TAG, "notifyViewEntered(" + id + "): resetting "
+ + "mForAugmentedAutofillOnly on manual request");
+ }
+ mForAugmentedAutofillOnly = false;
+ }
updateSessionLocked(id, bounds, null, ACTION_VIEW_ENTERED, flags);
}
addEnteredIdLocked(id);
@@ -1695,6 +1711,16 @@ public final class AutofillManager {
+ ", enabledAugmentedOnly=" + mEnabledForAugmentedAutofillOnly
+ ", enteredIds=" + mEnteredIds);
}
+ // We need to reset the augmented-only state when a manual request is made, as it's possible
+ // that the service returned null for the first request and now the user is manually
+ // requesting autofill to trigger a custom UI provided by the service.
+ if (mForAugmentedAutofillOnly && !mEnabledForAugmentedAutofillOnly
+ && (flags & FLAG_MANUAL_REQUEST) != 0) {
+ if (sVerbose) {
+ Log.v(TAG, "resetting mForAugmentedAutofillOnly on manual autofill request");
+ }
+ mForAugmentedAutofillOnly = false;
+ }
if (mState != STATE_UNKNOWN && !isFinishedLocked() && (flags & FLAG_MANUAL_REQUEST) == 0) {
if (sVerbose) {
Log.v(TAG, "not automatically starting session for " + id
@@ -1717,7 +1743,7 @@ public final class AutofillManager {
mState = STATE_ACTIVE;
}
final int extraFlags = receiver.getOptionalExtraIntResult(0);
- if ((extraFlags & FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) != 0) {
+ if ((extraFlags & RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) != 0) {
if (sDebug) Log.d(TAG, "startSession(" + componentName + "): for augmented only");
mForAugmentedAutofillOnly = true;
}
@@ -2011,10 +2037,20 @@ public final class AutofillManager {
public static final int SET_STATE_FLAG_DEBUG = 0x08;
/** @hide */
public static final int SET_STATE_FLAG_VERBOSE = 0x10;
+ /** @hide */
+ public static final int SET_STATE_FLAG_FOR_AUTOFILL_ONLY = 0x20;
private void setState(int flags) {
- if (sVerbose) Log.v(TAG, "setState(" + flags + ")");
+ if (sVerbose) {
+ Log.v(TAG, "setState(" + flags + ": " + DebugUtils.flagsToString(AutofillManager.class,
+ "SET_STATE_FLAG_", flags) + ")");
+ }
synchronized (mLock) {
+ if ((flags & SET_STATE_FLAG_FOR_AUTOFILL_ONLY) != 0) {
+ mForAugmentedAutofillOnly = true;
+ // NOTE: returning right away as this is the only flag set, at least currently...
+ return;
+ }
mEnabled = (flags & SET_STATE_FLAG_ENABLED) != 0;
if (!mEnabled || (flags & SET_STATE_FLAG_RESET_SESSION) != 0) {
// Reset the session state
@@ -2390,7 +2426,7 @@ public final class AutofillManager {
}
}
- if (sessionFinishedState != 0) {
+ if (sessionFinishedState != STATE_UNKNOWN) {
// Callback call was "hijacked" to also update the session state.
setSessionFinished(sessionFinishedState, /* autofillableIds= */ null);
}
diff --git a/core/res/res/layout-car/car_preference.xml b/core/res/res/layout-car/car_preference.xml
index ae3d63bd2d6a..b138f4d7cf50 100644
--- a/core/res/res/layout-car/car_preference.xml
+++ b/core/res/res/layout-car/car_preference.xml
@@ -27,20 +27,20 @@
<com.android.internal.widget.PreferenceImageView
android:id="@id/icon"
- android:layout_width="@*android:dimen/car_primary_icon_size"
- android:layout_height="@*android:dimen/car_primary_icon_size"
+ android:layout_width="@dimen/car_preference_icon_size"
+ android:layout_height="@dimen/car_preference_icon_size"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
- android:layout_marginBottom="@*android:dimen/car_padding_2"
+ android:layout_marginBottom="@dimen/car_preference_row_vertical_margin"
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:layout_marginTop="@android:dimen/car_padding_2"/>
+ android:layout_marginTop="@dimen/car_preference_row_vertical_margin"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
- android:layout_marginBottom="@*android:dimen/car_padding_2"
- android:layout_marginTop="@*android:dimen/car_padding_2"
+ android:layout_marginBottom="@dimen/car_preference_row_vertical_margin"
+ android:layout_marginTop="@dimen/car_preference_row_vertical_margin"
android:layout_toEndOf="@id/icon"
android:layout_toStartOf="@id/widget_frame"
android:orientation="vertical">
diff --git a/core/res/res/layout-car/car_preference_category.xml b/core/res/res/layout-car/car_preference_category.xml
index d1f73421e185..b674487cffa7 100644
--- a/core/res/res/layout-car/car_preference_category.xml
+++ b/core/res/res/layout-car/car_preference_category.xml
@@ -22,25 +22,25 @@
android:background="?android:attr/selectableItemBackground"
android:focusable="true"
android:gravity="center_vertical"
- android:minHeight="@*android:dimen/car_card_header_height"
+ android:minHeight="@dimen/car_card_header_height"
android:orientation="horizontal"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
<com.android.internal.widget.PreferenceImageView
android:id="@id/icon"
- android:layout_width="@*android:dimen/car_primary_icon_size"
- android:layout_height="@*android:dimen/car_primary_icon_size"
+ android:layout_width="@dimen/car_preference_category_icon_size"
+ android:layout_height="@dimen/car_preference_category_icon_size"
android:layout_gravity="center_vertical"
- android:layout_marginBottom="@dimen/car_padding_2"
+ android:layout_marginBottom="@dimen/car_preference_row_vertical_margin"
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
- android:layout_marginTop="@*android:dimen/car_padding_2"/>
+ android:layout_marginTop="@dimen/car_preference_row_vertical_margin"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="@*android:dimen/car_padding_2"
- android:layout_marginTop="@*android:dimen/car_padding_2"
+ android:layout_marginBottom="@dimen/car_preference_row_vertical_margin"
+ android:layout_marginTop="@dimen/car_preference_row_vertical_margin"
android:orientation="vertical">
<TextView
diff --git a/core/res/res/values/dimens_car.xml b/core/res/res/values/dimens_car.xml
index f22a91ff75c1..880f9ccebd6e 100644
--- a/core/res/res/values/dimens_car.xml
+++ b/core/res/res/values/dimens_car.xml
@@ -137,4 +137,8 @@
<!-- Dialog image margin start -->
<dimen name="image_margin_start">@*android:dimen/car_keyline_1</dimen>
+ <dimen name="car_preference_icon_size">@dimen/car_primary_icon_size</dimen>
+ <dimen name="car_preference_category_icon_size">@dimen/car_primary_icon_size</dimen>
+ <dimen name="car_preference_row_vertical_margin">@dimen/car_padding_2</dimen>
+
</resources>
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 71a6b3099008..9fa04ef2dda2 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -721,7 +721,8 @@ public class SettingsBackupTest {
Settings.Secure.LOCATION_ACCESS_CHECK_DELAY_MILLIS,
Settings.Secure.BIOMETRIC_DEBUG_ENABLED,
Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
- Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED);
+ Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED,
+ Settings.Secure.FACE_UNLOCK_EDUCATION_INFO_DISPLAYED);
@Test
public void systemSettingsBackedUpOrBlacklisted() {
diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
index b4be21987cf7..04e7bab0542b 100644
--- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
+++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
@@ -357,8 +357,10 @@ public class GpsNetInitiatedHandler {
}
}
- // Sets the NI notification.
- private synchronized void setNiNotification(GpsNiNotification notif) {
+ /**
+ * Posts a notification in the status bar using the contents in {@code notif} object.
+ */
+ public synchronized void setNiNotification(GpsNiNotification notif) {
NotificationManager notificationManager = (NotificationManager) mContext
.getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager == null) {
@@ -539,14 +541,14 @@ public class GpsNetInitiatedHandler {
*/
static private String decodeString(String original, boolean isHex, int coding)
{
+ if (coding == GPS_ENC_NONE) {
+ return original;
+ }
+
String decoded = original;
byte[] input = stringToByteArray(original, isHex);
switch (coding) {
- case GPS_ENC_NONE:
- decoded = original;
- break;
-
case GPS_ENC_SUPL_GSM_DEFAULT:
decoded = decodeGSMPackedString(input);
break;
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index eeb7655abff9..ce9b07dd0c0e 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -838,6 +838,7 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection,
}
if (mAudioCapturePolicy != null) {
AudioManager.unregisterAudioPolicyAsyncStatic(mAudioCapturePolicy);
+ mAudioCapturePolicy = null;
}
native_release();
mState = STATE_UNINITIALIZED;
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index e1a7974bccb2..1bd5201f5b26 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -20,8 +20,8 @@ import static android.service.autofill.FillRequest.FLAG_MANUAL_REQUEST;
import static android.view.autofill.AutofillManager.ACTION_START_SESSION;
import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED;
import static android.view.autofill.AutofillManager.FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY;
-import static android.view.autofill.AutofillManager.FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY;
import static android.view.autofill.AutofillManager.NO_SESSION;
+import static android.view.autofill.AutofillManager.RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY;
import static com.android.server.autofill.Helper.sDebug;
import static com.android.server.autofill.Helper.sVerbose;
@@ -283,7 +283,7 @@ final class AutofillManagerServiceImpl
*
* @return {@code long} whose right-most 32 bits represent the session id (which is always
* non-negative), and the left-most contains extra flags (currently either {@code 0} or
- * {@link AutofillManager#FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY}).
+ * {@link AutofillManager#RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY}).
*/
@GuardedBy("mLock")
long startSessionLocked(@NonNull IBinder activityToken, int taskId, int uid,
@@ -357,7 +357,8 @@ final class AutofillManagerServiceImpl
if (forAugmentedAutofillOnly) {
// Must embed the flag in the response, at the high-end side of the long.
// (session is always positive, so we don't have to worry about the signal bit)
- final long extraFlags = ((long) FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) << 32;
+ final long extraFlags =
+ ((long) RECEIVER_FLAG_SESSION_FOR_AUGMENTED_AUTOFILL_ONLY) << 32;
final long result = extraFlags | newSession.id;
return result;
} else {
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 99e0714fa2a2..66b5437f0a7d 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -2407,7 +2407,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
return;
}
- if (mAugmentedAutofillableIds != null && mAugmentedAutofillableIds.contains(id)) {
+ if ((flags & FLAG_MANUAL_REQUEST) == 0 && mAugmentedAutofillableIds != null
+ && mAugmentedAutofillableIds.contains(id)) {
// View was already reported when server could not handle a response, but it
// triggered augmented autofill
@@ -2538,7 +2539,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
try {
if (mHasCallback) {
mClient.notifyNoFillUi(id, mCurrentViewId, sessionFinishedState);
- } else if (sessionFinishedState != 0) {
+ } else if (sessionFinishedState != AutofillManager.STATE_UNKNOWN) {
mClient.setSessionFinished(sessionFinishedState, autofillableIds);
}
} catch (RemoteException e) {
@@ -2693,6 +2694,11 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
+ "it can be augmented. AutofillableIds: " + autofillableIds);
}
mAugmentedAutofillableIds = autofillableIds;
+ try {
+ mClient.setState(AutofillManager.SET_STATE_FLAG_FOR_AUTOFILL_ONLY);
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Error setting client to autofill-only", e);
+ }
}
}
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 5f1f20294bc1..7ab46f60cf90 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -2055,7 +2055,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
setupNativeGnssService(/* reinitializeGnssServiceHandle = */ false);
if (native_is_gnss_visibility_control_supported()) {
- mGnssVisibilityControl = new GnssVisibilityControl(mContext, mLooper);
+ mGnssVisibilityControl = new GnssVisibilityControl(mContext, mLooper, mNIHandler);
}
// load default GPS configuration
diff --git a/services/core/java/com/android/server/location/GnssVisibilityControl.java b/services/core/java/com/android/server/location/GnssVisibilityControl.java
index c3626d2373ea..860138675529 100644
--- a/services/core/java/com/android/server/location/GnssVisibilityControl.java
+++ b/services/core/java/com/android/server/location/GnssVisibilityControl.java
@@ -33,6 +33,9 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.StatsLog;
+import com.android.internal.R;
+import com.android.internal.location.GpsNetInitiatedHandler;
+
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -65,6 +68,7 @@ class GnssVisibilityControl {
private final Handler mHandler;
private final Context mContext;
+ private final GpsNetInitiatedHandler mNiHandler;
private boolean mIsGpsEnabled;
@@ -76,11 +80,12 @@ class GnssVisibilityControl {
private PackageManager.OnPermissionsChangedListener mOnPermissionsChangedListener =
uid -> runOnHandler(() -> handlePermissionsChanged(uid));
- GnssVisibilityControl(Context context, Looper looper) {
+ GnssVisibilityControl(Context context, Looper looper, GpsNetInitiatedHandler niHandler) {
mContext = context;
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);
mHandler = new Handler(looper);
+ mNiHandler = niHandler;
mAppOps = mContext.getSystemService(AppOpsManager.class);
mPackageManager = mContext.getPackageManager();
@@ -250,6 +255,9 @@ class GnssVisibilityControl {
private static final byte NFW_RESPONSE_TYPE_ACCEPTED_NO_LOCATION_PROVIDED = 1;
private static final byte NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED = 2;
+ // This must match with NfwProtocolStack enum in IGnssVisibilityControlCallback.hal.
+ private static final byte NFW_PROTOCOL_STACK_SUPL = 1;
+
private final String mProxyAppPackageName;
private final byte mProtocolStack;
private final String mOtherProtocolStackName;
@@ -299,6 +307,10 @@ class GnssVisibilityControl {
return mResponseType != NfwNotification.NFW_RESPONSE_TYPE_REJECTED;
}
+ private boolean isLocationProvided() {
+ return mResponseType == NfwNotification.NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED;
+ }
+
private boolean isRequestAttributedToProxyApp() {
return !TextUtils.isEmpty(mProxyAppPackageName);
}
@@ -306,6 +318,10 @@ class GnssVisibilityControl {
private boolean isEmergencyRequestNotification() {
return mInEmergencyMode && !isRequestAttributedToProxyApp();
}
+
+ private boolean isRequestTypeSupl() {
+ return mProtocolStack == NFW_PROTOCOL_STACK_SUPL;
+ }
}
private void handlePermissionsChanged(int uid) {
@@ -430,16 +446,15 @@ class GnssVisibilityControl {
return;
}
- Log.e(TAG, "ProxyAppPackageName field is not set. AppOps service not notified "
- + "for non-framework location access notification: " + nfwNotification);
+ Log.e(TAG, "ProxyAppPackageName field is not set. AppOps service not notified"
+ + " for notification: " + nfwNotification);
return;
}
if (isLocationPermissionEnabled == null) {
- Log.w(TAG, "Could not find proxy app with name: " + proxyAppPkgName + " in the "
- + "value specified for config parameter: "
- + GnssConfiguration.CONFIG_NFW_PROXY_APPS + ". AppOps service not notified "
- + "for non-framework location access notification: " + nfwNotification);
+ Log.w(TAG, "Could not find proxy app " + proxyAppPkgName + " in the value specified for"
+ + " config parameter: " + GnssConfiguration.CONFIG_NFW_PROXY_APPS
+ + ". AppOps service not notified for notification: " + nfwNotification);
return;
}
@@ -447,8 +462,7 @@ class GnssVisibilityControl {
final ApplicationInfo proxyAppInfo = getProxyAppInfo(proxyAppPkgName);
if (proxyAppInfo == null) {
Log.e(TAG, "Proxy app " + proxyAppPkgName + " is not found. AppOps service not "
- + "notified for non-framework location access notification: "
- + nfwNotification);
+ + "notified for notification: " + nfwNotification);
return;
}
@@ -465,13 +479,40 @@ class GnssVisibilityControl {
}
private void handleEmergencyNfwNotification(NfwNotification nfwNotification) {
- boolean isPermissionMismatched =
- (nfwNotification.mResponseType == NfwNotification.NFW_RESPONSE_TYPE_REJECTED);
- if (isPermissionMismatched) {
+ boolean isPermissionMismatched = false;
+ if (!nfwNotification.isRequestAccepted()) {
Log.e(TAG, "Emergency non-framework location request incorrectly rejected."
+ " Notification: " + nfwNotification);
+ isPermissionMismatched = true;
+ }
+
+ if (!mNiHandler.getInEmergency()) {
+ Log.w(TAG, "Emergency state mismatch. Device currently not in user initiated emergency"
+ + " session. Notification: " + nfwNotification);
+ isPermissionMismatched = true;
}
+
logEvent(nfwNotification, isPermissionMismatched);
+
+ if (nfwNotification.isLocationProvided()) {
+ // Emulate deprecated IGnssNi.hal user notification of emergency NI requests.
+ GpsNetInitiatedHandler.GpsNiNotification notification =
+ new GpsNetInitiatedHandler.GpsNiNotification();
+ notification.notificationId = 0;
+ notification.niType = nfwNotification.isRequestTypeSupl()
+ ? GpsNetInitiatedHandler.GPS_NI_TYPE_EMERGENCY_SUPL
+ : GpsNetInitiatedHandler.GPS_NI_TYPE_UMTS_CTRL_PLANE;
+ notification.needNotify = true;
+ notification.needVerify = false;
+ notification.privacyOverride = false;
+ notification.timeout = 0;
+ notification.defaultResponse = GpsNetInitiatedHandler.GPS_NI_RESPONSE_NORESP;
+ notification.requestorId = nfwNotification.mRequestorId;
+ notification.requestorIdEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE;
+ notification.text = mContext.getString(R.string.global_action_emergency);
+ notification.textEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE;
+ mNiHandler.setNiNotification(notification);
+ }
}
private void logEvent(NfwNotification notification, boolean isPermissionMismatched) {