diff options
8 files changed, 129 insertions, 30 deletions
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java index 560b4b31cdc6..84111fbf7f93 100644 --- a/core/java/android/os/SystemProperties.java +++ b/core/java/android/os/SystemProperties.java @@ -84,9 +84,6 @@ public class SystemProperties { /** * Get the String value for the given {@code key}. * - * <b>WARNING:</b> Do not use this method if the value may not be a valid UTF string! This - * method will crash in native code. - * * @param key the key to lookup * @return an empty string if the {@code key} isn't found */ @@ -99,9 +96,6 @@ public class SystemProperties { /** * Get the String value for the given {@code key}. * - * <b>WARNING:</b> Do not use this method if the value may not be a valid UTF string! This - * method will crash in native code. - * * @param key the key to lookup * @param def the default value in case the property is not set or empty * @return if the {@code key} isn't found, return {@code def} if it isn't null, or an empty diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl index 04f7c76c8e74..a44fd675a709 100644 --- a/core/java/com/android/internal/app/IBatteryStats.aidl +++ b/core/java/com/android/internal/app/IBatteryStats.aidl @@ -130,7 +130,7 @@ interface IBatteryStats { long getAwakeTimePlugged(); void noteBleScanStarted(in WorkSource ws, boolean isUnoptimized); - void noteBleScanStopped(in WorkSource ws); + void noteBleScanStopped(in WorkSource ws, boolean isUnoptimized); void noteResetBleScan(); void noteBleScanResults(in WorkSource ws, int numNewResults); diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 235ebc88d5e5..4b582bfd0711 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -4845,7 +4845,7 @@ public class BatteryStatsImpl extends BatteryStats { } } - private void noteBluetoothScanStoppedLocked(int uid) { + private void noteBluetoothScanStoppedLocked(int uid, boolean isUnoptimized) { uid = mapUid(uid); final long elapsedRealtime = mClocks.elapsedRealtime(); final long uptime = mClocks.uptimeMillis(); @@ -4857,13 +4857,13 @@ public class BatteryStatsImpl extends BatteryStats { addHistoryRecordLocked(elapsedRealtime, uptime); mBluetoothScanTimer.stopRunningLocked(elapsedRealtime); } - getUidStatsLocked(uid).noteBluetoothScanStoppedLocked(elapsedRealtime); + getUidStatsLocked(uid).noteBluetoothScanStoppedLocked(elapsedRealtime, isUnoptimized); } - public void noteBluetoothScanStoppedFromSourceLocked(WorkSource ws) { + public void noteBluetoothScanStoppedFromSourceLocked(WorkSource ws, boolean isUnoptimized) { final int N = ws.size(); for (int i = 0; i < N; i++) { - noteBluetoothScanStoppedLocked(ws.get(i)); + noteBluetoothScanStoppedLocked(ws.get(i), isUnoptimized); } } @@ -6114,14 +6114,11 @@ public class BatteryStatsImpl extends BatteryStats { } } - public void noteBluetoothScanStoppedLocked(long elapsedRealtimeMs) { + public void noteBluetoothScanStoppedLocked(long elapsedRealtimeMs, boolean isUnoptimized) { if (mBluetoothScanTimer != null) { mBluetoothScanTimer.stopRunningLocked(elapsedRealtimeMs); } - // In the ble code, a scan cannot change types and nested starts are not possible. - // So if an unoptimizedScan is running, it is now being stopped. - if (mBluetoothUnoptimizedScanTimer != null - && mBluetoothUnoptimizedScanTimer.isRunningLocked()) { + if (isUnoptimized && mBluetoothUnoptimizedScanTimer != null) { mBluetoothUnoptimizedScanTimer.stopRunningLocked(elapsedRealtimeMs); } } diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsBackgroundStatsTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsBackgroundStatsTest.java index c539f789ff60..c21c3be2bcbe 100644 --- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsBackgroundStatsTest.java +++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsBackgroundStatsTest.java @@ -217,10 +217,6 @@ public class BatteryStatsBackgroundStatsTest extends TestCase { curr = 1000 * (clocks.realtime = clocks.uptime = 305); bi.updateTimeBasesLocked(false, false, curr, curr); // off battery - // Stop timer - curr = 1000 * (clocks.realtime = clocks.uptime = 409); - bi.noteBluetoothScanStoppedFromSourceLocked(ws); - // Start timer (unoptimized) curr = 1000 * (clocks.realtime = clocks.uptime = 1000); bi.noteBluetoothScanStartedFromSourceLocked(ws, true); @@ -233,9 +229,13 @@ public class BatteryStatsBackgroundStatsTest extends TestCase { curr = 1000 * (clocks.realtime = clocks.uptime = 3004); bi.noteUidProcessStateLocked(UID, ActivityManager.PROCESS_STATE_TOP); - // Stop timer + // Stop timer (optimized) + curr = 1000 * (clocks.realtime = clocks.uptime = 3409); + bi.noteBluetoothScanStoppedFromSourceLocked(ws, false); + + // Stop timer (unoptimized) curr = 1000 * (clocks.realtime = clocks.uptime = 4008); - bi.noteBluetoothScanStoppedFromSourceLocked(ws); + bi.noteBluetoothScanStoppedFromSourceLocked(ws, true); // Test curr = 1000 * (clocks.realtime = clocks.uptime = 5000); diff --git a/core/tests/coretests/src/com/android/internal/os/BatteryStatsNoteTest.java b/core/tests/coretests/src/com/android/internal/os/BatteryStatsNoteTest.java index 4e8ab316e1c9..ed54f5303750 100644 --- a/core/tests/coretests/src/com/android/internal/os/BatteryStatsNoteTest.java +++ b/core/tests/coretests/src/com/android/internal/os/BatteryStatsNoteTest.java @@ -44,8 +44,6 @@ public class BatteryStatsNoteTest extends TestCase{ assertEquals(101, bi.getUidStats().get(UID).getBluetoothScanResultCounter() .getCountLocked(STATS_SINCE_CHARGED)); - // TODO: remove next line when Counter misreporting values when plugged-in bug is fixed. - bi.noteUidProcessStateLocked(UID, ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND); BatteryStats.Counter bgCntr = bi.getUidStats().get(UID).getBluetoothScanResultBgCounter(); if (bgCntr != null) { assertEquals(0, bgCntr.getCountLocked(STATS_SINCE_CHARGED)); diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java index c20221bfe4aa..deaf3b8861c8 100644 --- a/services/core/java/com/android/server/am/BatteryStatsService.java +++ b/services/core/java/com/android/server/am/BatteryStatsService.java @@ -962,10 +962,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub } @Override - public void noteBleScanStopped(WorkSource ws) { + public void noteBleScanStopped(WorkSource ws, boolean isUnoptimized) { enforceCallingPermission(); synchronized (mStats) { - mStats.noteBluetoothScanStoppedFromSourceLocked(ws); + mStats.noteBluetoothScanStoppedFromSourceLocked(ws, isUnoptimized); } } diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 7a6fbf3488bb..7d939aca4bb1 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1530,6 +1530,18 @@ public class CarrierConfigManager { public static final String KEY_DISABLE_CHARGE_INDICATION_BOOL = "disable_charge_indication_bool"; + /** + * Boolean indicating whether to skip the call forwarding (CF) fail-to-disable dialog. + * The logic used to determine whether we succeeded in disabling is carrier specific, + * so the dialog may not always be accurate. + * {@code false} - show CF fail-to-disable dialog. + * {@code true} - skip showing CF fail-to-disable dialog. + * + * @hide + */ + public static final String KEY_SKIP_CF_FAIL_TO_DISABLE_DIALOG_BOOL = + "skip_cf_fail_to_disable_dialog_bool"; + /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -1683,6 +1695,7 @@ public class CarrierConfigManager { sDefaults.putString(KEY_CARRIER_NAME_STRING, ""); sDefaults.putBoolean(KEY_SUPPORT_DIRECT_FDN_DIALING_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL, false); + sDefaults.putBoolean(KEY_SKIP_CF_FAIL_TO_DISABLE_DIALOG_BOOL, false); // MMS defaults sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false); diff --git a/telephony/java/android/telephony/NetworkScanRequest.java b/telephony/java/android/telephony/NetworkScanRequest.java index d2aef2007044..9674c9300602 100644 --- a/telephony/java/android/telephony/NetworkScanRequest.java +++ b/telephony/java/android/telephony/NetworkScanRequest.java @@ -19,6 +19,7 @@ package android.telephony; import android.os.Parcel; import android.os.Parcelable; +import java.util.ArrayList; import java.util.Arrays; /** @@ -38,6 +39,20 @@ public final class NetworkScanRequest implements Parcelable { public static final int MAX_BANDS = 8; /** @hide */ public static final int MAX_CHANNELS = 32; + /** @hide */ + public static final int MAX_MCC_MNC_LIST_SIZE = 20; + /** @hide */ + public static final int MIN_SEARCH_PERIODICITY_SEC = 5; + /** @hide */ + public static final int MAX_SEARCH_PERIODICITY_SEC = 300; + /** @hide */ + public static final int MIN_SEARCH_MAX_SEC = 60; + /** @hide */ + public static final int MAX_SEARCH_MAX_SEC = 3600; + /** @hide */ + public static final int MIN_INCREMENTAL_PERIODICITY_SEC = 1; + /** @hide */ + public static final int MAX_INCREMENTAL_PERIODICITY_SEC = 10; /** Performs the scan only once */ public static final int SCAN_TYPE_ONE_SHOT = 0; @@ -46,24 +61,84 @@ public final class NetworkScanRequest implements Parcelable { * * The modem will start new scans periodically, and the interval between two scans is usually * multiple minutes. - * */ + */ public static final int SCAN_TYPE_PERIODIC = 1; /** Defines the type of the scan. */ public int scanType; + /** + * Search periodicity (in seconds). + * Expected range for the input is [5s - 300s] + * This value must be less than or equal to maxSearchTime + */ + public int searchPeriodicity; + + /** + * Maximum duration of the periodic search (in seconds). + * Expected range for the input is [60s - 3600s] + * If the search lasts this long, it will be terminated. + */ + public int maxSearchTime; + + /** + * Indicates whether the modem should report incremental + * results of the network scan to the client. + * FALSE – Incremental results are not reported. + * TRUE (default) – Incremental results are reported + */ + public boolean incrementalResults; + + /** + * Indicates the periodicity with which the modem should + * report incremental results to the client (in seconds). + * Expected range for the input is [1s - 10s] + * This value must be less than or equal to maxSearchTime + */ + public int incrementalResultsPeriodicity; + /** Describes the radio access technologies with bands or channels that need to be scanned. */ public RadioAccessSpecifier[] specifiers; /** + * Describes the List of PLMN ids (MCC-MNC) + * If any PLMN of this list is found, search should end at that point and + * results with all PLMN found till that point should be sent as response. + * If list not sent, search to be completed till end and all PLMNs found to be reported. + * Max size of array is MAX_MCC_MNC_LIST_SIZE + */ + public ArrayList<String> mccMncs; + + /** * Creates a new NetworkScanRequest with scanType and network specifiers * * @param scanType The type of the scan * @param specifiers the radio network with bands / channels to be scanned + * @param searchPeriodicity Search periodicity (in seconds) + * @param maxSearchTime Maximum duration of the periodic search (in seconds) + * @param incrementalResults Indicates whether the modem should report incremental + * results of the network scan to the client + * @param incrementalResultsPeriodicity Indicates the periodicity with which the modem should + * report incremental results to the client (in seconds) + * @param mccMncs Describes the List of PLMN ids (MCC-MNC) */ - public NetworkScanRequest(int scanType, RadioAccessSpecifier[] specifiers) { + public NetworkScanRequest(int scanType, RadioAccessSpecifier[] specifiers, + int searchPeriodicity, + int maxSearchTime, + boolean incrementalResults, + int incrementalResultsPeriodicity, + ArrayList<String> mccMncs) { this.scanType = scanType; this.specifiers = specifiers; + this.searchPeriodicity = searchPeriodicity; + this.maxSearchTime = maxSearchTime; + this.incrementalResults = incrementalResults; + this.incrementalResultsPeriodicity = incrementalResultsPeriodicity; + if (mccMncs != null) { + this.mccMncs = mccMncs; + } else { + this.mccMncs = new ArrayList<>(); + } } @Override @@ -75,6 +150,11 @@ public final class NetworkScanRequest implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeInt(scanType); dest.writeParcelableArray(specifiers, flags); + dest.writeInt(searchPeriodicity); + dest.writeInt(maxSearchTime); + dest.writeBoolean(incrementalResults); + dest.writeInt(incrementalResultsPeriodicity); + dest.writeStringList(mccMncs); } private NetworkScanRequest(Parcel in) { @@ -82,6 +162,12 @@ public final class NetworkScanRequest implements Parcelable { specifiers = (RadioAccessSpecifier[]) in.readParcelableArray( Object.class.getClassLoader(), RadioAccessSpecifier.class); + searchPeriodicity = in.readInt(); + maxSearchTime = in.readInt(); + incrementalResults = in.readBoolean(); + incrementalResultsPeriodicity = in.readInt(); + mccMncs = new ArrayList<>(); + in.readStringList(mccMncs); } @Override @@ -99,13 +185,24 @@ public final class NetworkScanRequest implements Parcelable { } return (scanType == nsr.scanType - && Arrays.equals(specifiers, nsr.specifiers)); + && Arrays.equals(specifiers, nsr.specifiers) + && searchPeriodicity == nsr.searchPeriodicity + && maxSearchTime == nsr.maxSearchTime + && incrementalResults == nsr.incrementalResults + && incrementalResultsPeriodicity == nsr.incrementalResultsPeriodicity + && (((mccMncs != null) + && mccMncs.equals(nsr.mccMncs)))); } @Override public int hashCode () { return ((scanType * 31) - + (Arrays.hashCode(specifiers)) * 37); + + (Arrays.hashCode(specifiers)) * 37 + + (searchPeriodicity * 41) + + (maxSearchTime * 43) + + ((incrementalResults == true? 1 : 0) * 47) + + (incrementalResultsPeriodicity * 53) + + (mccMncs.hashCode() * 59)); } public static final Creator<NetworkScanRequest> CREATOR = |