summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/provider/CallLog.java30
-rw-r--r--core/res/res/values-mcc310-mnc030/strings.xml23
l---------core/res/res/values-mcc310-mnc1701
-rw-r--r--core/res/res/values-mcc310-mnc170/strings.xml23
-rw-r--r--core/res/res/values-mcc310-mnc280/strings.xml23
l---------core/res/res/values-mcc310-mnc3801
-rw-r--r--core/res/res/values-mcc310-mnc380/strings.xml23
-rw-r--r--core/res/res/values-mcc310-mnc410/strings.xml23
-rw-r--r--core/res/res/values-mcc310-mnc560/strings.xml23
-rw-r--r--core/res/res/values-mcc310-mnc950/strings.xml23
-rw-r--r--core/res/res/values-mcc311-mnc180/strings.xml23
-rw-r--r--media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java4
-rw-r--r--packages/SystemUI/AndroidManifest.xml1
-rw-r--r--services/core/java/com/android/server/IpSecService.java99
-rw-r--r--services/core/java/com/android/server/NetworkManagementService.java117
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java15
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java12
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsMessage.java12
18 files changed, 397 insertions, 79 deletions
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index c7c6ceb5c16d..3ed335cfd0a6 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -849,10 +849,34 @@ public class CallLog {
}
try {
+ // When cleaning up the call log, try to delete older call long entries on a per
+ // PhoneAccount basis first. There can be multiple ConnectionServices causing
+ // the addition of entries in the call log. With the introduction of Self-Managed
+ // ConnectionServices, we want to ensure that a misbehaving self-managed CS cannot
+ // spam the call log with its own entries, causing entries from Telephony to be
+ // removed.
final Uri result = resolver.insert(uri, values);
- resolver.delete(uri, "_id IN " +
- "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
- + " LIMIT -1 OFFSET 500)", null);
+ if (values.containsKey(PHONE_ACCOUNT_ID)
+ && !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_ID))
+ && values.containsKey(PHONE_ACCOUNT_COMPONENT_NAME)
+ && !TextUtils.isEmpty(values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME))) {
+ // Only purge entries for the same phone account.
+ resolver.delete(uri, "_id IN " +
+ "(SELECT _id FROM calls"
+ + " WHERE " + PHONE_ACCOUNT_COMPONENT_NAME + " = ?"
+ + " AND " + PHONE_ACCOUNT_ID + " = ?"
+ + " ORDER BY " + DEFAULT_SORT_ORDER
+ + " LIMIT -1 OFFSET 500)", new String[] {
+ values.getAsString(PHONE_ACCOUNT_COMPONENT_NAME),
+ values.getAsString(PHONE_ACCOUNT_ID)
+ });
+ } else {
+ // No valid phone account specified, so default to the old behavior.
+ resolver.delete(uri, "_id IN " +
+ "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
+ + " LIMIT -1 OFFSET 500)", null);
+ }
+
return result;
} catch (IllegalArgumentException e) {
Log.w(LOG_TAG, "Failed to insert calllog", e);
diff --git a/core/res/res/values-mcc310-mnc030/strings.xml b/core/res/res/values-mcc310-mnc030/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc030/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc170 b/core/res/res/values-mcc310-mnc170
deleted file mode 120000
index cfced1756742..000000000000
--- a/core/res/res/values-mcc310-mnc170
+++ /dev/null
@@ -1 +0,0 @@
-./values-mcc310-mnc150 \ No newline at end of file
diff --git a/core/res/res/values-mcc310-mnc170/strings.xml b/core/res/res/values-mcc310-mnc170/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc170/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc280/strings.xml b/core/res/res/values-mcc310-mnc280/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc280/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc380 b/core/res/res/values-mcc310-mnc380
deleted file mode 120000
index cfced1756742..000000000000
--- a/core/res/res/values-mcc310-mnc380
+++ /dev/null
@@ -1 +0,0 @@
-./values-mcc310-mnc150 \ No newline at end of file
diff --git a/core/res/res/values-mcc310-mnc380/strings.xml b/core/res/res/values-mcc310-mnc380/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc380/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc410/strings.xml b/core/res/res/values-mcc310-mnc410/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc410/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc560/strings.xml b/core/res/res/values-mcc310-mnc560/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc560/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc310-mnc950/strings.xml b/core/res/res/values-mcc310-mnc950/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc310-mnc950/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/core/res/res/values-mcc311-mnc180/strings.xml b/core/res/res/values-mcc311-mnc180/strings.xml
new file mode 100644
index 000000000000..a3fea29070f5
--- /dev/null
+++ b/core/res/res/values-mcc311-mnc180/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="mmcc_imsi_unknown_in_hlr">SIM not provisioned MM#2</string>
+ <string name="mmcc_illegal_ms">SIM not allowed MM#3</string>
+</resources>
diff --git a/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java b/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
index 2ff65889e1ac..e0dbd571d560 100644
--- a/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/imageproc/FisheyeFilter.java
@@ -49,6 +49,8 @@ public class FisheyeFilter extends Filter {
private int mHeight = 0;
private int mTarget = FrameFormat.TARGET_UNSPECIFIED;
+ // The constant min_dist, below, is an arbitrary number that gives good enough precision in
+ // the center of the picture without affecting the fisheye effect noticeably.
private static final String mFisheyeShader =
"precision mediump float;\n" +
"uniform sampler2D tex_sampler_0;\n" +
@@ -59,8 +61,10 @@ public class FisheyeFilter extends Filter {
"varying vec2 v_texcoord;\n" +
"void main() {\n" +
" const float m_pi_2 = 1.570963;\n" +
+ " const float min_dist = 0.01;\n" +
" vec2 coord = v_texcoord - vec2(0.5, 0.5);\n" +
" float dist = length(coord * scale);\n" +
+ " dist = max(dist, min_dist);\n" +
" float radian = m_pi_2 - atan(alpha * sqrt(radius2 - dist * dist), dist);\n" +
" float scalar = radian * factor / dist;\n" +
" vec2 new_coord = coord * scalar + vec2(0.5, 0.5);\n" +
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 3ee844cd8ef2..8005ea7a33a8 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -358,6 +358,7 @@
android:finishOnCloseSystemDialogs="true"
android:launchMode="singleTop"
android:taskAffinity="com.android.systemui.net"
+ android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:excludeFromRecents="true" />
<!-- started from MediaProjectionManager -->
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index 3fec6ad8fa40..ab7daccb0691 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -115,6 +115,67 @@ public class IpSecService extends IIpSecService.Stub {
private final IpSecServiceConfiguration mSrvConfig;
+ /* Very simple counting class that looks much like a counting semaphore */
+ public static class ResourceTracker {
+ private final int mMax;
+ int mCurrent;
+
+ ResourceTracker(int max) {
+ mMax = max;
+ mCurrent = 0;
+ }
+
+ synchronized boolean isAvailable() {
+ return (mCurrent < mMax);
+ }
+
+ synchronized void take() {
+ if (!isAvailable()) {
+ Log.wtf(TAG, "Too many resources allocated!");
+ }
+ mCurrent++;
+ }
+
+ synchronized void give() {
+ if (mCurrent <= 0) {
+ Log.wtf(TAG, "We've released this resource too many times");
+ }
+ mCurrent--;
+ }
+ }
+
+ private static final class UserQuotaTracker {
+ /* Maximum number of UDP Encap Sockets that a single UID may possess */
+ public static final int MAX_NUM_ENCAP_SOCKETS = 2;
+
+ /* Maximum number of IPsec Transforms that a single UID may possess */
+ public static final int MAX_NUM_TRANSFORMS = 4;
+
+ /* Maximum number of IPsec Transforms that a single UID may possess */
+ public static final int MAX_NUM_SPIS = 8;
+
+ /* Record for one users's IpSecService-managed objects */
+ public static class UserRecord {
+ public final ResourceTracker socket = new ResourceTracker(MAX_NUM_ENCAP_SOCKETS);
+ public final ResourceTracker transform = new ResourceTracker(MAX_NUM_TRANSFORMS);
+ public final ResourceTracker spi = new ResourceTracker(MAX_NUM_SPIS);
+ }
+
+ private final SparseArray<UserRecord> mUserRecords = new SparseArray<>();
+
+ /* a never-fail getter so that we can populate the list of UIDs as-needed */
+ public synchronized UserRecord getUserRecord(int uid) {
+ UserRecord r = mUserRecords.get(uid);
+ if (r == null) {
+ r = new UserRecord();
+ mUserRecords.put(uid, r);
+ }
+ return r;
+ }
+ }
+
+ private final UserQuotaTracker mUserQuotaTracker = new UserQuotaTracker();
+
/**
* The ManagedResource class provides a facility to cleanly and reliably release system
* resources. It relies on two things: an IBinder that allows ManagedResource to automatically
@@ -132,11 +193,15 @@ public class IpSecService extends IIpSecService.Stub {
ManagedResource(int resourceId, IBinder binder) {
super();
+ if (resourceId == INVALID_RESOURCE_ID) {
+ throw new IllegalArgumentException("Resource ID must not be INVALID_RESOURCE_ID");
+ }
mBinder = binder;
mResourceId = resourceId;
pid = Binder.getCallingPid();
uid = Binder.getCallingUid();
+ getResourceTracker().take();
try {
mBinder.linkToDeath(this, 0);
} catch (RemoteException e) {
@@ -184,6 +249,7 @@ public class IpSecService extends IIpSecService.Stub {
}
releaseResources();
+ getResourceTracker().give();
if (mBinder != null) {
mBinder.unlinkToDeath(this, 0);
}
@@ -215,6 +281,9 @@ public class IpSecService extends IIpSecService.Stub {
*/
protected abstract void releaseResources() throws RemoteException;
+ /** Get the resource tracker for this resource */
+ protected abstract ResourceTracker getResourceTracker();
+
@Override
public String toString() {
return new StringBuilder()
@@ -330,6 +399,10 @@ public class IpSecService extends IIpSecService.Stub {
}
}
+ protected ResourceTracker getResourceTracker() {
+ return mUserQuotaTracker.getUserRecord(this.uid).transform;
+ }
+
@Override
public String toString() {
StringBuilder strBuilder = new StringBuilder();
@@ -398,6 +471,11 @@ public class IpSecService extends IIpSecService.Stub {
mSpi = IpSecManager.INVALID_SECURITY_PARAMETER_INDEX;
}
+ @Override
+ protected ResourceTracker getResourceTracker() {
+ return mUserQuotaTracker.getUserRecord(this.uid).spi;
+ }
+
public int getSpi() {
return mSpi;
}
@@ -450,6 +528,11 @@ public class IpSecService extends IIpSecService.Stub {
mSocket = null;
}
+ @Override
+ protected ResourceTracker getResourceTracker() {
+ return mUserQuotaTracker.getUserRecord(this.uid).socket;
+ }
+
public int getPort() {
return mPort;
}
@@ -535,7 +618,14 @@ public class IpSecService extends IIpSecService.Stub {
int spi = IpSecManager.INVALID_SECURITY_PARAMETER_INDEX;
String localAddress = "";
+
try {
+ if (!mUserQuotaTracker.getUserRecord(Binder.getCallingUid()).spi.isAvailable()) {
+ return new IpSecSpiResponse(
+ IpSecManager.Status.RESOURCE_UNAVAILABLE,
+ INVALID_RESOURCE_ID,
+ spi);
+ }
spi =
mSrvConfig
.getNetdInstance()
@@ -552,7 +642,7 @@ public class IpSecService extends IIpSecService.Stub {
} catch (ServiceSpecificException e) {
// TODO: Add appropriate checks when other ServiceSpecificException types are supported
return new IpSecSpiResponse(
- IpSecManager.Status.SPI_UNAVAILABLE, IpSecManager.INVALID_RESOURCE_ID, spi);
+ IpSecManager.Status.SPI_UNAVAILABLE, INVALID_RESOURCE_ID, spi);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -635,6 +725,10 @@ public class IpSecService extends IIpSecService.Stub {
int resourceId = mNextResourceId.getAndIncrement();
FileDescriptor sockFd = null;
try {
+ if (!mUserQuotaTracker.getUserRecord(Binder.getCallingUid()).socket.isAvailable()) {
+ return new IpSecUdpEncapResponse(IpSecManager.Status.RESOURCE_UNAVAILABLE);
+ }
+
sockFd = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (port != 0) {
@@ -679,6 +773,9 @@ public class IpSecService extends IIpSecService.Stub {
public synchronized IpSecTransformResponse createTransportModeTransform(
IpSecConfig c, IBinder binder) throws RemoteException {
int resourceId = mNextResourceId.getAndIncrement();
+ if (!mUserQuotaTracker.getUserRecord(Binder.getCallingUid()).transform.isAvailable()) {
+ return new IpSecTransformResponse(IpSecManager.Status.RESOURCE_UNAVAILABLE);
+ }
SpiRecord[] spis = new SpiRecord[DIRECTIONS.length];
// TODO: Basic input validation here since it's coming over the Binder
int encapType, encapLocalPort = 0, encapRemotePort = 0;
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index aaec642ab4e2..097202b9b0a9 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -64,6 +64,7 @@ import android.net.NetworkStats;
import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.net.UidRange;
+import android.net.util.NetdService;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiConfiguration.KeyMgmt;
import android.os.BatteryStats;
@@ -340,7 +341,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub
if (DBG) Slog.d(TAG, "Awaiting socket connection");
connectedSignal.await();
if (DBG) Slog.d(TAG, "Connected");
+ if (DBG) Slog.d(TAG, "Connecting native netd service");
service.connectNativeNetdService();
+ if (DBG) Slog.d(TAG, "Connected");
return service;
}
@@ -549,14 +552,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
private void connectNativeNetdService() {
- boolean nativeServiceAvailable = false;
- try {
- mNetdService = INetd.Stub.asInterface(ServiceManager.getService(NETD_SERVICE_NAME));
- nativeServiceAvailable = mNetdService.isAlive();
- } catch (RemoteException e) {}
- if (!nativeServiceAvailable) {
- Slog.wtf(TAG, "Can't connect to NativeNetdService " + NETD_SERVICE_NAME);
- }
+ mNetdService = NetdService.get();
}
/**
@@ -569,36 +565,30 @@ public class NetworkManagementService extends INetworkManagementService.Stub
// only enable bandwidth control when support exists
final boolean hasKernelSupport = new File("/proc/net/xt_qtaguid/ctrl").exists();
- if (hasKernelSupport) {
- Slog.d(TAG, "enabling bandwidth control");
- try {
- mConnector.execute("bandwidth", "enable");
- mBandwidthControlEnabled = true;
- } catch (NativeDaemonConnectorException e) {
- Log.wtf(TAG, "problem enabling bandwidth controls", e);
- }
- } else {
- Slog.i(TAG, "not enabling bandwidth control");
- }
- SystemProperties.set(PROP_QTAGUID_ENABLED, mBandwidthControlEnabled ? "1" : "0");
+ // push any existing quota or UID rules
+ synchronized (mQuotaLock) {
- if (mBandwidthControlEnabled) {
- try {
- getBatteryStats().noteNetworkStatsEnabled();
- } catch (RemoteException e) {
+ if (hasKernelSupport) {
+ Slog.d(TAG, "enabling bandwidth control");
+ try {
+ mConnector.execute("bandwidth", "enable");
+ mBandwidthControlEnabled = true;
+ } catch (NativeDaemonConnectorException e) {
+ Log.wtf(TAG, "problem enabling bandwidth controls", e);
+ }
+ } else {
+ Slog.i(TAG, "not enabling bandwidth control");
}
- }
- try {
- mConnector.execute("strict", "enable");
- mStrictEnabled = true;
- } catch (NativeDaemonConnectorException e) {
- Log.wtf(TAG, "Failed strict enable", e);
- }
+ SystemProperties.set(PROP_QTAGUID_ENABLED, mBandwidthControlEnabled ? "1" : "0");
- // push any existing quota or UID rules
- synchronized (mQuotaLock) {
+ try {
+ mConnector.execute("strict", "enable");
+ mStrictEnabled = true;
+ } catch (NativeDaemonConnectorException e) {
+ Log.wtf(TAG, "Failed strict enable", e);
+ }
setDataSaverModeEnabled(mDataSaverMode);
@@ -672,6 +662,14 @@ public class NetworkManagementService extends INetworkManagementService.Stub
setFirewallChainEnabled(FIREWALL_CHAIN_POWERSAVE, true);
}
}
+
+ if (mBandwidthControlEnabled) {
+ try {
+ getBatteryStats().noteNetworkStatsEnabled();
+ } catch (RemoteException e) {
+ }
+ }
+
}
/**
@@ -1716,6 +1714,30 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
}
+ private void applyUidCleartextNetworkPolicy(int uid, int policy) {
+ final String policyString;
+ switch (policy) {
+ case StrictMode.NETWORK_POLICY_ACCEPT:
+ policyString = "accept";
+ break;
+ case StrictMode.NETWORK_POLICY_LOG:
+ policyString = "log";
+ break;
+ case StrictMode.NETWORK_POLICY_REJECT:
+ policyString = "reject";
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown policy " + policy);
+ }
+
+ try {
+ mConnector.execute("strict", "set_uid_cleartext_policy", uid, policyString);
+ mUidCleartextPolicy.put(uid, policy);
+ } catch (NativeDaemonConnectorException e) {
+ throw e.rethrowAsParcelableException();
+ }
+ }
+
@Override
public void setUidCleartextNetworkPolicy(int uid, int policy) {
if (Binder.getCallingUid() != uid) {
@@ -1725,6 +1747,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub
synchronized (mQuotaLock) {
final int oldPolicy = mUidCleartextPolicy.get(uid, StrictMode.NETWORK_POLICY_ACCEPT);
if (oldPolicy == policy) {
+ // This also ensures we won't needlessly apply an ACCEPT policy if we've just
+ // enabled strict and the underlying iptables rules are empty.
return;
}
@@ -1735,28 +1759,15 @@ public class NetworkManagementService extends INetworkManagementService.Stub
return;
}
- final String policyString;
- switch (policy) {
- case StrictMode.NETWORK_POLICY_ACCEPT:
- policyString = "accept";
- break;
- case StrictMode.NETWORK_POLICY_LOG:
- policyString = "log";
- break;
- case StrictMode.NETWORK_POLICY_REJECT:
- policyString = "reject";
- break;
- default:
- throw new IllegalArgumentException("Unknown policy " + policy);
- }
-
- try {
- mConnector.execute("strict", "set_uid_cleartext_policy", uid, policyString);
- mUidCleartextPolicy.put(uid, policy);
- } catch (NativeDaemonConnectorException e) {
- throw e.rethrowAsParcelableException();
+ // netd does not keep state on strict mode policies, and cannot replace a non-accept
+ // policy without deleting it first. Rather than add state to netd, just always send
+ // it an accept policy when switching between two non-accept policies.
+ if (oldPolicy != StrictMode.NETWORK_POLICY_ACCEPT &&
+ policy != StrictMode.NETWORK_POLICY_ACCEPT) {
+ applyUidCleartextNetworkPolicy(uid, policy);
}
}
+ applyUidCleartextNetworkPolicy(uid, policy);
}
@Override
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index ecfdbaa73556..eb53d4b61ffb 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -880,13 +880,6 @@ public class CarrierConfigManager {
"broadcast_emergency_call_state_changes_bool";
/**
- * Cell broadcast additional channels enbled by the carrier
- * @hide
- */
- public static final String KEY_CARRIER_ADDITIONAL_CBS_CHANNELS_STRINGS =
- "carrier_additional_cbs_channels_strings";
-
- /**
* Indicates whether STK LAUNCH_BROWSER command is disabled.
* If {@code true}, then the browser will not be launched
* on UI for the LAUNCH_BROWSER STK command.
@@ -1056,6 +1049,13 @@ public class CarrierConfigManager {
"carrier_app_no_wake_signal_config";
/**
+ * Default value for {@link Settings.Global#DATA_ROAMING}
+ * @hide
+ */
+ public static final String KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL =
+ "carrier_default_data_roaming_enabled_bool";
+
+ /**
* Determines whether the carrier supports making non-emergency phone calls while the phone is
* in emergency callback mode. Default value is {@code true}, meaning that non-emergency calls
* are allowed in emergency callback mode.
@@ -1537,6 +1537,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_CARRIER_NAME_OVERRIDE_BOOL, false);
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);
// MMS defaults
sDefaults.putBoolean(KEY_MMS_ALIAS_ENABLED_BOOL, false);
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java b/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
index bce5680b2863..f28d1263d13a 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsCbConstants.java
@@ -34,18 +34,6 @@ public class SmsCbConstants {
public static final int MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_50
= 0x0032;
- /** Channel 911 required by Taiwan NCC. ID 0~999 is allocated by GSMA */
- public static final int MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_911
- = 0x038F; // 911
-
- /** Channel 919 required by Taiwan NCC and Israel. ID 0~999 is allocated by GSMA */
- public static final int MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_919
- = 0x0397; // 919
-
- /** Channel 928 required by Israel. ID 0~999 is allocated by GSMA */
- public static final int MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_928
- = 0x03A0; // 928
-
/** Start of PWS Message Identifier range (includes ETWS and CMAS). */
public static final int MESSAGE_ID_PWS_FIRST_IDENTIFIER
= 0x1100; // 4352
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
index 582506a367d0..d4098d94ba6c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -278,6 +278,10 @@ public class SmsMessage extends SmsMessageBase {
scAddress, destinationAddress, mtiByte,
statusReportRequested, ret);
+ // Skip encoding pdu if error occurs when create pdu head and the error will be handled
+ // properly later on encodedMessage sanity check.
+ if (bo == null) return ret;
+
// User Data (and length)
byte[] userData;
try {
@@ -420,6 +424,9 @@ public class SmsMessage extends SmsMessageBase {
scAddress, destinationAddress, (byte) 0x41, // MTI = SMS-SUBMIT,
// TP-UDHI = true
statusReportRequested, ret);
+ // Skip encoding pdu if error occurs when create pdu head and the error will be handled
+ // properly later on encodedMessage sanity check.
+ if (bo == null) return ret;
// TP-Data-Coding-Scheme
// No class, 8 bit data
@@ -451,7 +458,7 @@ public class SmsMessage extends SmsMessageBase {
* @param destinationAddress the address of the destination for the message
* @param mtiByte
* @param ret <code>SubmitPdu</code> containing the encoded SC
- * address, if applicable, and the encoded message
+ * address, if applicable, and the encoded message. Returns null on encode error.
*/
private static ByteArrayOutputStream getSubmitPduHead(
String scAddress, String destinationAddress, byte mtiByte,
@@ -482,6 +489,9 @@ public class SmsMessage extends SmsMessageBase {
daBytes = PhoneNumberUtils.networkPortionToCalledPartyBCD(destinationAddress);
+ // return empty pduHead for invalid destination address
+ if (daBytes == null) return null;
+
// destination address length in BCD digits, ignoring TON byte and pad
// TODO Should be better.
bo.write((daBytes.length - 1) * 2