Notify CellLocation whenever ACTION_USER_SWITCHED
Notify device's cell location when ACTION_USER_SWITCHED even though no changes. And 1st arg of notifyCellLocationForSubscriber() shall be subId instead. Bug: 177495399 Test: atest TelephonyRegistryTest Signed-off-by: Taesu Lee <taesu82.lee@samsung.com> Change-Id: I6761c4bb500da1748119f9917663dae0307ab437 (cherry picked from commit 4619a6dbb9ea8909e35498f9076e36afb4c207ea)
This commit is contained in:
@@ -61,7 +61,6 @@ interface ITelephonyRegistry {
|
||||
void notifyDataConnectionForSubscriber(
|
||||
int phoneId, int subId, in PreciseDataConnectionState preciseState);
|
||||
// Uses CellIdentity which is Parcelable here; will convert to CellLocation in client.
|
||||
void notifyCellLocation(in CellIdentity cellLocation);
|
||||
void notifyCellLocationForSubscriber(in int subId, in CellIdentity cellLocation);
|
||||
@UnsupportedAppUsage
|
||||
void notifyCellInfo(in List<CellInfo> cellInfo);
|
||||
|
||||
@@ -402,10 +402,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
switch (msg.what) {
|
||||
case MSG_USER_SWITCHED: {
|
||||
if (VDBG) log("MSG_USER_SWITCHED userId=" + msg.arg1);
|
||||
int numPhones = getTelephonyManager().getPhoneCount();
|
||||
for (int sub = 0; sub < numPhones; sub++) {
|
||||
TelephonyRegistry.this.notifyCellLocationForSubscriber(sub,
|
||||
mCellIdentity[sub]);
|
||||
int numPhones = getTelephonyManager().getActiveModemCount();
|
||||
for (int phoneId = 0; phoneId < numPhones; phoneId++) {
|
||||
int[] subIds = SubscriptionManager.getSubId(phoneId);
|
||||
int subId =
|
||||
(subIds != null) && (subIds.length > 0)
|
||||
? subIds[0]
|
||||
: SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
|
||||
TelephonyRegistry.this.notifyCellLocationForSubscriber(
|
||||
subId, mCellIdentity[phoneId], true /* hasUserSwitched */);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1908,20 +1913,20 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyCellLocation(CellIdentity cellLocation) {
|
||||
notifyCellLocationForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, cellLocation);
|
||||
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellIdentity) {
|
||||
notifyCellLocationForSubscriber(subId, cellIdentity, false /* hasUserSwitched */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyCellLocationForSubscriber(int subId, CellIdentity cellIdentity) {
|
||||
log("notifyCellLocationForSubscriber: subId=" + subId
|
||||
+ " cellIdentity=" + cellIdentity);
|
||||
private void notifyCellLocationForSubscriber(int subId, CellIdentity cellIdentity,
|
||||
boolean hasUserSwitched) {
|
||||
log("notifyCellLocationForSubscriber: subId=" + subId + " cellIdentity=" + cellIdentity);
|
||||
if (!checkNotifyPermission("notifyCellLocation()")) {
|
||||
return;
|
||||
}
|
||||
int phoneId = getPhoneIdFromSubId(subId);
|
||||
synchronized (mRecords) {
|
||||
if (validatePhoneId(phoneId) && !Objects.equals(cellIdentity, mCellIdentity[phoneId])) {
|
||||
if (validatePhoneId(phoneId)
|
||||
&& (hasUserSwitched || !Objects.equals(cellIdentity, mCellIdentity[phoneId]))) {
|
||||
mCellIdentity[phoneId] = cellIdentity;
|
||||
for (Record r : mRecords) {
|
||||
if (validateEventAndUserLocked(
|
||||
@@ -2558,7 +2563,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
final int recordCount = mRecords.size();
|
||||
pw.println("last known state:");
|
||||
pw.increaseIndent();
|
||||
for (int i = 0; i < getTelephonyManager().getPhoneCount(); i++) {
|
||||
for (int i = 0; i < getTelephonyManager().getActiveModemCount(); i++) {
|
||||
pw.println("Phone Id=" + i);
|
||||
pw.increaseIndent();
|
||||
pw.println("mCallState=" + mCallState[i]);
|
||||
|
||||
Reference in New Issue
Block a user