Merge "Avoid preloading classes for boot image profiling"
diff --git a/Android.bp b/Android.bp
index 2f8bf75..a913324 100644
--- a/Android.bp
+++ b/Android.bp
@@ -511,6 +511,12 @@
],
}
+filegroup {
+ name: "framework-tethering-shared-srcs",
+ srcs: [
+ "core/java/android/util/LocalLog.java",
+ ],
+}
// Build ext.jar
// ============================================================
java_library {
diff --git a/api/current.txt b/api/current.txt
index 402fe89..0c60fc1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -45055,6 +45055,7 @@
method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler);
method public void sendVisualVoicemailSms(String, int, String, android.app.PendingIntent);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>);
method public boolean setLine1NumberForDisplay(String, String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String, boolean);
diff --git a/api/system-current.txt b/api/system-current.txt
index b81dec0..88783e0 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7202,6 +7202,13 @@
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CallQuality> CREATOR;
}
+ public class CallerInfo {
+ method @Nullable public android.net.Uri getContactDisplayPhotoUri();
+ method public long getContactId();
+ method @Nullable public String getName();
+ method @Nullable public String getPhoneNumber();
+ }
+
public class CarrierConfigManager {
method @NonNull public static android.os.PersistableBundle getDefaultConfig();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void overrideConfig(int, @Nullable android.os.PersistableBundle);
@@ -8026,7 +8033,7 @@
}
public final class SmsCbMessage implements android.os.Parcelable {
- ctor public SmsCbMessage(int, int, int, @NonNull android.telephony.SmsCbLocation, int, @Nullable String, @Nullable String, int, @Nullable android.telephony.SmsCbEtwsInfo, @Nullable android.telephony.SmsCbCmasInfo);
+ ctor public SmsCbMessage(int, int, int, @NonNull android.telephony.SmsCbLocation, int, @Nullable String, @Nullable String, int, @Nullable android.telephony.SmsCbEtwsInfo, @Nullable android.telephony.SmsCbCmasInfo, int);
method @NonNull public static android.telephony.SmsCbMessage createFromCursor(@NonNull android.database.Cursor);
method public int describeContents();
method @Nullable public android.telephony.SmsCbCmasInfo getCmasWarningInfo();
@@ -8041,6 +8048,7 @@
method public long getReceivedTime();
method public int getSerialNumber();
method public int getServiceCategory();
+ method public int getSlotIndex();
method public boolean isCmasMessage();
method public boolean isEmergencyMessage();
method public boolean isEtwsMessage();
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 1572114..f476fcf 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -546,16 +546,16 @@
;
android_log_list_element elem;
- lastTimestamp.tv_sec = msg.entry_v1.sec;
- lastTimestamp.tv_nsec = msg.entry_v1.nsec;
+ lastTimestamp.tv_sec = msg.entry.sec;
+ lastTimestamp.tv_nsec = msg.entry.nsec;
// format a BinaryLogEntry
uint64_t token = proto.start(LogProto::BINARY_LOGS);
- proto.write(BinaryLogEntry::SEC, msg.entry_v1.sec);
- proto.write(BinaryLogEntry::NANOSEC, msg.entry_v1.nsec);
- proto.write(BinaryLogEntry::UID, (int)msg.entry_v4.uid);
- proto.write(BinaryLogEntry::PID, msg.entry_v1.pid);
- proto.write(BinaryLogEntry::TID, msg.entry_v1.tid);
+ proto.write(BinaryLogEntry::SEC, (int32_t)msg.entry.sec);
+ proto.write(BinaryLogEntry::NANOSEC, (int32_t)msg.entry.nsec);
+ proto.write(BinaryLogEntry::UID, (int)msg.entry.uid);
+ proto.write(BinaryLogEntry::PID, msg.entry.pid);
+ proto.write(BinaryLogEntry::TID, (int32_t)msg.entry.tid);
proto.write(BinaryLogEntry::TAG_INDEX,
get4LE(reinterpret_cast<uint8_t const*>(msg.msg())));
do {
@@ -603,7 +603,7 @@
}
} else {
AndroidLogEntry entry;
- err = android_log_processLogBuffer(&msg.entry_v1, &entry);
+ err = android_log_processLogBuffer(&msg.entry, &entry);
if (err != NO_ERROR) {
ALOGW("[%s] fails to process to an entry.\n", this->name.string());
break;
diff --git a/cmds/statsd/benchmark/log_event_benchmark.cpp b/cmds/statsd/benchmark/log_event_benchmark.cpp
index 43addc2..2603469 100644
--- a/cmds/statsd/benchmark/log_event_benchmark.cpp
+++ b/cmds/statsd/benchmark/log_event_benchmark.cpp
@@ -54,9 +54,9 @@
write4Bytes(99 /* a value to log*/, &buffer);
buffer.push_back(EVENT_TYPE_LIST_STOP);
- msg->entry_v1.len = buffer.size();
+ msg->entry.len = buffer.size();
msg->entry.hdr_size = kLogMsgHeaderSize;
- msg->entry_v1.sec = time(nullptr);
+ msg->entry.sec = time(nullptr);
std::copy(buffer.begin(), buffer.end(), msg->buf + kLogMsgHeaderSize);
}
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index 0ade5311..838561e 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -38,8 +38,8 @@
LogEvent::LogEvent(log_msg& msg) {
mContext =
create_android_log_parser(msg.msg() + sizeof(uint32_t), msg.len() - sizeof(uint32_t));
- mLogdTimestampNs = msg.entry_v1.sec * NS_PER_SEC + msg.entry_v1.nsec;
- mLogUid = msg.entry_v4.uid;
+ mLogdTimestampNs = msg.entry.sec * NS_PER_SEC + msg.entry.nsec;
+ mLogUid = msg.entry.uid;
init(mContext);
if (mContext) {
// android_log_destroy will set mContext to NULL
diff --git a/config/dirty-image-objects b/config/dirty-image-objects
index ec2568d..2dfe019 100644
--- a/config/dirty-image-objects
+++ b/config/dirty-image-objects
@@ -255,7 +255,7 @@
com.android.internal.policy.DecorView
com.android.internal.statusbar.IStatusBarService
com.android.internal.telephony.AppSmsManager
-com.android.internal.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
+android.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
com.android.internal.telephony.CarrierActionAgent
com.android.internal.telephony.cat.CatService
com.android.internal.telephony.cat.IconLoader
diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt
index e8b2648..3e00bfe 100644
--- a/config/hiddenapi-greylist.txt
+++ b/config/hiddenapi-greylist.txt
@@ -1167,9 +1167,6 @@
Lcom/android/internal/telephony/Call$State;->values()[Lcom/android/internal/telephony/Call$State;
Lcom/android/internal/telephony/Call$State;->WAITING:Lcom/android/internal/telephony/Call$State;
Lcom/android/internal/telephony/Call;-><init>()V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery$CallerInfoAsyncQueryHandler;-><init>(Lcom/android/internal/telephony/CallerInfoAsyncQuery;Landroid/content/Context;)V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery$CookieWrapper;-><init>()V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery;->release()V
Lcom/android/internal/telephony/CallForwardInfo;-><init>()V
Lcom/android/internal/telephony/CallTracker;-><init>()V
Lcom/android/internal/telephony/cat/AppInterface$CommandType;->values()[Lcom/android/internal/telephony/cat/AppInterface$CommandType;
diff --git a/config/preloaded-classes b/config/preloaded-classes
index b4fd031..5d97c85 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -4695,7 +4695,7 @@
com.android.internal.telephony.CallManager
com.android.internal.telephony.CallStateException
com.android.internal.telephony.CallTracker
-com.android.internal.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
+android.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
com.android.internal.telephony.CarrierActionAgent$1
com.android.internal.telephony.CarrierActionAgent
com.android.internal.telephony.CarrierAppUtils
diff --git a/core/java/android/annotation/UnsupportedAppUsage.java b/core/java/android/annotation/UnsupportedAppUsage.java
index a454df5..204d71d 100644
--- a/core/java/android/annotation/UnsupportedAppUsage.java
+++ b/core/java/android/annotation/UnsupportedAppUsage.java
@@ -83,8 +83,9 @@
* <p>Possible values are:
* <ul>
* <li>
- * {@link android.os.Build.VERSION_CODES#O} or {@link android.os.Build.VERSION_CODES#P},
- * to limit access to apps targeting these SDKs (or earlier).
+ * An API level like {@link android.os.Build.VERSION_CODES#O} - in which case the API is
+ * available up to and including the specified release. Or, in other words, the API is
+ * blacklisted (unavailable) from the next API level from the one specified.
* </li>
* <li>
* absent (default value) - All apps can access this API, but doing so may result in
@@ -94,10 +95,6 @@
*
* </ul>
*
- * Note, if this is set to {@link android.os.Build.VERSION_CODES#O}, apps targeting O
- * maintenance releases will also be allowed to use the API, and similarly for any future
- * maintenance releases of P.
- *
* @return The maximum value for an apps targetSdkVersion in order to access this API.
*/
int maxTargetSdk() default Integer.MAX_VALUE;
diff --git a/core/java/android/bluetooth/le/ScanRecord.java b/core/java/android/bluetooth/le/ScanRecord.java
index 30868bf..97e3f52 100644
--- a/core/java/android/bluetooth/le/ScanRecord.java
+++ b/core/java/android/bluetooth/le/ScanRecord.java
@@ -154,7 +154,7 @@
}
/**
- * Returns the local name of the BLE device. The is a UTF-8 encoded string.
+ * Returns the local name of the BLE device. This is a UTF-8 encoded string.
*/
@Nullable
public String getDeviceName() {
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 77fd946..0e00d5e 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -104,16 +104,17 @@
* Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if the partition is read only, e.g. system.
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
* enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public Session startInstallation(long systemSize, long userdataSize) {
+ public Session startInstallation(String name, long size, boolean readOnly) {
try {
- if (mService.startInstallation(systemSize, userdataSize)) {
+ if (mService.startInstallation(name, size, readOnly)) {
return new Session();
} else {
return null;
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index a6de170..75f6785 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -24,11 +24,12 @@
* Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if this partition is readOnly
* @return true if the call succeeds
*/
- boolean startInstallation(long systemSize, long userdataSize);
+ boolean startInstallation(@utf8InCpp String name, long size, boolean readOnly);
/**
* Query the progress of the current installation operation. This can be called while
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 0827fd6..0973a64 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -42,7 +42,7 @@
import android.text.TextUtils;
import android.util.Log;
-import com.android.internal.telephony.CallerInfo;
+import android.telephony.CallerInfo;
import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -728,10 +728,11 @@
String accountAddress = getLogAccountAddress(context, accountHandle);
int numberPresentation = getLogNumberPresentation(number, presentation);
+ String name = (ci != null) ? ci.getName() : "";
if (numberPresentation != PRESENTATION_ALLOWED) {
number = "";
if (ci != null) {
- ci.name = "";
+ name = "";
}
}
@@ -760,9 +761,7 @@
values.put(PHONE_ACCOUNT_ID, accountId);
values.put(PHONE_ACCOUNT_ADDRESS, accountAddress);
values.put(NEW, Integer.valueOf(1));
- if ((ci != null) && (ci.name != null)) {
- values.put(CACHED_NAME, ci.name);
- }
+ values.put(CACHED_NAME, name);
values.put(ADD_FOR_ALL_USERS, addForAllUsers ? 1 : 0);
if (callType == MISSED_TYPE) {
@@ -773,7 +772,7 @@
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
- if ((ci != null) && (ci.contactIdOrZero > 0)) {
+ if ((ci != null) && (ci.getContactId() > 0)) {
// Update usage information for the number associated with the contact ID.
// We need to use both the number and the ID for obtaining a data ID since other
// contacts may have the same number.
@@ -787,17 +786,18 @@
cursor = resolver.query(Phone.CONTENT_URI,
new String[] { Phone._ID },
Phone.CONTACT_ID + " =? AND " + Phone.NORMALIZED_NUMBER + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero),
+ new String[] { String.valueOf(ci.getContactId()),
normalizedPhoneNumber},
null);
} else {
- final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number;
+ final String phoneNumber = ci.getPhoneNumber() != null
+ ? ci.getPhoneNumber() : number;
cursor = resolver.query(
Uri.withAppendedPath(Callable.CONTENT_FILTER_URI,
Uri.encode(phoneNumber)),
new String[] { Phone._ID },
Phone.CONTACT_ID + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero) },
+ new String[] { String.valueOf(ci.getContactId()) },
null);
}
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index d2f22bf..ff8b135 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -29,7 +29,6 @@
import android.telephony.euicc.DownloadableSubscription;
import android.telephony.euicc.EuiccInfo;
import android.telephony.euicc.EuiccManager.OtaStatus;
-import android.util.ArraySet;
import android.util.Log;
import java.lang.annotation.Retention;
@@ -252,18 +251,6 @@
public static final int RESULT_FIRST_USER = 1;
/**
- * List of all valid resolution actions for validation purposes.
- * @hide
- */
- public static final ArraySet<String> RESOLUTION_ACTIONS;
- static {
- RESOLUTION_ACTIONS = new ArraySet<>();
- RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_DEACTIVATE_SIM);
- RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_NO_PRIVILEGES);
- RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_RESOLVABLE_ERRORS);
- }
-
- /**
* Boolean extra for resolution actions indicating whether the user granted consent.
* This is used and set by the implementation and used in {@code EuiccOperation}.
*/
diff --git a/core/java/com/android/internal/compat/IPlatformCompat.aidl b/core/java/com/android/internal/compat/IPlatformCompat.aidl
index 4099cfa..8391ad2 100644
--- a/core/java/com/android/internal/compat/IPlatformCompat.aidl
+++ b/core/java/com/android/internal/compat/IPlatformCompat.aidl
@@ -49,9 +49,10 @@
* you do not need to call this API directly. The change will be reported for you.
*
* @param changeId The ID of the compatibility change taking effect.
+ * @param userId The ID of the user that the operation is done for.
* @param packageName The package name of the app in question.
*/
- void reportChangeByPackageName(long changeId, in String packageName);
+ void reportChangeByPackageName(long changeId, in String packageName, int userId);
/**
* Reports that a compatibility change is affecting an app process now.
@@ -86,7 +87,7 @@
* be called when implementing functionality on behalf of the affected app.
*
* <p>Same as {@link #isChangeEnabled(long, ApplicationInfo)}, except it receives a package name
- * instead of an {@link ApplicationInfo}
+ * and userId instead of an {@link ApplicationInfo}
* object, and finds an app info object based on the package name. Returns {@code true} if
* there is no installed package by that name.
*
@@ -100,9 +101,10 @@
*
* @param changeId The ID of the compatibility change in question.
* @param packageName The package name of the app in question.
+ * @param userId The ID of the user that the operation is done for.
* @return {@code true} if the change is enabled for the current app.
*/
- boolean isChangeEnabledByPackageName(long changeId, in String packageName);
+ boolean isChangeEnabledByPackageName(long changeId, in String packageName, int userId);
/**
* Query if a given compatibility change is enabled for an app process. This method should
diff --git a/core/res/res/xml/sms_short_codes.xml b/core/res/res/xml/sms_short_codes.xml
index f71c8b0..2d1c61c 100644
--- a/core/res/res/xml/sms_short_codes.xml
+++ b/core/res/res/xml/sms_short_codes.xml
@@ -90,7 +90,7 @@
<shortcode country="cz" premium="9\\d{6,7}" free="116\\d{3}" />
<!-- Germany: 4-5 digits plus 1232xxx (premium codes from http://www.vodafone.de/infofaxe/537.pdf and http://premiumdienste.eplus.de/pdf/kodex.pdf), plus EU. To keep the premium regex from being too large, it only includes payment processors that have been used by SMS malware, with the regular pattern matching the other premium short codes. -->
- <shortcode country="de" pattern="\\d{4,5}|1232\\d{3}" premium="11(?:111|833)|1232(?:013|021|060|075|286|358)|118(?:44|80|86)|20[25]00|220(?:21|22|88|99)|221(?:14|21)|223(?:44|53|77)|224[13]0|225(?:20|59|90)|226(?:06|10|20|26|30|40|56|70)|227(?:07|33|39|66|76|78|79|88|99)|228(?:08|11|66|77)|23300|30030|3[12347]000|330(?:33|55|66)|33(?:233|331|366|533)|34(?:34|567)|37000|40(?:040|123|444|[3568]00)|41(?:010|414)|44(?:000|044|344|44[24]|544)|50005|50100|50123|50555|51000|52(?:255|783)|54(?:100|2542)|55(?:077|[24]00|222|333|55|[12369]55)|56(?:789|886)|60800|6[13]000|66(?:[12348]66|566|766|777|88|999)|68888|70(?:07|123|777)|76766|77(?:007|070|222|444|[567]77)|80(?:008|123|888)|82(?:002|[378]00|323|444|472|474|488|727)|83(?:005|[169]00|333|830)|84(?:141|300|32[34]|343|488|499|777|888)|85888|86(?:188|566|640|644|650|677|868|888)|870[24]9|871(?:23|[49]9)|872(?:1[0-8]|49|99)|87499|875(?:49|55|99)|876(?:0[1367]|1[1245678]|54|99)|877(?:00|99)|878(?:15|25|3[567]|8[12])|87999|880(?:08|44|55|77|99)|88688|888(?:03|10|8|89)|8899|90(?:009|999)|99999" free="116\\d{3}|81214|81215|47529|70296|83782|3011|73240" />
+ <shortcode country="de" pattern="\\d{4,5}|1232\\d{3}" premium="11(?:111|833)|1232(?:013|021|060|075|286|358)|118(?:44|80|86)|20[25]00|220(?:21|22|88|99)|221(?:14|21)|223(?:44|53|77)|224[13]0|225(?:20|59|90)|226(?:06|10|20|26|30|40|56|70)|227(?:07|33|39|66|76|78|79|88|99)|228(?:08|11|66|77)|23300|30030|3[12347]000|330(?:33|55|66)|33(?:233|331|366|533)|34(?:34|567)|37000|40(?:040|123|444|[3568]00)|41(?:010|414)|44(?:000|044|344|44[24]|544)|50005|50100|50123|50555|51000|52(?:255|783)|54(?:100|2542)|55(?:077|[24]00|222|333|55|[12369]55)|56(?:789|886)|60800|6[13]000|66(?:[12348]66|566|766|777|88|999)|68888|70(?:07|123|777)|76766|77(?:007|070|222|444|[567]77)|80(?:008|123|888)|82(?:002|[378]00|323|444|472|474|488|727)|83(?:005|[169]00|333|830)|84(?:141|300|32[34]|343|488|499|777|888)|85888|86(?:188|566|640|644|650|677|868|888)|870[24]9|871(?:23|[49]9)|872(?:1[0-8]|49|99)|87499|875(?:49|55|99)|876(?:0[1367]|1[1245678]|54|99)|877(?:00|99)|878(?:15|25|3[567]|8[12])|87999|880(?:08|44|55|77|99)|88688|888(?:03|10|8|89)|8899|90(?:009|999)|99999" free="116\\d{3}|81214|81215|47529|70296|83782|3011|73240|72438" />
<!-- Denmark: see http://iprs.webspacecommerce.com/Denmark-Premium-Rate-Numbers -->
<shortcode country="dk" pattern="\\d{4,5}" premium="1\\d{3}" free="116\\d{3}|4665" />
diff --git a/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl b/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
index c022388..347e4e8 100644
--- a/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
+++ b/native/android/aidl/com/android/internal/compat/IPlatformCompatNative.aidl
@@ -33,9 +33,10 @@
* you do not need to call this API directly. The change will be reported for you.
*
* @param changeId The ID of the compatibility change taking effect.
+ * @param userId The ID of the user that the operation is done for.
* @param packageName The package name of the app in question.
*/
- void reportChangeByPackageName(long changeId, @utf8InCpp String packageName);
+ void reportChangeByPackageName(long changeId, @utf8InCpp String packageName, int userId);
/**
* Reports that a compatibility change is affecting an app process now.
@@ -64,9 +65,10 @@
*
* @param changeId The ID of the compatibility change in question.
* @param packageName The package name of the app in question.
+ * @param userId The ID of the user that the operation is done for.
* @return {@code true} if the change is enabled for the current app.
*/
- boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName);
+ boolean isChangeEnabledByPackageName(long changeId, @utf8InCpp String packageName, int userId);
/**
* Query if a given compatibility change is enabled for an app process. This method should
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
index 81c5bcd..642dc82 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java
@@ -35,7 +35,6 @@
import android.net.http.SslError;
import android.os.Bundle;
import android.telephony.CarrierConfigManager;
-import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -477,11 +476,11 @@
}
private static void logd(String s) {
- Rlog.d(TAG, s);
+ Log.d(TAG, s);
}
private static void loge(String s) {
- Rlog.d(TAG, s);
+ Log.d(TAG, s);
}
}
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java
index 02c61d7..46b1d5f 100644
--- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java
+++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java
@@ -19,7 +19,6 @@
import android.content.Intent;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
-import android.telephony.Rlog;
import android.text.TextUtils;
import android.util.Log;
@@ -27,7 +26,6 @@
import com.android.internal.util.ArrayUtils;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
/**
@@ -44,7 +42,7 @@
private static final String INTER_GROUP_DELIMITER = "\\s*:\\s*";
private static final String TAG = CustomConfigLoader.class.getSimpleName();
- private static final boolean VDBG = Rlog.isLoggable(TAG, Log.VERBOSE);
+ private static final boolean VDBG = Log.isLoggable(TAG, Log.VERBOSE);
/**
* loads and parses the carrier config, return a list of carrier action for the given signal
@@ -70,7 +68,7 @@
// return an empty list if no match found
List<Integer> actionList = new ArrayList<>();
if (carrierConfigManager == null) {
- Rlog.e(TAG, "load carrier config failure with carrier config manager uninitialized");
+ Log.e(TAG, "load carrier config failure with carrier config manager uninitialized");
return actionList;
}
PersistableBundle b = carrierConfigManager.getConfig();
@@ -101,8 +99,8 @@
.EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY, false));
break;
default:
- Rlog.e(TAG, "load carrier config failure with un-configured key: " +
- intent.getAction());
+ Log.e(TAG, "load carrier config failure with un-configured key: "
+ + intent.getAction());
break;
}
if (!ArrayUtils.isEmpty(configs)) {
@@ -111,12 +109,12 @@
matchConfig(config, arg1, arg2, actionList);
if (!actionList.isEmpty()) {
// return the first match
- if (VDBG) Rlog.d(TAG, "found match action list: " + actionList.toString());
+ if (VDBG) Log.d(TAG, "found match action list: " + actionList.toString());
return actionList;
}
}
}
- Rlog.d(TAG, "no matching entry for signal: " + intent.getAction() + "arg1: " + arg1
+ Log.d(TAG, "no matching entry for signal: " + intent.getAction() + "arg1: " + arg1
+ "arg2: " + arg2);
}
return actionList;
@@ -166,7 +164,7 @@
try {
actionList.add(Integer.parseInt(idx));
} catch (NumberFormatException e) {
- Rlog.e(TAG, "NumberFormatException(string: " + idx + " config:" + config + "): "
+ Log.e(TAG, "NumberFormatException(string: " + idx + " config:" + config + "): "
+ e);
}
}
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index cf286bd..738c425 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -99,11 +99,13 @@
// init input stream before calling startInstallation(), which takes 90 seconds.
initInputStream();
- Thread thread = new Thread(() -> {
- mInstallationSession =
- mDynSystem.startInstallation(mSystemSize, mUserdataSize);
- });
-
+ Thread thread =
+ new Thread(
+ () -> {
+ mDynSystem.startInstallation("userdata", mUserdataSize, false);
+ mInstallationSession =
+ mDynSystem.startInstallation("system", mSystemSize, true);
+ });
thread.start();
diff --git a/packages/SettingsProvider/OWNERS b/packages/SettingsProvider/OWNERS
new file mode 100644
index 0000000..2054129
--- /dev/null
+++ b/packages/SettingsProvider/OWNERS
@@ -0,0 +1,3 @@
+hackbod@google.com
+svetoslavganov@google.com
+moltmann@google.com
diff --git a/packages/Tethering/Android.bp b/packages/Tethering/Android.bp
new file mode 100644
index 0000000..ca69c18
--- /dev/null
+++ b/packages/Tethering/Android.bp
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2019 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.
+//
+
+java_defaults {
+ name: "TetheringAndroidLibraryDefaults",
+ platform_apis: true,
+ srcs: [
+ "src/**/*.java",
+ ":framework-tethering-shared-srcs",
+ ":services-tethering-shared-srcs",
+ ],
+ static_libs: [
+ "androidx.annotation_annotation",
+ "netd_aidl_interface-java",
+ "networkstack-aidl-interfaces-java",
+ "tethering-client",
+ ],
+ manifest: "AndroidManifestBase.xml",
+}
+
+// Build tethering static library, used to compile both variants of the tethering.
+android_library {
+ name: "TetheringApiCurrentLib",
+ defaults: ["TetheringAndroidLibraryDefaults"],
+}
+
+// Common defaults for compiling the actual APK.
+java_defaults {
+ name: "TetheringAppDefaults",
+ platform_apis: true,
+ privileged: true,
+ resource_dirs: [
+ "res",
+ ],
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+}
+
+// Non-updatable tethering running in the system server process for devices not using the module
+// TODO: build in-process tethering APK here.
+
+// Updatable tethering packaged as an application
+android_app {
+ name: "Tethering",
+ defaults: ["TetheringAppDefaults"],
+ static_libs: ["TetheringApiCurrentLib"],
+ certificate: "networkstack",
+ manifest: "AndroidManifest.xml",
+ use_embedded_native_libs: true,
+ // The permission configuration *must* be included to ensure security of the device
+ required: ["NetworkPermissionConfig"],
+}
+
+// This group will be removed when tethering migration is done.
+filegroup {
+ name: "tethering-services-srcs",
+ srcs: [
+ "src/com/android/server/connectivity/tethering/TetheringConfiguration.java",
+ "src/android/net/dhcp/DhcpServerCallbacks.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExt.java",
+ "src/android/net/ip/IpServer.java",
+ "src/android/net/ip/RouterAdvertisementDaemon.java",
+ "src/android/net/util/InterfaceSet.java",
+ ],
+}
diff --git a/packages/Tethering/AndroidManifest.xml b/packages/Tethering/AndroidManifest.xml
new file mode 100644
index 0000000..eb51593
--- /dev/null
+++ b/packages/Tethering/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2019 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering"
+ android:sharedUserId="android.uid.networkstack">
+ <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
+
+ <application
+ android:process="com.android.networkstack.process"
+ android:extractNativeLibs="false"
+ android:persistent="true">
+ </application>
+</manifest>
diff --git a/packages/Tethering/AndroidManifestBase.xml b/packages/Tethering/AndroidManifestBase.xml
new file mode 100644
index 0000000..b9cac19
--- /dev/null
+++ b/packages/Tethering/AndroidManifestBase.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2019 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.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering"
+ android:versionCode="1"
+ android:versionName="R-initial">
+ <application
+ android:label="Tethering"
+ android:defaultToDeviceProtectedStorage="true"
+ android:directBootAware="true"
+ android:usesCleartextTraffic="true">
+ </application>
+</manifest>
diff --git a/packages/Tethering/common/TetheringLib/Android.bp b/packages/Tethering/common/TetheringLib/Android.bp
new file mode 100644
index 0000000..5b01b1e
--- /dev/null
+++ b/packages/Tethering/common/TetheringLib/Android.bp
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2019 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.
+//
+
+// AIDL interfaces between the core system and the tethering mainline module.
+aidl_interface {
+ name: "tethering-aidl-interfaces",
+ local_include_dir: "src",
+ srcs: [
+ "src/android/net/ITetheringConnector.aidl",
+ ],
+ backend: {
+ ndk: {
+ enabled: false,
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+}
+
+java_library {
+ name: "tethering-client",
+ platform_apis: true,
+ static_libs: [
+ "tethering-aidl-interfaces-java",
+ ],
+}
diff --git a/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
new file mode 100644
index 0000000..443481e
--- /dev/null
+++ b/packages/Tethering/common/TetheringLib/src/android/net/ITetheringConnector.aidl
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2019, 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 perNmissions and
+ * limitations under the License.
+ */
+package android.net;
+
+/** @hide */
+oneway interface ITetheringConnector {
+}
diff --git a/packages/Tethering/proguard.flags b/packages/Tethering/proguard.flags
new file mode 100644
index 0000000..77fc024
--- /dev/null
+++ b/packages/Tethering/proguard.flags
@@ -0,0 +1 @@
+#TBD
diff --git a/packages/Tethering/res/values/config.xml b/packages/Tethering/res/values/config.xml
new file mode 100644
index 0000000..37e679d
--- /dev/null
+++ b/packages/Tethering/res/values/config.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!--
+ OEMs that wish to change the below settings must do so via a runtime resource overlay package
+ and *NOT* by changing this file. This file is part of the tethering mainline module.
+ -->
+</resources>
diff --git a/services/net/java/android/net/dhcp/DhcpServerCallbacks.java b/packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
similarity index 100%
rename from services/net/java/android/net/dhcp/DhcpServerCallbacks.java
rename to packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
diff --git a/services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java b/packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
similarity index 100%
rename from services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java
rename to packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
diff --git a/services/net/java/android/net/ip/IpServer.java b/packages/Tethering/src/android/net/ip/IpServer.java
similarity index 94%
rename from services/net/java/android/net/ip/IpServer.java
rename to packages/Tethering/src/android/net/ip/IpServer.java
index 3d79bba..ff3d7bc 100644
--- a/services/net/java/android/net/ip/IpServer.java
+++ b/packages/Tethering/src/android/net/ip/IpServer.java
@@ -16,7 +16,7 @@
package android.net.ip;
-import static android.net.NetworkUtils.numericToInetAddress;
+import static android.net.InetAddresses.parseNumericAddress;
import static android.net.dhcp.IDhcpServer.STATUS_SUCCESS;
import static android.net.util.NetworkConstants.FF;
import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH;
@@ -77,6 +77,7 @@
public static final int STATE_TETHERED = 2;
public static final int STATE_LOCAL_ONLY = 3;
+ /** Get string name of |state|.*/
public static String getStateString(int state) {
switch (state) {
case STATE_UNAVAILABLE: return "UNAVAILABLE";
@@ -103,15 +104,16 @@
// TODO: have this configurable
private static final int DHCP_LEASE_TIME_SECS = 3600;
- private final static String TAG = "IpServer";
- private final static boolean DBG = false;
- private final static boolean VDBG = false;
- private static final Class[] messageClasses = {
+ private static final String TAG = "IpServer";
+ private static final boolean DBG = false;
+ private static final boolean VDBG = false;
+ private static final Class[] sMessageClasses = {
IpServer.class
};
private static final SparseArray<String> sMagicDecoderRing =
- MessageUtils.findMessageNames(messageClasses);
+ MessageUtils.findMessageNames(sMessageClasses);
+ /** IpServer callback. */
public static class Callback {
/**
* Notify that |who| has changed its tethering state.
@@ -131,11 +133,14 @@
public void updateLinkProperties(IpServer who, LinkProperties newLp) {}
}
+ /** Capture IpServer dependencies, for injection. */
public static class Dependencies {
+ /** Create a RouterAdvertisementDaemon instance to be used by IpServer.*/
public RouterAdvertisementDaemon getRouterAdvertisementDaemon(InterfaceParams ifParams) {
return new RouterAdvertisementDaemon(ifParams);
}
+ /** Get |ifName|'s interface information.*/
public InterfaceParams getInterfaceParams(String ifName) {
return InterfaceParams.getByName(ifName);
}
@@ -244,25 +249,51 @@
setInitialState(mInitialState);
}
- public String interfaceName() { return mIfaceName; }
-
- public int interfaceType() { return mInterfaceType; }
-
- public int lastError() { return mLastError; }
-
- public int servingMode() { return mServingMode; }
-
- public LinkProperties linkProperties() { return new LinkProperties(mLinkProperties); }
-
- public void stop() { sendMessage(CMD_INTERFACE_DOWN); }
-
- public void unwanted() { sendMessage(CMD_TETHER_UNREQUESTED); }
+ /** Interface name which IpServer served.*/
+ public String interfaceName() {
+ return mIfaceName;
+ }
/**
- * Internals.
+ * Tethering downstream type. It would be one of ConnectivityManager#TETHERING_*.
*/
+ public int interfaceType() {
+ return mInterfaceType;
+ }
- private boolean startIPv4() { return configureIPv4(true); }
+ /** Last error from this IpServer. */
+ public int lastError() {
+ return mLastError;
+ }
+
+ /** Serving mode is the current state of IpServer state machine. */
+ public int servingMode() {
+ return mServingMode;
+ }
+
+ /** The properties of the network link which IpServer is serving. */
+ public LinkProperties linkProperties() {
+ return new LinkProperties(mLinkProperties);
+ }
+
+ /** Stop this IpServer. After this is called this IpServer should not be used any more. */
+ public void stop() {
+ sendMessage(CMD_INTERFACE_DOWN);
+ }
+
+ /**
+ * Tethering is canceled. IpServer state machine will be available and wait for
+ * next tethering request.
+ */
+ public void unwanted() {
+ sendMessage(CMD_TETHER_UNREQUESTED);
+ }
+
+ /** Internals. */
+
+ private boolean startIPv4() {
+ return configureIPv4(true);
+ }
/**
* Convenience wrapper around INetworkStackStatusCallback to run callbacks on the IpServer
@@ -410,7 +441,7 @@
prefixLen = WIFI_P2P_IFACE_PREFIX_LENGTH;
} else {
// BT configures the interface elsewhere: only start DHCP.
- final Inet4Address srvAddr = (Inet4Address) numericToInetAddress(BLUETOOTH_IFACE_ADDR);
+ final Inet4Address srvAddr = (Inet4Address) parseNumericAddress(BLUETOOTH_IFACE_ADDR);
return configureDhcp(enabled, srvAddr, BLUETOOTH_DHCP_PREFIX_LENGTH);
}
@@ -422,7 +453,7 @@
return false;
}
- InetAddress addr = numericToInetAddress(ipAsString);
+ InetAddress addr = parseNumericAddress(ipAsString);
linkAddr = new LinkAddress(addr, prefixLen);
ifcg.setLinkAddress(linkAddr);
if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) {
@@ -473,7 +504,7 @@
private String getRandomWifiIPv4Address() {
try {
- byte[] bytes = numericToInetAddress(WIFI_HOST_IFACE_ADDR).getAddress();
+ byte[] bytes = parseNumericAddress(WIFI_HOST_IFACE_ADDR).getAddress();
bytes[3] = getRandomSanitizedByte(DOUG_ADAMS, asByte(0), asByte(1), FF);
return InetAddress.getByAddress(bytes).getHostAddress();
} catch (Exception e) {
diff --git a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
similarity index 88%
rename from services/net/java/android/net/ip/RouterAdvertisementDaemon.java
rename to packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
index 59aea21..4147413 100644
--- a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java
+++ b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
@@ -119,6 +119,7 @@
private volatile MulticastTransmitter mMulticastTransmitter;
private volatile UnicastResponder mUnicastResponder;
+ /** Encapsulate the RA parameters for RouterAdvertisementDaemon.*/
public static class RaParams {
// Tethered traffic will have the hop limit properly decremented.
// Consequently, set the hoplimit greater by one than the upstream
@@ -150,10 +151,12 @@
dnses = (HashSet) other.dnses.clone();
}
- // Returns the subset of RA parameters that become deprecated when
- // moving from announcing oldRa to announcing newRa.
- //
- // Currently only tracks differences in |prefixes| and |dnses|.
+ /**
+ * Returns the subset of RA parameters that become deprecated when
+ * moving from announcing oldRa to announcing newRa.
+ *
+ * Currently only tracks differences in |prefixes| and |dnses|.
+ */
public static RaParams getDeprecatedRaParams(RaParams oldRa, RaParams newRa) {
RaParams newlyDeprecated = new RaParams();
@@ -179,7 +182,9 @@
private final HashMap<IpPrefix, Integer> mPrefixes = new HashMap<>();
private final HashMap<Inet6Address, Integer> mDnses = new HashMap<>();
- Set<IpPrefix> getPrefixes() { return mPrefixes.keySet(); }
+ Set<IpPrefix> getPrefixes() {
+ return mPrefixes.keySet();
+ }
void putPrefixes(Set<IpPrefix> prefixes) {
for (IpPrefix ipp : prefixes) {
@@ -193,7 +198,9 @@
}
}
- Set<Inet6Address> getDnses() { return mDnses.keySet(); }
+ Set<Inet6Address> getDnses() {
+ return mDnses.keySet();
+ }
void putDnses(Set<Inet6Address> dnses) {
for (Inet6Address dns : dnses) {
@@ -207,7 +214,9 @@
}
}
- boolean isEmpty() { return mPrefixes.isEmpty() && mDnses.isEmpty(); }
+ boolean isEmpty() {
+ return mPrefixes.isEmpty() && mDnses.isEmpty();
+ }
private boolean decrementCounters() {
boolean removed = decrementCounter(mPrefixes);
@@ -219,7 +228,7 @@
boolean removed = false;
for (Iterator<Map.Entry<T, Integer>> it = map.entrySet().iterator();
- it.hasNext();) {
+ it.hasNext();) {
Map.Entry<T, Integer> kv = it.next();
if (kv.getValue() == 0) {
it.remove();
@@ -240,6 +249,7 @@
mDeprecatedInfoTracker = new DeprecatedInfoTracker();
}
+ /** Build new RA.*/
public void buildNewRa(RaParams deprecatedParams, RaParams newParams) {
synchronized (mLock) {
if (deprecatedParams != null) {
@@ -260,6 +270,7 @@
maybeNotifyMulticastTransmitter();
}
+ /** Start router advertisement daemon. */
public boolean start() {
if (!createSocket()) {
return false;
@@ -274,6 +285,7 @@
return true;
}
+ /** Stop router advertisement daemon. */
public void stop() {
closeSocket();
// Wake up mMulticastTransmitter thread to interrupt a potential 1 day sleep before
@@ -362,8 +374,12 @@
}
}
- private static byte asByte(int value) { return (byte) value; }
- private static short asShort(int value) { return (short) value; }
+ private static byte asByte(int value) {
+ return (byte) value;
+ }
+ private static short asShort(int value) {
+ return (short) value;
+ }
private static void putHeader(ByteBuffer ra, boolean hasDefaultRoute, byte hopLimit) {
/**
@@ -384,14 +400,14 @@
+-+-+-+-+-+-+-+-+-+-+-+-
*/
ra.put(ICMPV6_ND_ROUTER_ADVERT)
- .put(asByte(0))
- .putShort(asShort(0))
- .put(hopLimit)
- // RFC 4191 "high" preference, iff. advertising a default route.
- .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
- .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
- .putInt(0)
- .putInt(0);
+ .put(asByte(0))
+ .putShort(asShort(0))
+ .put(hopLimit)
+ // RFC 4191 "high" preference, iff. advertising a default route.
+ .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
+ .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
+ .putInt(0)
+ .putInt(0);
}
private static void putSlla(ByteBuffer ra, byte[] slla) {
@@ -408,11 +424,12 @@
// Only IEEE 802.3 6-byte addresses are supported.
return;
}
- final byte ND_OPTION_SLLA = 1;
- final byte SLLA_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_SLLA)
- .put(SLLA_NUM_8OCTETS)
- .put(slla);
+
+ final byte nd_option_slla = 1;
+ final byte slla_num_8octets = 1;
+ ra.put(nd_option_slla)
+ .put(slla_num_8octets)
+ .put(slla);
}
private static void putExpandedFlagsOption(ByteBuffer ra) {
@@ -428,13 +445,13 @@
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_EFO = 26;
- final byte EFO_NUM_8OCTETS = 1;
+ final byte nd_option__efo = 26;
+ final byte efo_num_8octets = 1;
- ra.put(ND_OPTION_EFO)
- .put(EFO_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(0);
+ ra.put(nd_option__efo)
+ .put(efo_num_8octets)
+ .putShort(asShort(0))
+ .putInt(0);
}
private static void putMtu(ByteBuffer ra, int mtu) {
@@ -449,12 +466,12 @@
| MTU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_MTU = 5;
- final byte MTU_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_MTU)
- .put(MTU_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
+ final byte nd_option_mtu = 5;
+ final byte mtu_num_8octs = 1;
+ ra.put(nd_option_mtu)
+ .put(mtu_num_8octs)
+ .putShort(asShort(0))
+ .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
}
private static void putPio(ByteBuffer ra, IpPrefix ipp,
@@ -486,22 +503,22 @@
if (prefixLength != 64) {
return;
}
- final byte ND_OPTION_PIO = 3;
- final byte PIO_NUM_8OCTETS = 4;
+ final byte nd_option_pio = 3;
+ final byte pio_num_8octets = 4;
if (validTime < 0) validTime = 0;
if (preferredTime < 0) preferredTime = 0;
if (preferredTime > validTime) preferredTime = validTime;
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_PIO)
- .put(PIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0xc0)) /* L & A set */
- .putInt(validTime)
- .putInt(preferredTime)
- .putInt(0)
- .put(addr);
+ ra.put(nd_option_pio)
+ .put(pio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0xc0)) /* L & A set */
+ .putInt(validTime)
+ .putInt(preferredTime)
+ .putInt(0)
+ .put(addr);
}
private static void putRio(ByteBuffer ra, IpPrefix ipp) {
@@ -524,16 +541,16 @@
if (prefixLength > 64) {
return;
}
- final byte ND_OPTION_RIO = 24;
- final byte RIO_NUM_8OCTETS = asByte(
+ final byte nd_option_rio = 24;
+ final byte rio_num_8octets = asByte(
(prefixLength == 0) ? 1 : (prefixLength <= 8) ? 2 : 3);
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_RIO)
- .put(RIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0x18))
- .putInt(DEFAULT_LIFETIME);
+ ra.put(nd_option_rio)
+ .put(rio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0x18))
+ .putInt(DEFAULT_LIFETIME);
// Rely upon an IpPrefix's address being properly zeroed.
if (prefixLength > 0) {
@@ -566,12 +583,12 @@
}
if (filteredDnses.isEmpty()) return;
- final byte ND_OPTION_RDNSS = 25;
- final byte RDNSS_NUM_8OCTETS = asByte(dnses.size() * 2 + 1);
- ra.put(ND_OPTION_RDNSS)
- .put(RDNSS_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(lifetime);
+ final byte nd_option_rdnss = 25;
+ final byte rdnss_num_8octets = asByte(dnses.size() * 2 + 1);
+ ra.put(nd_option_rdnss)
+ .put(rdnss_num_8octets)
+ .putShort(asShort(0))
+ .putInt(lifetime);
for (Inet6Address dns : filteredDnses) {
// NOTE: If the full of list DNS servers doesn't fit in the packet,
@@ -585,7 +602,7 @@
}
private boolean createSocket() {
- final int SEND_TIMEOUT_MS = 300;
+ final int send_timout_ms = 300;
final int oldTag = TrafficStats.getAndSetThreadStatsTag(
TrafficStatsConstants.TAG_SYSTEM_NEIGHBOR);
@@ -593,7 +610,7 @@
mSocket = Os.socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
// Setting SNDTIMEO is purely for defensive purposes.
Os.setsockoptTimeval(
- mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(SEND_TIMEOUT_MS));
+ mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(send_timout_ms));
Os.setsockoptIfreq(mSocket, SOL_SOCKET, SO_BINDTODEVICE, mInterface.name);
NetworkUtils.protectFromVpn(mSocket);
NetworkUtils.setupRaSocket(mSocket, mInterface.index);
@@ -611,7 +628,7 @@
if (mSocket != null) {
try {
IoBridge.closeAndSignalBlockedThreads(mSocket);
- } catch (IOException ignored) {}
+ } catch (IOException ignored) { }
}
mSocket = null;
}
@@ -627,9 +644,9 @@
}
final InetAddress destip = dest.getAddress();
- return (destip instanceof Inet6Address) &&
- destip.isLinkLocalAddress() &&
- (((Inet6Address) destip).getScopeId() == mInterface.index);
+ return (destip instanceof Inet6Address)
+ && destip.isLinkLocalAddress()
+ && (((Inet6Address) destip).getScopeId() == mInterface.index);
}
private void maybeSendRA(InetSocketAddress dest) {
@@ -654,11 +671,11 @@
}
private final class UnicastResponder extends Thread {
- private final InetSocketAddress solicitor = new InetSocketAddress();
+ private final InetSocketAddress mSolicitor = new InetSocketAddress();
// The recycled buffer for receiving Router Solicitations from clients.
// If the RS is larger than IPV6_MIN_MTU the packets are truncated.
// This is fine since currently only byte 0 is examined anyway.
- private final byte mSolication[] = new byte[IPV6_MIN_MTU];
+ private final byte[] mSolicitation = new byte[IPV6_MIN_MTU];
@Override
public void run() {
@@ -666,9 +683,9 @@
try {
// Blocking receive.
final int rval = Os.recvfrom(
- mSocket, mSolication, 0, mSolication.length, 0, solicitor);
+ mSocket, mSolicitation, 0, mSolicitation.length, 0, mSolicitor);
// Do the least possible amount of validation.
- if (rval < 1 || mSolication[0] != ICMPV6_ND_ROUTER_SOLICIT) {
+ if (rval < 1 || mSolicitation[0] != ICMPV6_ND_ROUTER_SOLICIT) {
continue;
}
} catch (ErrnoException | SocketException e) {
@@ -678,7 +695,7 @@
continue;
}
- maybeSendRA(solicitor);
+ maybeSendRA(mSolicitor);
}
}
}
diff --git a/services/net/java/android/net/util/InterfaceSet.java b/packages/Tethering/src/android/net/util/InterfaceSet.java
similarity index 95%
rename from services/net/java/android/net/util/InterfaceSet.java
rename to packages/Tethering/src/android/net/util/InterfaceSet.java
index 9f26fa1..7589787 100644
--- a/services/net/java/android/net/util/InterfaceSet.java
+++ b/packages/Tethering/src/android/net/util/InterfaceSet.java
@@ -47,6 +47,6 @@
public boolean equals(Object obj) {
return obj != null
&& obj instanceof InterfaceSet
- && ifnames.equals(((InterfaceSet)obj).ifnames);
+ && ifnames.equals(((InterfaceSet) obj).ifnames);
}
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
similarity index 96%
rename from services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
rename to packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
index a1b94ca..7709727 100644
--- a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -82,7 +82,7 @@
"192.168.48.2", "192.168.48.254", "192.168.49.2", "192.168.49.254",
};
- private final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};
+ private static final String[] DEFAULT_IPV4_DNS = {"8.8.4.4", "8.8.8.8"};
public final String[] tetherableUsbRegexs;
public final String[] tetherableWifiRegexs;
@@ -133,10 +133,12 @@
configLog.log(toString());
}
+ /** Check whether input interface belong to usb.*/
public boolean isUsb(String iface) {
return matchesDownstreamRegexs(iface, tetherableUsbRegexs);
}
+ /** Check whether input interface belong to wifi.*/
public boolean isWifi(String iface) {
return matchesDownstreamRegexs(iface, tetherableWifiRegexs);
}
@@ -146,18 +148,22 @@
return matchesDownstreamRegexs(iface, tetherableWifiP2pRegexs);
}
+ /** Check whether using legacy mode for wifi P2P. */
public boolean isWifiP2pLegacyTetheringMode() {
return (tetherableWifiP2pRegexs == null || tetherableWifiP2pRegexs.length == 0);
}
+ /** Check whether input interface belong to bluetooth.*/
public boolean isBluetooth(String iface) {
return matchesDownstreamRegexs(iface, tetherableBluetoothRegexs);
}
+ /** Check whether no ui entitlement application is available.*/
public boolean hasMobileHotspotProvisionApp() {
return !TextUtils.isEmpty(provisioningAppNoUi);
}
+ /** Does the dumping.*/
public void dump(PrintWriter pw) {
pw.print("subId: ");
pw.println(subId);
@@ -186,6 +192,7 @@
pw.println(enableLegacyDhcpServer);
}
+ /** Returns the string representation of this object.*/
public String toString() {
final StringJoiner sj = new StringJoiner(" ");
sj.add(String.format("subId:%d", subId));
@@ -210,7 +217,7 @@
if (values != null) {
final StringJoiner sj = new StringJoiner(", ", "[", "]");
- for (String value : values) { sj.add(value); }
+ for (String value : values) sj.add(value);
pw.print(sj.toString());
} else {
pw.print("null");
diff --git a/packages/Tethering/tests/unit/Android.bp b/packages/Tethering/tests/unit/Android.bp
new file mode 100644
index 0000000..da62107
--- /dev/null
+++ b/packages/Tethering/tests/unit/Android.bp
@@ -0,0 +1,50 @@
+//
+// Copyright (C) 2019 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.
+//
+
+android_test {
+ name: "TetheringTests",
+ certificate: "platform",
+ srcs: ["src/**/*.java"],
+ test_suites: ["device-tests"],
+ static_libs: [
+ "androidx.test.rules",
+ "frameworks-base-testutils",
+ "mockito-target-extended-minus-junit4",
+ "TetheringApiCurrentLib",
+ "testables",
+ ],
+ libs: [
+ "android.test.runner",
+ "android.test.base",
+ "android.test.mock",
+ ],
+ jni_libs: [
+ // For mockito extended
+ "libdexmakerjvmtiagent",
+ "libstaticjvmtiagent",
+ ],
+}
+
+// This group would be removed when tethering migration is done.
+filegroup {
+ name: "tethering-tests-src",
+ srcs: [
+ "src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExtTest.java",
+ "src/android/net/ip/IpServerTest.java",
+ "src/android/net/util/InterfaceSetTest.java",
+ ],
+}
diff --git a/packages/Tethering/tests/unit/AndroidManifest.xml b/packages/Tethering/tests/unit/AndroidManifest.xml
new file mode 100644
index 0000000..049ff6d
--- /dev/null
+++ b/packages/Tethering/tests/unit/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tethering.tests.unit">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.tethering.tests.unit"
+ android:label="Tethering service tests">
+ </instrumentation>
+</manifest>
diff --git a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java b/packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
similarity index 100%
rename from tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
rename to packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
diff --git a/tests/net/java/android/net/ip/IpServerTest.java b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
similarity index 99%
rename from tests/net/java/android/net/ip/IpServerTest.java
rename to packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
index b6ccebb..4358cd6 100644
--- a/tests/net/java/android/net/ip/IpServerTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
@@ -183,7 +183,7 @@
@Test
public void shouldDoNothingUntilRequested() throws Exception {
initStateMachine(TETHERING_BLUETOOTH);
- final int [] NOOP_COMMANDS = {
+ final int [] noOp_commands = {
IpServer.CMD_TETHER_UNREQUESTED,
IpServer.CMD_IP_FORWARDING_ENABLE_ERROR,
IpServer.CMD_IP_FORWARDING_DISABLE_ERROR,
@@ -192,7 +192,7 @@
IpServer.CMD_SET_DNS_FORWARDERS_ERROR,
IpServer.CMD_TETHER_CONNECTION_CHANGED
};
- for (int command : NOOP_COMMANDS) {
+ for (int command : noOp_commands) {
// None of these commands should trigger us to request action from
// the rest of the system.
dispatchCommand(command);
diff --git a/tests/net/java/android/net/util/InterfaceSetTest.java b/packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
similarity index 100%
rename from tests/net/java/android/net/util/InterfaceSetTest.java
rename to packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
similarity index 91%
rename from tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
rename to packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index e282963..9f9221f 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -24,7 +24,12 @@
import static android.provider.Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+import static com.android.internal.R.array.config_mobile_hotspot_provision_app;
+import static com.android.internal.R.array.config_tether_bluetooth_regexs;
+import static com.android.internal.R.array.config_tether_dhcp_range;
import static com.android.internal.R.array.config_tether_upstream_types;
+import static com.android.internal.R.array.config_tether_usb_regexs;
+import static com.android.internal.R.array.config_tether_wifi_regexs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -86,7 +91,9 @@
}
@Override
- public Resources getResources() { return mResources; }
+ public Resources getResources() {
+ return mResources;
+ }
@Override
public Object getSystemService(String name) {
@@ -105,17 +112,13 @@
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_dhcp_range))
- .thenReturn(new String[0]);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_usb_regexs))
- .thenReturn(new String[0]);
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_wifi_regexs))
+ when(mResources.getStringArray(config_tether_dhcp_range)).thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_usb_regexs)).thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_wifi_regexs))
.thenReturn(new String[]{ "test_wlan\\d" });
- when(mResources.getStringArray(com.android.internal.R.array.config_tether_bluetooth_regexs))
- .thenReturn(new String[0]);
+ when(mResources.getStringArray(config_tether_bluetooth_regexs)).thenReturn(new String[0]);
when(mResources.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
- when(mResources.getStringArray(
- com.android.internal.R.array.config_mobile_hotspot_provision_app))
+ when(mResources.getStringArray(config_mobile_hotspot_provision_app))
.thenReturn(new String[0]);
mContentResolver = new MockContentResolver();
mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
@@ -297,19 +300,16 @@
private void setUpResourceForSubId() {
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_dhcp_range)).thenReturn(new String[0]);
+ config_tether_dhcp_range)).thenReturn(new String[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_usb_regexs)).thenReturn(new String[0]);
+ config_tether_usb_regexs)).thenReturn(new String[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_wifi_regexs))
- .thenReturn(new String[]{ "test_wlan\\d" });
+ config_tether_wifi_regexs)).thenReturn(new String[]{ "test_wlan\\d" });
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_tether_bluetooth_regexs))
- .thenReturn(new String[0]);
+ config_tether_bluetooth_regexs)).thenReturn(new String[0]);
when(mResourcesForSubId.getIntArray(config_tether_upstream_types)).thenReturn(new int[0]);
when(mResourcesForSubId.getStringArray(
- com.android.internal.R.array.config_mobile_hotspot_provision_app))
- .thenReturn(PROVISIONING_APP_NAME);
+ config_mobile_hotspot_provision_app)).thenReturn(PROVISIONING_APP_NAME);
}
}
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 18009e1..190e6cf 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -115,7 +115,8 @@
}
@Override
- public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
+ public boolean startInstallation(String name, long size, boolean readOnly)
+ throws RemoteException {
// priority from high to low: sysprop -> sdcard -> /data
String path = SystemProperties.get("os.aot.path");
if (path.isEmpty()) {
@@ -137,11 +138,18 @@
}
Slog.i(TAG, "startInstallation -> " + path);
}
+ IGsiService service = getGsiService();
GsiInstallParams installParams = new GsiInstallParams();
installParams.installDir = path;
- installParams.gsiSize = systemSize;
- installParams.userdataSize = userdataSize;
- return getGsiService().beginGsiInstall(installParams) == 0;
+ installParams.name = name;
+ installParams.size = size;
+ installParams.wipe = readOnly;
+ installParams.readOnly = readOnly;
+ if (service.beginGsiInstall(installParams) != 0) {
+ Slog.i(TAG, "Failed to install " + name);
+ return false;
+ }
+ return true;
}
@Override
diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java
index 854f16a..9ac9955 100644
--- a/services/core/java/com/android/server/compat/PlatformCompat.java
+++ b/services/core/java/com/android/server/compat/PlatformCompat.java
@@ -19,7 +19,7 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
-import android.os.Process;
+import android.os.UserHandle;
import android.util.Slog;
import android.util.StatsLog;
@@ -54,8 +54,8 @@
}
@Override
- public void reportChangeByPackageName(long changeId, String packageName) {
- ApplicationInfo appInfo = getApplicationInfo(packageName);
+ public void reportChangeByPackageName(long changeId, String packageName, int userId) {
+ ApplicationInfo appInfo = getApplicationInfo(packageName, userId);
if (appInfo == null) {
return;
}
@@ -80,8 +80,8 @@
}
@Override
- public boolean isChangeEnabledByPackageName(long changeId, String packageName) {
- ApplicationInfo appInfo = getApplicationInfo(packageName);
+ public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) {
+ ApplicationInfo appInfo = getApplicationInfo(packageName, userId);
if (appInfo == null) {
return true;
}
@@ -96,7 +96,8 @@
}
boolean enabled = true;
for (String packageName : packages) {
- enabled = enabled && isChangeEnabledByPackageName(changeId, packageName);
+ enabled = enabled && isChangeEnabledByPackageName(changeId, packageName,
+ UserHandle.getUserId(uid));
}
return enabled;
}
@@ -127,10 +128,9 @@
mChangeReporter.resetReportedChanges(appInfo.uid);
}
- private ApplicationInfo getApplicationInfo(String packageName) {
+ private ApplicationInfo getApplicationInfo(String packageName, int userId) {
try {
- return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0,
- Process.myUid());
+ return mContext.getPackageManager().getApplicationInfoAsUser(packageName, 0, userId);
} catch (PackageManager.NameNotFoundException e) {
Slog.e(TAG, "No installed package " + packageName);
}
diff --git a/services/core/java/com/android/server/compat/PlatformCompatNative.java b/services/core/java/com/android/server/compat/PlatformCompatNative.java
index 8399671..85dfbf4 100644
--- a/services/core/java/com/android/server/compat/PlatformCompatNative.java
+++ b/services/core/java/com/android/server/compat/PlatformCompatNative.java
@@ -29,8 +29,8 @@
}
@Override
- public void reportChangeByPackageName(long changeId, String packageName) {
- mPlatformCompat.reportChangeByPackageName(changeId, packageName);
+ public void reportChangeByPackageName(long changeId, String packageName, int userId) {
+ mPlatformCompat.reportChangeByPackageName(changeId, packageName, userId);
}
@Override
@@ -39,8 +39,8 @@
}
@Override
- public boolean isChangeEnabledByPackageName(long changeId, String packageName) {
- return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName);
+ public boolean isChangeEnabledByPackageName(long changeId, String packageName, int userId) {
+ return mPlatformCompat.isChangeEnabledByPackageName(changeId, packageName, userId);
}
@Override
diff --git a/services/net/Android.bp b/services/net/Android.bp
index 1ca96ed..08cdbfc 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -1,10 +1,14 @@
java_library_static {
name: "services.net",
- srcs: ["java/**/*.java"],
+ srcs: [
+ ":tethering-services-srcs",
+ "java/**/*.java",
+ ],
static_libs: [
"dnsresolver_aidl_interface-V2-java",
"netd_aidl_interface-java",
"networkstack-client",
+ "tethering-client",
],
}
@@ -17,3 +21,17 @@
"java/android/net/netlink/*.java",
],
}
+
+filegroup {
+ name: "services-tethering-shared-srcs",
+ srcs: [
+ ":framework-annotations",
+ "java/android/net/ConnectivityModuleConnector.java",
+ "java/android/net/NetworkStackClient.java",
+ "java/android/net/ip/InterfaceController.java",
+ "java/android/net/util/InterfaceParams.java",
+ "java/android/net/util/NetdService.java",
+ "java/android/net/util/NetworkConstants.java",
+ "java/android/net/util/SharedLog.java"
+ ],
+}
diff --git a/services/net/java/android/net/netlink/InetDiagMessage.java b/services/net/java/android/net/netlink/InetDiagMessage.java
index 31a2556..ca07630 100644
--- a/services/net/java/android/net/netlink/InetDiagMessage.java
+++ b/services/net/java/android/net/netlink/InetDiagMessage.java
@@ -26,6 +26,7 @@
import static android.system.OsConstants.IPPROTO_UDP;
import static android.system.OsConstants.NETLINK_INET_DIAG;
+import android.annotation.Nullable;
import android.net.util.SocketUtils;
import android.system.ErrnoException;
import android.util.Log;
@@ -53,7 +54,35 @@
private static final int TIMEOUT_MS = 500;
public static byte[] InetDiagReqV2(int protocol, InetSocketAddress local,
- InetSocketAddress remote, int family, short flags) {
+ InetSocketAddress remote, int family, short flags) {
+ return InetDiagReqV2(protocol, local, remote, family, flags, 0 /* pad */,
+ 0 /* idiagExt */, StructInetDiagReqV2.INET_DIAG_REQ_V2_ALL_STATES);
+ }
+
+ /**
+ * Construct an inet_diag_req_v2 message. This method will throw {@code NullPointerException}
+ * if local and remote are not both null or both non-null.
+ *
+ * @param protocol the request protocol type. This should be set to one of IPPROTO_TCP,
+ * IPPROTO_UDP, or IPPROTO_UDPLITE.
+ * @param local local socket address of the target socket. This will be packed into a
+ * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * local or remote address is null.
+ * @param remote remote socket address of the target socket. This will be packed into a
+ * {@Code StructInetDiagSockId}. Request to diagnose for all sockets if both of
+ * local or remote address is null.
+ * @param family the ip family of the request message. This should be set to either AF_INET or
+ * AF_INET6 for IPv4 or IPv6 sockets respectively.
+ * @param flags message flags. See <linux_src>/include/uapi/linux/netlink.h.
+ * @param pad for raw socket protocol specification.
+ * @param idiagExt a set of flags defining what kind of extended information to report.
+ * @param state a bit mask that defines a filter of socket states.
+ *
+ * @return bytes array representation of the message
+ **/
+ public static byte[] InetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
+ @Nullable InetSocketAddress remote, int family, short flags, int pad, int idiagExt,
+ int state) throws NullPointerException {
final byte[] bytes = new byte[StructNlMsgHdr.STRUCT_SIZE + StructInetDiagReqV2.STRUCT_SIZE];
final ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byteBuffer.order(ByteOrder.nativeOrder());
@@ -63,9 +92,9 @@
nlMsgHdr.nlmsg_type = SOCK_DIAG_BY_FAMILY;
nlMsgHdr.nlmsg_flags = flags;
nlMsgHdr.pack(byteBuffer);
+ final StructInetDiagReqV2 inetDiagReqV2 =
+ new StructInetDiagReqV2(protocol, local, remote, family, pad, idiagExt, state);
- final StructInetDiagReqV2 inetDiagReqV2 = new StructInetDiagReqV2(protocol, local, remote,
- family);
inetDiagReqV2.pack(byteBuffer);
return bytes;
}
diff --git a/services/net/java/android/net/netlink/StructInetDiagReqV2.java b/services/net/java/android/net/netlink/StructInetDiagReqV2.java
index 49a9325..2268113 100644
--- a/services/net/java/android/net/netlink/StructInetDiagReqV2.java
+++ b/services/net/java/android/net/netlink/StructInetDiagReqV2.java
@@ -16,10 +16,10 @@
package android.net.netlink;
-import static java.nio.ByteOrder.BIG_ENDIAN;
+import android.annotation.Nullable;
+
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
/**
* struct inet_diag_req_v2
@@ -40,41 +40,58 @@
public class StructInetDiagReqV2 {
public static final int STRUCT_SIZE = 8 + StructInetDiagSockId.STRUCT_SIZE;
- private final byte sdiag_family;
- private final byte sdiag_protocol;
- private final StructInetDiagSockId id;
- private final int INET_DIAG_REQ_V2_ALL_STATES = (int) 0xffffffff;
-
+ private final byte mSdiagFamily;
+ private final byte mSdiagProtocol;
+ private final byte mIdiagExt;
+ private final byte mPad;
+ private final StructInetDiagSockId mId;
+ private final int mState;
+ public static final int INET_DIAG_REQ_V2_ALL_STATES = (int) 0xffffffff;
public StructInetDiagReqV2(int protocol, InetSocketAddress local, InetSocketAddress remote,
- int family) {
- sdiag_family = (byte) family;
- sdiag_protocol = (byte) protocol;
- id = new StructInetDiagSockId(local, remote);
+ int family) {
+ this(protocol, local, remote, family, 0 /* pad */, 0 /* extension */,
+ INET_DIAG_REQ_V2_ALL_STATES);
+ }
+
+ public StructInetDiagReqV2(int protocol, @Nullable InetSocketAddress local,
+ @Nullable InetSocketAddress remote, int family, int pad, int extension, int state)
+ throws NullPointerException {
+ mSdiagFamily = (byte) family;
+ mSdiagProtocol = (byte) protocol;
+ // Request for all sockets if no specific socket is requested. Specify the local and remote
+ // socket address information for target request socket.
+ if ((local == null) != (remote == null)) {
+ throw new NullPointerException("Local and remote must be both null or both non-null");
+ }
+ mId = ((local != null && remote != null) ? new StructInetDiagSockId(local, remote) : null);
+ mPad = (byte) pad;
+ mIdiagExt = (byte) extension;
+ mState = state;
}
public void pack(ByteBuffer byteBuffer) {
// The ByteOrder must have already been set by the caller.
- byteBuffer.put((byte) sdiag_family);
- byteBuffer.put((byte) sdiag_protocol);
- byteBuffer.put((byte) 0);
- byteBuffer.put((byte) 0);
- byteBuffer.putInt(INET_DIAG_REQ_V2_ALL_STATES);
- id.pack(byteBuffer);
+ byteBuffer.put((byte) mSdiagFamily);
+ byteBuffer.put((byte) mSdiagProtocol);
+ byteBuffer.put((byte) mIdiagExt);
+ byteBuffer.put((byte) mPad);
+ byteBuffer.putInt(mState);
+ if (mId != null) mId.pack(byteBuffer);
}
@Override
public String toString() {
- final String familyStr = NetlinkConstants.stringForAddressFamily(sdiag_family);
- final String protocolStr = NetlinkConstants.stringForAddressFamily(sdiag_protocol);
+ final String familyStr = NetlinkConstants.stringForAddressFamily(mSdiagFamily);
+ final String protocolStr = NetlinkConstants.stringForAddressFamily(mSdiagProtocol);
return "StructInetDiagReqV2{ "
+ "sdiag_family{" + familyStr + "}, "
+ "sdiag_protocol{" + protocolStr + "}, "
- + "idiag_ext{" + 0 + ")}, "
- + "pad{" + 0 + "}, "
- + "idiag_states{" + Integer.toHexString(INET_DIAG_REQ_V2_ALL_STATES) + "}, "
- + id.toString()
+ + "idiag_ext{" + mIdiagExt + ")}, "
+ + "pad{" + mPad + "}, "
+ + "idiag_states{" + Integer.toHexString(mState) + "}, "
+ + ((mId != null) ? mId.toString() : "inet_diag_sockid=null")
+ "}";
}
}
diff --git a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 4a9dd97..0605d9e 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -36,7 +36,7 @@
public void test1() {
assertTrue("dynamic_system service available", mService != null);
try {
- mService.startInstallation(1 << 20, 8 << 30);
+ mService.startInstallation("userdata", 8L << 30, false);
fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected
diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java
index ddda010..d3728a6 100644
--- a/telephony/java/android/provider/Telephony.java
+++ b/telephony/java/android/provider/Telephony.java
@@ -3963,13 +3963,21 @@
public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
/**
- * The id of the subscription which received this cell broadcast message.
+ * The subscription which received this cell broadcast message.
+ * @deprecated use {@link #SLOT_INDEX} instead.
* <P>Type: INTEGER</P>
* @hide
*/
public static final String SUB_ID = "sub_id";
/**
+ * The slot which received this cell broadcast message.
+ * <P>Type: INTEGER</P>
+ * @hide
+ */
+ public static final String SLOT_INDEX = "slot_index";
+
+ /**
* Message geographical scope. Valid values are:
* <ul>
* <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE}. meaning the
@@ -4203,7 +4211,7 @@
public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time";
/**
- * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
+ * Query columns for instantiating com.android.cellbroadcastreceiver.CellBroadcastMessage.
* @hide
*/
@NonNull
@@ -4236,6 +4244,7 @@
*/
public static final String[] QUERY_COLUMNS_FWK = {
_ID,
+ SLOT_INDEX,
GEOGRAPHICAL_SCOPE,
PLMN,
LAC,
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/android/telephony/CallerInfo.java
similarity index 93%
rename from telephony/java/com/android/internal/telephony/CallerInfo.java
rename to telephony/java/android/telephony/CallerInfo.java
index 13539b8..f87ac50 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telephony/java/android/telephony/CallerInfo.java
@@ -14,8 +14,10 @@
* limitations under the License.
*/
-package com.android.internal.telephony;
+package android.telephony;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -31,10 +33,6 @@
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.RawContacts;
-import android.telephony.PhoneNumberUtils;
-import android.telephony.Rlog;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -43,6 +41,7 @@
import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
+import com.android.internal.annotations.VisibleForTesting;
import java.util.Locale;
@@ -51,11 +50,14 @@
*
* {@hide}
*/
+@SystemApi
public class CallerInfo {
private static final String TAG = "CallerInfo";
private static final boolean VDBG = Rlog.isLoggable(TAG, Log.VERBOSE);
+ /** @hide */
public static final long USER_TYPE_CURRENT = 0;
+ /** @hide */
public static final long USER_TYPE_WORK = 1;
/**
@@ -85,49 +87,61 @@
* field here, NOT name. We're NOT always guaranteed to have a name
* for a connection, but the number should be displayable.
*/
- @UnsupportedAppUsage
- public String name;
- @UnsupportedAppUsage
- public String phoneNumber;
+ private String name;
+ private String phoneNumber;
+ /** @hide */
public String normalizedNumber;
+ /** @hide */
public String geoDescription;
-
+ /** @hide */
public String cnapName;
+ /** @hide */
public int numberPresentation;
+ /** @hide */
public int namePresentation;
+ /** @hide */
public boolean contactExists;
-
+ /** @hide */
public String phoneLabel;
- /* Split up the phoneLabel into number type and label name */
+ /**
+ * Split up the phoneLabel into number type and label name.
+ * @hide
+ */
@UnsupportedAppUsage
public int numberType;
+ /** @hide */
@UnsupportedAppUsage
public String numberLabel;
-
+ /** @hide */
public int photoResource;
// Contact ID, which will be 0 if a contact comes from the corp CP2.
- @UnsupportedAppUsage
- public long contactIdOrZero;
+ private long contactIdOrZero;
+ /** @hide */
public boolean needUpdate;
+ /** @hide */
public Uri contactRefUri;
+ /** @hide */
public String lookupKey;
-
+ /** @hide */
public ComponentName preferredPhoneAccountComponent;
+ /** @hide */
public String preferredPhoneAccountId;
-
+ /** @hide */
public long userType;
/**
* Contact display photo URI. If a contact has no display photo but a thumbnail, it'll be
* the thumbnail URI instead.
*/
- public Uri contactDisplayPhotoUri;
+ private Uri contactDisplayPhotoUri;
// fields to hold individual contact preference data,
// including the send to voicemail flag and the ringtone
// uri reference.
+ /** @hide */
public Uri contactRingtoneUri;
+ /** @hide */
public boolean shouldSendToVoicemail;
/**
@@ -141,6 +155,8 @@
*
* The {@link #isCachedPhotoCurrent} flag indicates if the image
* data needs to be reloaded.
+ *
+ * @hide
*/
public Drawable cachedPhoto;
/**
@@ -153,18 +169,23 @@
*
* The {@link #isCachedPhotoCurrent} flag indicates if the image
* data needs to be reloaded.
+ *
+ * @hide
*/
public Bitmap cachedPhotoIcon;
/**
* Boolean which indicates if {@link #cachedPhoto} and
* {@link #cachedPhotoIcon} is fresh enough. If it is false,
* those images aren't pointing to valid objects.
+ *
+ * @hide
*/
public boolean isCachedPhotoCurrent;
private boolean mIsEmergency;
private boolean mIsVoiceMail;
+ /** @hide */
@UnsupportedAppUsage
public CallerInfo() {
// TODO: Move all the basic initialization here?
@@ -180,6 +201,8 @@
* @param cursor the first object in the cursor is used to build the CallerInfo object.
* @return the CallerInfo which contains the caller id for the given
* number. The returned CallerInfo is null if no number is supplied.
+ *
+ * @hide
*/
public static CallerInfo getCallerInfo(Context context, Uri contactRef, Cursor cursor) {
CallerInfo info = new CallerInfo();
@@ -321,6 +344,8 @@
* @param contactRef the URI used to lookup caller id
* @return the CallerInfo which contains the caller id for the given
* number. The returned CallerInfo is null if no number is supplied.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, Uri contactRef) {
@@ -346,6 +371,8 @@
* number. The returned CallerInfo is null if no number is supplied. If
* a matching number is not found, then a generic caller info is returned,
* with all relevant fields empty or null.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, String number) {
@@ -365,6 +392,8 @@
* number. The returned CallerInfo is null if no number is supplied. If
* a matching number is not found, then a generic caller info is returned,
* with all relevant fields empty or null.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, String number, int subId) {
@@ -398,6 +427,59 @@
}
/**
+ * @return Name assocaited with this caller.
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set caller Info Name.
+ * @param name caller Info Name
+ *
+ * @hide
+ */
+ public void setName(@Nullable String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Phone number assocaited with this caller.
+ */
+ @Nullable
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ /** @hide */
+ public void setPhoneNumber(String number) {
+ phoneNumber = number;
+ }
+
+ /**
+ * @return Contact ID, which will be 0 if a contact comes from the corp Contacts Provider.
+ */
+ public long getContactId() {
+ return contactIdOrZero;
+ }
+
+ /**
+ * @return Contact display photo URI. If a contact has no display photo but a thumbnail,
+ * it'll the thumbnail URI instead.
+ */
+ @Nullable
+ public Uri getContactDisplayPhotoUri() {
+ return contactDisplayPhotoUri;
+ }
+
+ /** @hide */
+ @VisibleForTesting
+ public void SetContactDisplayPhotoUri(Uri photoUri) {
+ contactDisplayPhotoUri = photoUri;
+ }
+
+ /**
* Performs another lookup if previous lookup fails and it's a SIP call
* and the peer's username is all numeric. Look up the username as it
* could be a PSTN number in the contact database.
@@ -425,6 +507,7 @@
/**
* @return true if the caller info is an emergency number.
+ * @hide
*/
public boolean isEmergencyNumber() {
return mIsEmergency;
@@ -432,6 +515,7 @@
/**
* @return true if the caller info is a voicemail number.
+ * @hide
*/
public boolean isVoiceMailNumber() {
return mIsVoiceMail;
@@ -591,6 +675,7 @@
* @param context the context used to look up the current locale / country
* @param fallbackNumber if this CallerInfo's phoneNumber field is empty,
* this specifies a fallback number to use instead.
+ * @hide
*/
public void updateGeoDescription(Context context, String fallbackNumber) {
String number = TextUtils.isEmpty(phoneNumber) ? fallbackNumber : phoneNumber;
@@ -600,6 +685,8 @@
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
+ *
+ * @hide
*/
public static String getGeoDescription(Context context, String number) {
if (VDBG) Rlog.v(TAG, "getGeoDescription('" + number + "')...");
@@ -657,6 +744,7 @@
return countryIso;
}
+ /** @hide */
protected static String getCurrentCountryIso(Context context) {
return getCurrentCountryIso(context, Locale.getDefault());
}
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/android/telephony/CallerInfoAsyncQuery.java
similarity index 98%
rename from telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
rename to telephony/java/android/telephony/CallerInfoAsyncQuery.java
index e9a177d..87a6376 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telephony/java/android/telephony/CallerInfoAsyncQuery.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.internal.telephony;
+package android.telephony;
import android.app.ActivityManager;
import android.content.AsyncQueryHandler;
@@ -31,11 +31,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.ContactsContract.PhoneLookup;
-import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
-import android.telephony.Rlog;
-import android.telephony.SubscriptionManager;
-
import java.util.ArrayList;
import java.util.List;
@@ -340,16 +336,16 @@
// Use the number entered by the user for display.
if (!TextUtils.isEmpty(cw.number)) {
- mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
+ mCallerInfo.setPhoneNumber(PhoneNumberUtils.formatNumber(cw.number,
mCallerInfo.normalizedNumber,
- CallerInfo.getCurrentCountryIso(mContext));
+ CallerInfo.getCurrentCountryIso(mContext)));
}
// This condition refer to the google default code for geo.
// If the number exists in Contacts, the CallCard would never show
// the geo description, so it would be unnecessary to query it.
if (ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION) {
- if (TextUtils.isEmpty(mCallerInfo.name)) {
+ if (TextUtils.isEmpty(mCallerInfo.getName())) {
if (DBG) Rlog.d(LOG_TAG, "start querying geo description");
cw.event = EVENT_GET_GEO_DESCRIPTION;
startQuery(token, cw, null, null, null, null, null);
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index 432978d..b7dab16 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -35,6 +35,15 @@
/** @hide */
public static final int INVALID_CHANNEL_NUMBER = -1;
+ /**
+ * parameters for validation
+ * @hide
+ */
+ public static final int MCC_LENGTH = 3;
+
+ private static final int MNC_MIN_LENGTH = 2;
+ private static final int MNC_MAX_LENGTH = 3;
+
// Log tag
/** @hide */
protected final String mTag;
@@ -207,6 +216,17 @@
dest.writeString(mAlphaShort);
}
+ /** Used by phone interface manager to verify if a given string is valid MccMnc
+ * @hide
+ */
+ public static boolean isValidPlmn(@NonNull String plmn) {
+ if (plmn.length() < MCC_LENGTH + MNC_MIN_LENGTH
+ || plmn.length() > MCC_LENGTH + MNC_MAX_LENGTH) {
+ return false;
+ }
+ return (isMcc(plmn.substring(0, MCC_LENGTH)) && isMnc(plmn.substring(MCC_LENGTH)));
+ }
+
/**
* Construct from Parcel
* @hide
@@ -267,10 +287,10 @@
/** @hide */
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
- if (mcc.length() != 3) return false;
+ if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
@@ -280,7 +300,7 @@
/** @hide */
private static boolean isMnc(@NonNull String mnc) {
// ensure no out of bounds indexing
- if (mnc.length() < 2 || mnc.length() > 3) return false;
+ if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < mnc.length(); i++) {
@@ -289,4 +309,5 @@
return true;
}
+
}
diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java
index c078764..dc991b9 100644
--- a/telephony/java/android/telephony/SmsCbMessage.java
+++ b/telephony/java/android/telephony/SmsCbMessage.java
@@ -207,17 +207,19 @@
/** CMAS warning area coordinates. */
private final List<Geometry> mGeometries;
+ private int mSlotIndex = 0;
+
/**
* Create a new SmsCbMessage with the specified data.
*/
public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
@NonNull SmsCbLocation location, int serviceCategory, @Nullable String language,
@Nullable String body, int priority, @Nullable SmsCbEtwsInfo etwsWarningInfo,
- @Nullable SmsCbCmasInfo cmasWarningInfo) {
+ @Nullable SmsCbCmasInfo cmasWarningInfo, int slotIndex) {
this(messageFormat, geographicalScope, serialNumber, location, serviceCategory, language,
body, priority, etwsWarningInfo, cmasWarningInfo, 0 /* maximumWaitingTime */,
- null /* geometries */, System.currentTimeMillis());
+ null /* geometries */, System.currentTimeMillis(), slotIndex);
}
/**
@@ -227,7 +229,8 @@
public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
SmsCbLocation location, int serviceCategory, String language, String body,
int priority, SmsCbEtwsInfo etwsWarningInfo, SmsCbCmasInfo cmasWarningInfo,
- int maximumWaitTimeSec, List<Geometry> geometries, long receivedTimeMillis) {
+ int maximumWaitTimeSec, List<Geometry> geometries, long receivedTimeMillis,
+ int slotIndex) {
mMessageFormat = messageFormat;
mGeographicalScope = geographicalScope;
mSerialNumber = serialNumber;
@@ -241,6 +244,7 @@
mReceivedTimeMillis = receivedTimeMillis;
mGeometries = geometries;
mMaximumWaitTimeSec = maximumWaitTimeSec;
+ mSlotIndex = slotIndex;
}
/**
@@ -278,6 +282,7 @@
String geoStr = in.readString();
mGeometries = geoStr != null ? CbGeoUtils.parseGeometriesFromString(geoStr) : null;
mMaximumWaitTimeSec = in.readInt();
+ mSlotIndex = in.readInt();
}
/**
@@ -312,6 +317,7 @@
dest.writeString(
mGeometries != null ? CbGeoUtils.encodeGeometriesToString(mGeometries) : null);
dest.writeInt(mMaximumWaitTimeSec);
+ dest.writeInt(mSlotIndex);
}
@NonNull
@@ -423,6 +429,14 @@
}
/**
+ * Get the slotIndex associated with this message.
+ * @return the slotIndex associated with this message
+ */
+ public int getSlotIndex() {
+ return mSlotIndex;
+ }
+
+ /**
* Get the message format ({@link #MESSAGE_FORMAT_3GPP} or {@link #MESSAGE_FORMAT_3GPP2}).
* @return an integer representing 3GPP or 3GPP2 message format
*/
@@ -502,6 +516,7 @@
+ (mEtwsWarningInfo != null ? (", " + mEtwsWarningInfo.toString()) : "")
+ (mCmasWarningInfo != null ? (", " + mCmasWarningInfo.toString()) : "")
+ ", maximumWaitingTime = " + mMaximumWaitTimeSec
+ + ", slotIndex = " + mSlotIndex
+ ", geo=" + (mGeometries != null
? CbGeoUtils.encodeGeometriesToString(mGeometries) : "null")
+ '}';
@@ -522,6 +537,7 @@
@NonNull
public ContentValues getContentValues() {
ContentValues cv = new ContentValues(16);
+ cv.put(CellBroadcasts.SLOT_INDEX, mSlotIndex);
cv.put(CellBroadcasts.GEOGRAPHICAL_SCOPE, mGeographicalScope);
if (mLocation.getPlmn() != null) {
cv.put(CellBroadcasts.PLMN, mLocation.getPlmn());
@@ -563,6 +579,7 @@
}
cv.put(CellBroadcasts.MAXIMUM_WAIT_TIME, mMaximumWaitTimeSec);
+ cv.put(CellBroadcasts.SLOT_INDEX, mSlotIndex);
return cv;
}
@@ -584,6 +601,7 @@
String body = cursor.getString(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_BODY));
int format = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_FORMAT));
int priority = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_PRIORITY));
+ int slotIndex = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.SLOT_INDEX));
String plmn;
int plmnColumn = cursor.getColumnIndex(CellBroadcasts.PLMN);
@@ -681,7 +699,7 @@
return new SmsCbMessage(format, geoScope, serialNum, location, category,
language, body, priority, etwsInfo, cmasInfo, maximumWaitTimeSec, geometries,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
}
/**
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 42d65e2..1aac919 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -6756,6 +6756,40 @@
}
/**
+ * Replace the contents of the forbidden PLMN SIM file with the provided values.
+ * Passing an empty list will clear the contents of the EFfplmn file.
+ * If the provided list is shorter than the size of EFfplmn, then the list will be padded
+ * up to the file size with 'FFFFFF'. (required by 3GPP TS 31.102 spec 4.2.16)
+ * If the list is longer than the size of EFfplmn, then the file will be written from the
+ * beginning of the list up to the file size.
+ *
+ * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ *
+ * @param fplmns a list of PLMNs to be forbidden.
+ *
+ * @return number of PLMNs that were successfully written to the SIM FPLMN list.
+ * This may be less than the number of PLMNs passed in where the SIM file does not have enough
+ * room for all of the values passed in. Return -1 in the event of an unexpected failure
+ */
+ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public int setForbiddenPlmns(@NonNull List<String> fplmns) {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony == null) return 0;
+ return telephony.setForbiddenPlmns(
+ getSubId(), APPTYPE_USIM, fplmns, getOpPackageName());
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "setForbiddenPlmns RemoteException: " + ex.getMessage());
+ } catch (NullPointerException ex) {
+ // This could happen before phone starts
+ Rlog.e(TAG, "setForbiddenPlmns NullPointerException: " + ex.getMessage());
+ }
+ return 0;
+ }
+
+ /**
* Get P-CSCF address from PCO after data connection is established or modified.
* @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN
* @return array of P-CSCF address
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 919a0b0..e4674f1 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1603,6 +1603,18 @@
String[] getForbiddenPlmns(int subId, int appType, String callingPackage);
/**
+ * Set the forbidden PLMN list from the givven app type (ex APPTYPE_USIM) on a particular
+ * subscription.
+ *
+ * @param subId subId the id of the subscription
+ * @param appType appType the uicc app type, must be USIM or SIM.
+ * @param fplmns plmns the Forbiden plmns list that needed to be written to the SIM.
+ * @param content callingPackage the op Package name.
+ * @return number of fplmns that is successfully written to the SIM
+ */
+ int setForbiddenPlmns(int subId, int appType, in List<String> fplmns, String callingPackage);
+
+ /**
* Check if phone is in emergency callback mode
* @return true if phone is in emergency callback mode
* @param subId the subscription ID that this action applies to.
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index ebc98d6..2a16421 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -859,8 +859,9 @@
* Parses a broadcast SMS, possibly containing a CMAS alert.
*
* @param plmn the PLMN for a broadcast SMS
+ * @param subId
*/
- public SmsCbMessage parseBroadcastSms(String plmn) {
+ public SmsCbMessage parseBroadcastSms(String plmn, int subId) {
BearerData bData = BearerData.decode(mEnvelope.bearerData, mEnvelope.serviceCategory);
if (bData == null) {
Rlog.w(LOG_TAG, "BearerData.decode() returned null");
@@ -876,7 +877,7 @@
return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP2,
SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE, bData.messageId, location,
mEnvelope.serviceCategory, bData.getLanguage(), bData.userData.payloadStr,
- bData.priority, null, bData.cmasWarningInfo);
+ bData.priority, null, bData.cmasWarningInfo, subId);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
index c65c45f..c3d490a 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
@@ -90,9 +90,10 @@
* Create a new SmsCbMessage object from a header object plus one or more received PDUs.
*
* @param pdus PDU bytes
+ * @slotIndex slotIndex for which received sms cb message
*/
public static SmsCbMessage createSmsCbMessage(Context context, SmsCbHeader header,
- SmsCbLocation location, byte[][] pdus)
+ SmsCbLocation location, byte[][] pdus, int slotIndex)
throws IllegalArgumentException {
long receivedTimeMillis = System.currentTimeMillis();
if (header.isEtwsPrimaryNotification()) {
@@ -104,7 +105,7 @@
header.getSerialNumber(), location, header.getServiceCategory(), null,
getEtwsPrimaryMessage(context, header.getEtwsInfo().getWarningType()),
SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, header.getEtwsInfo(),
- header.getCmasInfo(), 0, null /* geometries */, receivedTimeMillis);
+ header.getCmasInfo(), 0, null /* geometries */, receivedTimeMillis, slotIndex);
} else if (header.isUmtsFormat()) {
// UMTS format has only 1 PDU
byte[] pdu = pdus[0];
@@ -138,7 +139,7 @@
header.getGeographicalScope(), header.getSerialNumber(), location,
header.getServiceCategory(), language, body, priority,
header.getEtwsInfo(), header.getCmasInfo(), maximumWaitingTimeSec, geometries,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
} else {
String language = null;
StringBuilder sb = new StringBuilder();
@@ -154,7 +155,7 @@
header.getGeographicalScope(), header.getSerialNumber(), location,
header.getServiceCategory(), language, sb.toString(), priority,
header.getEtwsInfo(), header.getCmasInfo(), 0, null /* geometries */,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
}
}
diff --git a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
index 6b3df94..96e215c 100644
--- a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
+++ b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
@@ -22,9 +22,11 @@
import android.graphics.Color;
import android.telephony.Rlog;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.GsmAlphabet;
import java.io.UnsupportedEncodingException;
+import java.util.List;
/**
* Various methods, useful for dealing with SIM data.
@@ -32,6 +34,11 @@
public class IccUtils {
static final String LOG_TAG="IccUtils";
+ // 3GPP specification constants
+ // Spec reference TS 31.102 section 4.2.16
+ @VisibleForTesting
+ static final int FPLMN_BYTE_SIZE = 3;
+
// A table mapping from a number to a hex character for fast encoding hex strings.
private static final char[] HEX_CHARS = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
@@ -883,4 +890,27 @@
}
return 0;
}
+
+ /**
+ * Encode the Fplmns into byte array to write to EF.
+ *
+ * @param fplmns Array of fplmns to be serialized.
+ * @param dataLength the size of the EF file.
+ * @return the encoded byte array in the correct format for FPLMN file.
+ */
+ public static byte[] encodeFplmns(List<String> fplmns, int dataLength) {
+ byte[] serializedFplmns = new byte[dataLength];
+ int offset = 0;
+ for (String fplmn : fplmns) {
+ if (offset >= dataLength) break;
+ stringToBcdPlmn(fplmn, serializedFplmns, offset);
+ offset += FPLMN_BYTE_SIZE;
+ }
+ //pads to the length of the EF file.
+ while (offset < dataLength) {
+ // required by 3GPP TS 31.102 spec 4.2.16
+ serializedFplmns[offset++] = (byte) 0xff;
+ }
+ return serializedFplmns;
+ }
}
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index ccdd452..81937e6 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -54,11 +54,15 @@
assertTrue("profile system server not enabled", res != null && res.equals("true"));
}
- private void forceSaveProfile(String pkg) throws Exception {
+ private boolean forceSaveProfile(String pkg) throws Exception {
String pid = mTestDevice.executeShellCommand("pidof " + pkg).trim();
- assertTrue("Invalid pid " + pid, pid.length() > 0);
+ if (pid.length() == 0) {
+ // Not yet running.
+ return false;
+ }
String res = mTestDevice.executeShellCommand("kill -s SIGUSR1 " + pid).trim();
assertTrue("kill SIGUSR1: " + res, res.length() == 0);
+ return true;
}
@Test
@@ -71,10 +75,13 @@
// Wait up to 20 seconds for the profile to be saved.
for (int i = 0; i < 20; ++i) {
// Force save the profile since we truncated it.
- forceSaveProfile("system_server");
- String s = mTestDevice.executeShellCommand("wc -c <" + SYSTEM_SERVER_PROFILE).trim();
- if (!"0".equals(s)) {
- break;
+ if (forceSaveProfile("system_server")) {
+ // Might fail if system server is not yet running.
+ String s = mTestDevice.executeShellCommand(
+ "wc -c <" + SYSTEM_SERVER_PROFILE).trim();
+ if (!"0".equals(s)) {
+ break;
+ }
}
Thread.sleep(1000);
}
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
index beb5e0d..b9b2238 100644
--- a/tests/net/Android.bp
+++ b/tests/net/Android.bp
@@ -44,7 +44,11 @@
android_test {
name: "FrameworksNetTests",
defaults: ["FrameworksNetTests-jni-defaults"],
- srcs: ["java/**/*.java", "java/**/*.kt"],
+ srcs: [
+ ":tethering-tests-src",
+ "java/**/*.java",
+ "java/**/*.kt",
+ ],
platform_apis: true,
test_suites: ["device-tests"],
certificate: "platform",
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index 46e27c1..1f2bb0a 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -30,6 +30,7 @@
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import android.app.Instrumentation;
import android.content.Context;
@@ -283,6 +284,107 @@
assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_BYTES, msg);
}
+ // Hexadecimal representation of InetDiagReqV2 request with extension, INET_DIAG_INFO.
+ private static final String INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0100" + // flags = NLM_F_REQUEST
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "02" + // family = AF_INET
+ "06" + // protcol = IPPROTO_TCP
+ "02" + // idiag_ext = INET_DIAG_INFO
+ "00" + // pad
+ "ffffffff" + // idiag_states
+ // inet_diag_sockid
+ "3039" + // idiag_sport = 12345
+ "d431" + // idiag_dport = 54321
+ "01020304000000000000000000000000" + // idiag_src = 1.2.3.4
+ "08080404000000000000000000000000" + // idiag_dst = 8.8.4.4
+ "00000000" + // idiag_if
+ "ffffffffffffffff"; // idiag_cookie = INET_DIAG_NOCOOKIE
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_HEX.toCharArray(), false);
+ private static final int TCP_ALL_STATES = 0xffffffff;
+ @Test
+ public void testInetDiagReqV2TcpInetWithExt() throws Exception {
+ InetSocketAddress local = new InetSocketAddress(
+ InetAddress.getByName("1.2.3.4"), 12345);
+ InetSocketAddress remote = new InetSocketAddress(InetAddress.getByName("8.8.4.4"),
+ 54321);
+ byte[] msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, remote, AF_INET,
+ NLM_F_REQUEST, 0 /* pad */, 2 /* idiagExt */, TCP_ALL_STATES);
+
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET_INET_DIAG_BYTES, msg);
+
+ local = new InetSocketAddress(
+ InetAddress.getByName("fe80::86c9:b2ff:fe6a:ed4b"), 42462);
+ remote = new InetSocketAddress(InetAddress.getByName("8.8.8.8"),
+ 47473);
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, remote, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_BYTES, msg);
+ }
+
+ // Hexadecimal representation of InetDiagReqV2 request with no socket specified.
+ private static final String INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFIED_HEX =
+ // struct nlmsghdr
+ "48000000" + // length = 72
+ "1400" + // type = SOCK_DIAG_BY_FAMILY
+ "0100" + // flags = NLM_F_REQUEST
+ "00000000" + // seqno
+ "00000000" + // pid (0 == kernel)
+ // struct inet_diag_req_v2
+ "0a" + // family = AF_INET6
+ "06" + // protcol = IPPROTO_TCP
+ "00" + // idiag_ext
+ "00" + // pad
+ "ffffffff" + // idiag_states
+ // inet_diag_sockid
+ "0000" + // idiag_sport
+ "0000" + // idiag_dport
+ "00000000000000000000000000000000" + // idiag_src
+ "00000000000000000000000000000000" + // idiag_dst
+ "00000000" + // idiag_if
+ "0000000000000000"; // idiag_cookie
+
+ private static final byte[] INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES =
+ HexEncoding.decode(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFIED_HEX.toCharArray(), false);
+
+ @Test
+ public void testInetDiagReqV2TcpInet6NoIdSpecified() throws Exception {
+ InetSocketAddress local = new InetSocketAddress(
+ InetAddress.getByName("fe80::fe6a:ed4b"), 12345);
+ InetSocketAddress remote = new InetSocketAddress(InetAddress.getByName("8.8.4.4"),
+ 54321);
+ // Verify no socket specified if either local or remote socket address is null.
+ byte[] msgExt = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ byte[] msg;
+ try {
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, remote, AF_INET6,
+ NLM_F_REQUEST);
+ fail("Both remote and local should be null, expected UnknownHostException");
+ } catch (NullPointerException e) {
+ }
+
+ try {
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, local, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ fail("Both remote and local should be null, expected UnknownHostException");
+ } catch (NullPointerException e) {
+ }
+
+ msg = InetDiagMessage.InetDiagReqV2(IPPROTO_TCP, null, null, AF_INET6,
+ NLM_F_REQUEST, 0 /* pad */, 0 /* idiagExt */, TCP_ALL_STATES);
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES, msg);
+ assertArrayEquals(INET_DIAG_REQ_V2_TCP_INET6_NO_ID_SPECIFED_BYTES, msgExt);
+ }
+
// Hexadecimal representation of InetDiagReqV2 request.
private static final String INET_DIAG_MSG_HEX =
// struct nlmsghdr
diff --git a/tools/stats_log_api_gen/Android.bp b/tools/stats_log_api_gen/Android.bp
index 4ce4406..c08f9b0 100644
--- a/tools/stats_log_api_gen/Android.bp
+++ b/tools/stats_log_api_gen/Android.bp
@@ -95,7 +95,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "libstatslog",
host_supported: true,
generated_sources: ["statslog.cpp"],