summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityManager.java4
-rw-r--r--core/java/android/app/ApplicationPackageManager.java3
-rw-r--r--core/java/android/bluetooth/BluetoothTetheringDataTracker.java203
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl3
-rw-r--r--core/java/android/content/pm/PackageInfo.java7
-rw-r--r--core/java/android/content/pm/PackageManager.java118
-rw-r--r--core/java/android/content/pm/PackageParser.java14
-rw-r--r--core/java/android/content/pm/PackageUserState.java3
-rw-r--r--core/java/android/hardware/usb/UsbDeviceConnection.java75
-rw-r--r--core/java/android/net/BaseNetworkStateTracker.java6
-rw-r--r--core/java/android/net/ConnectivityManager.java14
-rw-r--r--core/java/android/net/DummyDataStateTracker.java6
-rw-r--r--core/java/android/net/EthernetDataTracker.java6
-rw-r--r--core/java/android/net/IConnectivityManager.aidl3
-rw-r--r--core/java/android/net/LinkCapabilities.java2
-rw-r--r--core/java/android/net/LinkProperties.java2
-rw-r--r--core/java/android/net/MobileDataStateTracker.java15
-rw-r--r--core/java/android/net/NetworkStateTracker.java30
-rw-r--r--core/java/android/net/RouteInfo.java5
-rw-r--r--core/java/android/os/INetworkManagementService.aidl10
-rw-r--r--core/java/android/os/UserManager.java55
-rw-r--r--core/java/android/view/ViewGroup.java82
22 files changed, 477 insertions, 189 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 944a533..bb9e19f 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -896,7 +896,7 @@ public class ActivityManager {
* @param taskId The identifier of the task to be moved, as found in
* {@link RunningTaskInfo} or {@link RecentTaskInfo}.
* @param flags Additional operational flags, 0 or more of
- * {@link #MOVE_TASK_WITH_HOME}.
+ * {@link #MOVE_TASK_WITH_HOME}, {@link #MOVE_TASK_NO_USER_ACTION}.
*/
public void moveTaskToFront(int taskId, int flags) {
moveTaskToFront(taskId, flags, null);
@@ -911,7 +911,7 @@ public class ActivityManager {
* @param taskId The identifier of the task to be moved, as found in
* {@link RunningTaskInfo} or {@link RecentTaskInfo}.
* @param flags Additional operational flags, 0 or more of
- * {@link #MOVE_TASK_WITH_HOME}.
+ * {@link #MOVE_TASK_WITH_HOME}, {@link #MOVE_TASK_NO_USER_ACTION}.
* @param options Additional options for the operation, either null or
* as per {@link Context#startActivity(Intent, android.os.Bundle)
* Context.startActivity(Intent, Bundle)}.
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 6d55dd5..271494f 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1279,7 +1279,8 @@ final class ApplicationPackageManager extends PackageManager {
public void setApplicationEnabledSetting(String packageName,
int newState, int flags) {
try {
- mPM.setApplicationEnabledSetting(packageName, newState, flags, mContext.getUserId());
+ mPM.setApplicationEnabledSetting(packageName, newState, flags,
+ mContext.getUserId(), mContext.getBasePackageName());
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
index 43c2392..81c0a6a 100644
--- a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
+++ b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java
@@ -21,6 +21,7 @@ import android.os.ServiceManager;
import android.os.INetworkManagementService;
import android.content.Context;
import android.net.ConnectivityManager;
+import android.net.DhcpResults;
import android.net.LinkCapabilities;
import android.net.LinkProperties;
import android.net.NetworkInfo;
@@ -28,7 +29,10 @@ import android.net.NetworkInfo.DetailedState;
import android.net.NetworkStateTracker;
import android.net.NetworkUtils;
import android.os.Handler;
+import android.os.Looper;
import android.os.Message;
+import android.os.Messenger;
+import android.text.TextUtils;
import android.util.Log;
import java.net.InterfaceAddress;
import android.net.LinkAddress;
@@ -36,8 +40,11 @@ import android.net.RouteInfo;
import java.net.Inet4Address;
import android.os.SystemProperties;
+import com.android.internal.util.AsyncChannel;
+
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
/**
* This class tracks the data connection associated with Bluetooth
@@ -51,24 +58,29 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
private static final String NETWORKTYPE = "BLUETOOTH_TETHER";
private static final String TAG = "BluetoothTethering";
private static final boolean DBG = true;
- private static final boolean VDBG = false;
+ private static final boolean VDBG = true;
private AtomicBoolean mTeardownRequested = new AtomicBoolean(false);
private AtomicBoolean mPrivateDnsRouteSet = new AtomicBoolean(false);
private AtomicInteger mDefaultGatewayAddr = new AtomicInteger(0);
private AtomicBoolean mDefaultRouteSet = new AtomicBoolean(false);
+ private final Object mLinkPropertiesLock = new Object();
private LinkProperties mLinkProperties;
+
private LinkCapabilities mLinkCapabilities;
+
+ private final Object mNetworkInfoLock = new Object();
private NetworkInfo mNetworkInfo;
private BluetoothPan mBluetoothPan;
- private static String mIface;
- private Thread mDhcpThread;
+ private static String mRevTetheredIface;
/* For sending events to connectivity service handler */
private Handler mCsHandler;
- private Context mContext;
- public static BluetoothTetheringDataTracker sInstance;
+ protected Context mContext;
+ private static BluetoothTetheringDataTracker sInstance;
+ private BtdtHandler mBtdtHandler;
+ private AtomicReference<AsyncChannel> mAsyncChannel = new AtomicReference<AsyncChannel>(null);
private BluetoothTetheringDataTracker() {
mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_BLUETOOTH, 0, NETWORKTYPE, "");
@@ -108,6 +120,7 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
if (adapter != null) {
adapter.getProfileProxy(mContext, mProfileServiceListener, BluetoothProfile.PAN);
}
+ mBtdtHandler = new BtdtHandler(target.getLooper(), this);
}
private BluetoothProfile.ServiceListener mProfileServiceListener =
@@ -224,15 +237,19 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
/**
* Fetch NetworkInfo for the network
*/
- public synchronized NetworkInfo getNetworkInfo() {
- return mNetworkInfo;
+ public NetworkInfo getNetworkInfo() {
+ synchronized (mNetworkInfoLock) {
+ return new NetworkInfo(mNetworkInfo);
+ }
}
/**
* Fetch LinkProperties for the network
*/
- public synchronized LinkProperties getLinkProperties() {
- return new LinkProperties(mLinkProperties);
+ public LinkProperties getLinkProperties() {
+ synchronized (mLinkPropertiesLock) {
+ return new LinkProperties(mLinkProperties);
+ }
}
/**
@@ -286,88 +303,68 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
return count;
}
-
- private boolean readLinkProperty(String iface) {
- String DhcpPrefix = "dhcp." + iface + ".";
- String ip = SystemProperties.get(DhcpPrefix + "ipaddress");
- String dns1 = SystemProperties.get(DhcpPrefix + "dns1");
- String dns2 = SystemProperties.get(DhcpPrefix + "dns2");
- String gateway = SystemProperties.get(DhcpPrefix + "gateway");
- String mask = SystemProperties.get(DhcpPrefix + "mask");
- if(ip.isEmpty() || gateway.isEmpty()) {
- Log.e(TAG, "readLinkProperty, ip: " + ip + ", gateway: " + gateway + ", can not be empty");
- return false;
+ void startReverseTether(final LinkProperties linkProperties) {
+ if (linkProperties == null || TextUtils.isEmpty(linkProperties.getInterfaceName())) {
+ Log.e(TAG, "attempted to reverse tether with empty interface");
+ return;
}
- int PrefixLen = countPrefixLength(NetworkUtils.numericToInetAddress(mask).getAddress());
- mLinkProperties.addLinkAddress(new LinkAddress(NetworkUtils.numericToInetAddress(ip), PrefixLen));
- RouteInfo ri = new RouteInfo(NetworkUtils.numericToInetAddress(gateway));
- mLinkProperties.addRoute(ri);
- if(!dns1.isEmpty())
- mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns1));
- if(!dns2.isEmpty())
- mLinkProperties.addDns(NetworkUtils.numericToInetAddress(dns2));
- mLinkProperties.setInterfaceName(iface);
- return true;
- }
- public synchronized void startReverseTether(String iface) {
- mIface = iface;
- if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
- mDhcpThread = new Thread(new Runnable() {
+ synchronized (mLinkPropertiesLock) {
+ if (mLinkProperties.getInterfaceName() != null) {
+ Log.e(TAG, "attempted to reverse tether while already in process");
+ return;
+ }
+ mLinkProperties = linkProperties;
+ }
+ Thread dhcpThread = new Thread(new Runnable() {
public void run() {
- //TODO(): Add callbacks for failure and success case.
//Currently this thread runs independently.
- if (DBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
- String DhcpResultName = "dhcp." + mIface + ".result";;
- String result = "";
- if (VDBG) Log.d(TAG, "waiting for change of sys prop dhcp result: " + DhcpResultName);
- for(int i = 0; i < 30*5; i++) {
- try { Thread.sleep(200); } catch (InterruptedException ie) { return;}
- result = SystemProperties.get(DhcpResultName);
- if (VDBG) Log.d(TAG, "read " + DhcpResultName + ": " + result);
- if(result.equals("failed")) {
- Log.e(TAG, "startReverseTether, failed to start dhcp service");
+ DhcpResults dhcpResults = new DhcpResults();
+ boolean success = NetworkUtils.runDhcp(linkProperties.getInterfaceName(),
+ dhcpResults);
+ synchronized (mLinkPropertiesLock) {
+ if (linkProperties.getInterfaceName() != mLinkProperties.getInterfaceName()) {
+ Log.e(TAG, "obsolete DHCP run aborted");
return;
}
- if(result.equals("ok")) {
- if (VDBG) Log.d(TAG, "startReverseTether, dhcp resut: " + result);
- if(readLinkProperty(mIface)) {
-
- mNetworkInfo.setIsAvailable(true);
- mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null);
-
- if (VDBG) Log.d(TAG, "startReverseTether mCsHandler: " + mCsHandler);
- if(mCsHandler != null) {
- Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
- msg.sendToTarget();
-
- msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
- msg.sendToTarget();
- }
- }
+ if (!success) {
+ Log.e(TAG, "DHCP request error:" + NetworkUtils.getDhcpError());
return;
}
+ mLinkProperties = dhcpResults.linkProperties;
+ synchronized (mNetworkInfoLock) {
+ mNetworkInfo.setIsAvailable(true);
+ mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null);
+ if (mCsHandler != null) {
+ Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED,
+ new NetworkInfo(mNetworkInfo));
+ msg.sendToTarget();
+ }
+ }
+ return;
}
- Log.e(TAG, "startReverseTether, dhcp failed, resut: " + result);
}
});
- mDhcpThread.start();
+ dhcpThread.start();
}
- public synchronized void stopReverseTether() {
- //NetworkUtils.stopDhcp(iface);
- if(mDhcpThread != null && mDhcpThread.isAlive()) {
- mDhcpThread.interrupt();
- try { mDhcpThread.join(); } catch (InterruptedException ie) { return; }
+ void stopReverseTether() {
+ synchronized (mLinkPropertiesLock) {
+ if (TextUtils.isEmpty(mLinkProperties.getInterfaceName())) {
+ Log.e(TAG, "attempted to stop reverse tether with nothing tethered");
+ return;
+ }
+ NetworkUtils.stopDhcp(mLinkProperties.getInterfaceName());
+ mLinkProperties.clear();
+ synchronized (mNetworkInfoLock) {
+ mNetworkInfo.setIsAvailable(false);
+ mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null);
+
+ if (mCsHandler != null) {
+ mCsHandler.obtainMessage(EVENT_STATE_CHANGED, new NetworkInfo(mNetworkInfo)).
+ sendToTarget();
+ }
+ }
}
- mLinkProperties.clear();
- mNetworkInfo.setIsAvailable(false);
- mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null);
-
- Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
- msg.sendToTarget();
-
- msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
- msg.sendToTarget();
}
public void setDependencyMet(boolean met) {
@@ -383,4 +380,54 @@ public class BluetoothTetheringDataTracker implements NetworkStateTracker {
public void removeStackedLink(LinkProperties link) {
mLinkProperties.removeStackedLink(link);
}
+
+ static class BtdtHandler extends Handler {
+ private AsyncChannel mStackChannel;
+ private final BluetoothTetheringDataTracker mBtdt;
+
+ BtdtHandler(Looper looper, BluetoothTetheringDataTracker parent) {
+ super(looper);
+ mBtdt = parent;
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
+ if (VDBG) Log.d(TAG, "got CMD_CHANNEL_HALF_CONNECTED");
+ if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
+ AsyncChannel ac = (AsyncChannel)msg.obj;
+ if (mBtdt.mAsyncChannel.compareAndSet(null, ac) == false) {
+ Log.e(TAG, "Trying to set mAsyncChannel twice!");
+ } else {
+ ac.sendMessage(
+ AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
+ }
+ }
+ break;
+ case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
+ if (VDBG) Log.d(TAG, "got CMD_CHANNEL_DISCONNECTED");
+ mBtdt.stopReverseTether();
+ mBtdt.mAsyncChannel.set(null);
+ break;
+ case NetworkStateTracker.EVENT_NETWORK_CONNECTED:
+ LinkProperties linkProperties = (LinkProperties)(msg.obj);
+ if (VDBG) Log.d(TAG, "got EVENT_NETWORK_CONNECTED, " + linkProperties);
+ mBtdt.startReverseTether(linkProperties);
+ break;
+ case NetworkStateTracker.EVENT_NETWORK_DISCONNECTED:
+ linkProperties = (LinkProperties)(msg.obj);
+ if (VDBG) Log.d(TAG, "got EVENT_NETWORK_DISCONNECTED, " + linkProperties);
+ mBtdt.stopReverseTether();
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void supplyMessenger(Messenger messenger) {
+ if (messenger != null) {
+ new AsyncChannel().connect(mContext, mBtdtHandler, messenger);
+ }
+ }
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index a32a201..a0e1555 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -239,7 +239,8 @@ interface IPackageManager {
/**
* As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
*/
- void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId);
+ void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
+ int userId, String callingPackage);
/**
* As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 77ca7f6..fb539c5 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -154,7 +154,7 @@ public class PackageInfo implements Parcelable {
/**
* Flag for {@link #requestedPermissionsFlags}: the requested permission
* is required for the application to run; the user can not optionally
- * disable it. Currently all permissions are required.
+ * disable it.
*/
public static final int REQUESTED_PERMISSION_REQUIRED = 1<<0;
@@ -221,6 +221,9 @@ public class PackageInfo implements Parcelable {
/** @hide */
public boolean requiredForAllUsers;
+ /** @hide */
+ public String restrictedAccountType;
+
public PackageInfo() {
}
@@ -262,6 +265,7 @@ public class PackageInfo implements Parcelable {
dest.writeTypedArray(reqFeatures, parcelableFlags);
dest.writeInt(installLocation);
dest.writeInt(requiredForAllUsers ? 1 : 0);
+ dest.writeString(restrictedAccountType);
}
public static final Parcelable.Creator<PackageInfo> CREATOR
@@ -301,5 +305,6 @@ public class PackageInfo implements Parcelable {
reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
installLocation = source.readInt();
requiredForAllUsers = source.readInt() != 0;
+ restrictedAccountType = source.readString();
}
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 0bea138..9afbe6f 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -45,7 +45,7 @@ public abstract class PackageManager {
/**
* This exception is thrown when a given package, application, or component
- * name can not be found.
+ * name cannot be found.
*/
public static class NameNotFoundException extends AndroidException {
public NameNotFoundException() {
@@ -267,7 +267,7 @@ public abstract class PackageManager {
* user has explicitly disabled the application, regardless of what it has
* specified in its manifest. Because this is due to the user's request,
* they may re-enable it if desired through the appropriate system UI. This
- * option currently <strong>can not</strong> be used with
+ * option currently <strong>cannot</strong> be used with
* {@link #setComponentEnabledSetting(ComponentName, int, int)}.
*/
public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
@@ -1264,6 +1264,23 @@ public abstract class PackageManager {
= "android.content.pm.extra.VERIFICATION_VERSION_CODE";
/**
+ * The action used to request that the user approve a permission request
+ * from the application.
+ *
+ * @hide
+ */
+ public static final String ACTION_REQUEST_PERMISSION
+ = "android.content.pm.action.REQUEST_PERMISSION";
+
+ /**
+ * Extra field name for the list of permissions, which the user must approve.
+ *
+ * @hide
+ */
+ public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST
+ = "android.content.pm.extra.PERMISSION_LIST";
+
+ /**
* Retrieve overall information about an application package that is
* installed on the system.
* <p>
@@ -1283,9 +1300,9 @@ public abstract class PackageManager {
* package. If flag GET_UNINSTALLED_PACKAGES is set and if the
* package is not found in the list of installed applications, the
* package information is retrieved from the list of uninstalled
- * applications(which includes installed applications as well as
- * applications with data directory ie applications which had been
- * deleted with DONT_DELTE_DATA flag set).
+ * applications (which includes installed applications as well as
+ * applications with data directory i.e. applications which had been
+ * deleted with {@code DONT_DELETE_DATA} flag set).
* @see #GET_ACTIVITIES
* @see #GET_GIDS
* @see #GET_CONFIGURATIONS
@@ -1326,7 +1343,7 @@ public abstract class PackageManager {
* null if neither are found.
*
* <p>Throws {@link NameNotFoundException} if a package with the given
- * name can not be found on the system.
+ * name cannot be found on the system.
*
* @param packageName The name of the package to inspect.
*
@@ -1341,7 +1358,7 @@ public abstract class PackageManager {
* assigned to a package.
*
* <p>Throws {@link NameNotFoundException} if a package with the given
- * name can not be found on the system.
+ * name cannot be found on the system.
*
* @param packageName The full name (i.e. com.google.apps.contacts) of the
* desired package.
@@ -1372,7 +1389,7 @@ public abstract class PackageManager {
* Retrieve all of the information we know about a particular permission.
*
* <p>Throws {@link NameNotFoundException} if a permission with the given
- * name can not be found on the system.
+ * name cannot be found on the system.
*
* @param name The fully qualified name (i.e. com.google.permission.LOGIN)
* of the permission you are interested in.
@@ -1408,7 +1425,7 @@ public abstract class PackageManager {
* permissions.
*
* <p>Throws {@link NameNotFoundException} if a permission group with the given
- * name can not be found on the system.
+ * name cannot be found on the system.
*
* @param name The fully qualified name (i.e. com.google.permission_group.APPS)
* of the permission you are interested in.
@@ -1437,7 +1454,7 @@ public abstract class PackageManager {
* package/application.
*
* <p>Throws {@link NameNotFoundException} if an application with the given
- * package name can not be found on the system.
+ * package name cannot be found on the system.
*
* @param packageName The full name (i.e. com.google.apps.contacts) of an
* application.
@@ -1453,7 +1470,7 @@ public abstract class PackageManager {
* list of uninstalled applications(which includes
* installed applications as well as applications
* with data directory ie applications which had been
- * deleted with DONT_DELTE_DATA flag set).
+ * deleted with {@code DONT_DELETE_DATA} flag set).
*
* @see #GET_META_DATA
* @see #GET_SHARED_LIBRARY_FILES
@@ -1467,7 +1484,7 @@ public abstract class PackageManager {
* class.
*
* <p>Throws {@link NameNotFoundException} if an activity with the given
- * class name can not be found on the system.
+ * class name cannot be found on the system.
*
* @param component The full component name (i.e.
* com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
@@ -1490,7 +1507,7 @@ public abstract class PackageManager {
* class.
*
* <p>Throws {@link NameNotFoundException} if a receiver with the given
- * class name can not be found on the system.
+ * class name cannot be found on the system.
*
* @param component The full component name (i.e.
* com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
@@ -1513,7 +1530,7 @@ public abstract class PackageManager {
* class.
*
* <p>Throws {@link NameNotFoundException} if a service with the given
- * class name can not be found on the system.
+ * class name cannot be found on the system.
*
* @param component The full component name (i.e.
* com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
@@ -1535,7 +1552,7 @@ public abstract class PackageManager {
* provider class.
*
* <p>Throws {@link NameNotFoundException} if a provider with the given
- * class name can not be found on the system.
+ * class name cannot be found on the system.
*
* @param component The full component name (i.e.
* com.google.providers.media/com.google.providers.media.MediaProvider) of a
@@ -1572,7 +1589,7 @@ public abstract class PackageManager {
* installed on the device. In the unlikely case of there being no
* installed packages, an empty list is returned.
* If flag GET_UNINSTALLED_PACKAGES is set, a list of all
- * applications including those deleted with DONT_DELETE_DATA
+ * applications including those deleted with {@code DONT_DELETE_DATA}
* (partially installed apps with data directory) will be returned.
*
* @see #GET_ACTIVITIES
@@ -1642,7 +1659,7 @@ public abstract class PackageManager {
* installed on the device. In the unlikely case of there being no
* installed packages, an empty list is returned.
* If flag GET_UNINSTALLED_PACKAGES is set, a list of all
- * applications including those deleted with DONT_DELETE_DATA
+ * applications including those deleted with {@code DONT_DELETE_DATA}
* (partially installed apps with data directory) will be returned.
*
* @see #GET_ACTIVITIES
@@ -1735,6 +1752,29 @@ public abstract class PackageManager {
public abstract void removePermission(String name);
/**
+ * Returns an {@link Intent} suitable for passing to {@code startActivityForResult}
+ * which prompts the user to grant {@code permissions} to this application.
+ *
+ * @throws NullPointerException if {@code permissions} is {@code null}.
+ * @throws IllegalArgumentException if {@code permissions} contains {@code null}.
+ */
+ public Intent buildPermissionRequestIntent(String... permissions) {
+ if (permissions == null) {
+ throw new NullPointerException("permissions cannot be null");
+ }
+ for (String permission : permissions) {
+ if (permission == null) {
+ throw new IllegalArgumentException("permissions cannot contain null");
+ }
+ }
+
+ Intent i = new Intent(ACTION_REQUEST_PERMISSION);
+ i.putExtra(EXTRA_REQUEST_PERMISSION_PERMISSION_LIST, permissions);
+ i.setPackage("com.android.packageinstaller");
+ return i;
+ }
+
+ /**
* Grant a permission to an application which the application does not
* already have. The permission must have been requested by the application,
* but as an optional permission. If the application is not allowed to
@@ -1847,7 +1887,7 @@ public abstract class PackageManager {
/**
* Return a List of all application packages that are installed on the
* device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
- * applications including those deleted with DONT_DELETE_DATA (partially
+ * applications including those deleted with {@code DONT_DELETE_DATA} (partially
* installed apps with data directory) will be returned.
*
* @param flags Additional option flags. Use any combination of
@@ -1858,7 +1898,7 @@ public abstract class PackageManager {
* is installed on the device. In the unlikely case of there being
* no installed applications, an empty list is returned.
* If flag GET_UNINSTALLED_PACKAGES is set, a list of all
- * applications including those deleted with DONT_DELETE_DATA
+ * applications including those deleted with {@code DONT_DELETE_DATA}
* (partially installed apps with data directory) will be returned.
*
* @see #GET_META_DATA
@@ -2164,7 +2204,7 @@ public abstract class PackageManager {
* instrumentation class.
*
* <p>Throws {@link NameNotFoundException} if instrumentation with the
- * given class name can not be found on the system.
+ * given class name cannot be found on the system.
*
* @param className The full name (i.e.
* com.google.apps.contacts.InstrumentList) of an
@@ -2201,8 +2241,8 @@ public abstract class PackageManager {
* icon.
*
* @param packageName The name of the package that this icon is coming from.
- * Can not be null.
- * @param resid The resource identifier of the desired image. Can not be 0.
+ * Cannot be null.
+ * @param resid The resource identifier of the desired image. Cannot be 0.
* @param appInfo Overall information about <var>packageName</var>. This
* may be null, in which case the application information will be retrieved
* for you if needed; if you already have this information around, it can
@@ -2218,7 +2258,7 @@ public abstract class PackageManager {
* Retrieve the icon associated with an activity. Given the full name of
* an activity, retrieves the information about it and calls
* {@link ComponentInfo#loadIcon ComponentInfo.loadIcon()} to return its icon.
- * If the activity can not be found, NameNotFoundException is thrown.
+ * If the activity cannot be found, NameNotFoundException is thrown.
*
* @param activityName Name of the activity whose icon is to be retrieved.
*
@@ -2237,7 +2277,7 @@ public abstract class PackageManager {
* set, this simply returns the result of
* getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's
* component and returns the icon associated with the resolved component.
- * If intent.getClassName() can not be found or the Intent can not be resolved
+ * If intent.getClassName() cannot be found or the Intent cannot be resolved
* to a component, NameNotFoundException is thrown.
*
* @param intent The intent for which you would like to retrieve an icon.
@@ -2276,7 +2316,7 @@ public abstract class PackageManager {
/**
* Retrieve the icon associated with an application. Given the name of the
* application's package, retrieves the information about it and calls
- * getApplicationIcon() to return its icon. If the application can not be
+ * getApplicationIcon() to return its icon. If the application cannot be
* found, NameNotFoundException is thrown.
*
* @param packageName Name of the package whose application icon is to be
@@ -2296,7 +2336,7 @@ public abstract class PackageManager {
* Retrieve the logo associated with an activity. Given the full name of
* an activity, retrieves the information about it and calls
* {@link ComponentInfo#loadLogo ComponentInfo.loadLogo()} to return its logo.
- * If the activity can not be found, NameNotFoundException is thrown.
+ * If the activity cannot be found, NameNotFoundException is thrown.
*
* @param activityName Name of the activity whose logo is to be retrieved.
*
@@ -2316,7 +2356,7 @@ public abstract class PackageManager {
* set, this simply returns the result of
* getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's
* component and returns the logo associated with the resolved component.
- * If intent.getClassName() can not be found or the Intent can not be resolved
+ * If intent.getClassName() cannot be found or the Intent cannot be resolved
* to a component, NameNotFoundException is thrown.
*
* @param intent The intent for which you would like to retrieve a logo.
@@ -2348,7 +2388,7 @@ public abstract class PackageManager {
/**
* Retrieve the logo associated with an application. Given the name of the
* application's package, retrieves the information about it and calls
- * getApplicationLogo() to return its logo. If the application can not be
+ * getApplicationLogo() to return its logo. If the application cannot be
* found, NameNotFoundException is thrown.
*
* @param packageName Name of the package whose application logo is to be
@@ -2372,8 +2412,8 @@ public abstract class PackageManager {
* labels and other text.
*
* @param packageName The name of the package that this text is coming from.
- * Can not be null.
- * @param resid The resource identifier of the desired text. Can not be 0.
+ * Cannot be null.
+ * @param resid The resource identifier of the desired text. Cannot be 0.
* @param appInfo Overall information about <var>packageName</var>. This
* may be null, in which case the application information will be retrieved
* for you if needed; if you already have this information around, it can
@@ -2390,8 +2430,8 @@ public abstract class PackageManager {
* retrieve XML meta data.
*
* @param packageName The name of the package that this xml is coming from.
- * Can not be null.
- * @param resid The resource identifier of the desired xml. Can not be 0.
+ * Cannot be null.
+ * @param resid The resource identifier of the desired xml. Cannot be 0.
* @param appInfo Overall information about <var>packageName</var>. This
* may be null, in which case the application information will be retrieved
* for you if needed; if you already have this information around, it can
@@ -2409,7 +2449,7 @@ public abstract class PackageManager {
*
* @return Returns the label associated with this application, or null if
* it could not be found for any reason.
- * @param info The application to get the label of
+ * @param info The application to get the label of.
*/
public abstract CharSequence getApplicationLabel(ApplicationInfo info);
@@ -2417,7 +2457,7 @@ public abstract class PackageManager {
* Retrieve the resources associated with an activity. Given the full
* name of an activity, retrieves the information about it and calls
* getResources() to return its application's resources. If the activity
- * can not be found, NameNotFoundException is thrown.
+ * cannot be found, NameNotFoundException is thrown.
*
* @param activityName Name of the activity whose resources are to be
* retrieved.
@@ -2448,7 +2488,7 @@ public abstract class PackageManager {
* Retrieve the resources associated with an application. Given the full
* package name of an application, retrieves the information about it and
* calls getResources() to return its application's resources. If the
- * appPackageName can not be found, NameNotFoundException is thrown.
+ * appPackageName cannot be found, NameNotFoundException is thrown.
*
* @param appPackageName Package name of the application whose resources
* are to be retrieved.
@@ -2617,7 +2657,7 @@ public abstract class PackageManager {
* {@link PackageManager#VERIFICATION_REJECT}.
*
* @param id pending package identifier as passed via the
- * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra
+ * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
* @param verificationCode either {@link PackageManager#VERIFICATION_ALLOW}
* or {@link PackageManager#VERIFICATION_REJECT}.
* @throws SecurityException if the caller does not have the
@@ -2638,7 +2678,7 @@ public abstract class PackageManager {
* will have no effect.
*
* @param id pending package identifier as passed via the
- * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra
+ * {@link PackageManager#EXTRA_VERIFICATION_ID} Intent extra.
* @param verificationCodeAtTimeout either
* {@link PackageManager#VERIFICATION_ALLOW} or
* {@link PackageManager#VERIFICATION_REJECT}. If
@@ -2870,7 +2910,7 @@ public abstract class PackageManager {
/**
* @deprecated This is a protected API that should not have been available
* to third party applications. It is the platform's responsibility for
- * assigning preferred activities and this can not be directly modified.
+ * assigning preferred activities and this cannot be directly modified.
*
* Add a new preferred activity mapping to the system. This will be used
* to automatically select the given activity component when
@@ -2904,7 +2944,7 @@ public abstract class PackageManager {
/**
* @deprecated This is a protected API that should not have been available
* to third party applications. It is the platform's responsibility for
- * assigning preferred activities and this can not be directly modified.
+ * assigning preferred activities and this cannot be directly modified.
*
* Replaces an existing preferred activity mapping to the system, and if that were not present
* adds a new preferred activity. This will be used
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 149b8e5..11f9be9 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -290,6 +290,7 @@ public class PackageParser {
pi.applicationInfo = generateApplicationInfo(p, flags, state, userId);
pi.installLocation = p.installLocation;
pi.requiredForAllUsers = p.mRequiredForAllUsers;
+ pi.restrictedAccountType = p.mRestrictedAccountType;
pi.firstInstallTime = firstInstallTime;
pi.lastUpdateTime = lastUpdateTime;
if ((flags&PackageManager.GET_GIDS) != 0) {
@@ -1023,16 +1024,14 @@ public class PackageParser {
// that may change.
String name = sa.getNonResourceString(
com.android.internal.R.styleable.AndroidManifestUsesPermission_name);
- /* Not supporting optional permissions yet.
boolean required = sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestUsesPermission_required, true);
- */
sa.recycle();
if (name != null && !pkg.requestedPermissions.contains(name)) {
pkg.requestedPermissions.add(name.intern());
- pkg.requestedPermissionsRequired.add(Boolean.TRUE);
+ pkg.requestedPermissionsRequired.add(required ? Boolean.TRUE : Boolean.FALSE);
}
XmlUtils.skipCurrentTag(parser);
@@ -1766,6 +1765,11 @@ public class PackageParser {
false)) {
owner.mRequiredForAllUsers = true;
}
+ String accountType = sa.getString(com.android.internal.R.styleable
+ .AndroidManifestApplication_restrictedAccountType);
+ if (accountType != null && accountType.length() > 0) {
+ owner.mRestrictedAccountType = accountType;
+ }
}
if (sa.getBoolean(
@@ -3193,6 +3197,7 @@ public class PackageParser {
}
public final static class Package {
+
public String packageName;
// For now we only support one application per package.
@@ -3280,6 +3285,9 @@ public class PackageParser {
/* An app that's required for all users and cannot be uninstalled for a user */
public boolean mRequiredForAllUsers;
+ /* The restricted account authenticator type that is used by this application */
+ public String mRestrictedAccountType;
+
/**
* Digest suitable for comparing whether this package's manifest is the
* same as another.
diff --git a/core/java/android/content/pm/PackageUserState.java b/core/java/android/content/pm/PackageUserState.java
index 3579977..dcd54fc 100644
--- a/core/java/android/content/pm/PackageUserState.java
+++ b/core/java/android/content/pm/PackageUserState.java
@@ -30,6 +30,8 @@ public class PackageUserState {
public boolean installed;
public int enabled;
+ public String lastDisableAppCaller;
+
public HashSet<String> disabledComponents;
public HashSet<String> enabledComponents;
@@ -43,6 +45,7 @@ public class PackageUserState {
stopped = o.stopped;
notLaunched = o.notLaunched;
enabled = o.enabled;
+ lastDisableAppCaller = o.lastDisableAppCaller;
disabledComponents = o.disabledComponents != null
? new HashSet<String>(o.disabledComponents) : null;
enabledComponents = o.enabledComponents != null
diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java
index b536490..3358f8c 100644
--- a/core/java/android/hardware/usb/UsbDeviceConnection.java
+++ b/core/java/android/hardware/usb/UsbDeviceConnection.java
@@ -17,7 +17,6 @@
package android.hardware.usb;
import android.os.ParcelFileDescriptor;
-import android.util.Log;
import java.io.FileDescriptor;
@@ -119,10 +118,41 @@ public class UsbDeviceConnection {
* @param timeout in milliseconds
* @return length of data transferred (or zero) for success,
* or negative value for failure
+ *
+ * @deprecate Use {@link #controlTransfer(int, int, int, int, byte[], int, int, int)}
+ * which accepts a buffer start index.
*/
+ @Deprecated
public int controlTransfer(int requestType, int request, int value,
int index, byte[] buffer, int length, int timeout) {
- return native_control_request(requestType, request, value, index, buffer, length, timeout);
+ return controlTransfer(requestType, request, value, index, buffer, 0, length, timeout);
+ }
+
+ /**
+ * Performs a control transaction on endpoint zero for this device.
+ * The direction of the transfer is determined by the request type.
+ * If requestType & {@link UsbConstants#USB_ENDPOINT_DIR_MASK} is
+ * {@link UsbConstants#USB_DIR_OUT}, then the transfer is a write,
+ * and if it is {@link UsbConstants#USB_DIR_IN}, then the transfer
+ * is a read.
+ *
+ * @param requestType request type for this transaction
+ * @param request request ID for this transaction
+ * @param value value field for this transaction
+ * @param index index field for this transaction
+ * @param buffer buffer for data portion of transaction,
+ * or null if no data needs to be sent or received
+ * @param start the index of the first byte in the buffer to send or receive
+ * @param length the length of the data to send or receive
+ * @param timeout in milliseconds
+ * @return length of data transferred (or zero) for success,
+ * or negative value for failure
+ */
+ public int controlTransfer(int requestType, int request, int value, int index,
+ byte[] buffer, int start, int length, int timeout) {
+ checkBounds(buffer, start, length);
+ return native_control_request(requestType, request, value, index,
+ buffer, start, length, timeout);
}
/**
@@ -130,14 +160,37 @@ public class UsbDeviceConnection {
* The direction of the transfer is determined by the direction of the endpoint
*
* @param endpoint the endpoint for this transaction
- * @param buffer buffer for data to send or receive,
+ * @param buffer buffer for data to send or receive
* @param length the length of the data to send or receive
* @param timeout in milliseconds
* @return length of data transferred (or zero) for success,
* or negative value for failure
+ *
+ * @deprecate Use {@link #bulkTransfer(UsbEndpoint, byte[], int, int, int)}
+ * which accepts a buffer start index.
*/
- public int bulkTransfer(UsbEndpoint endpoint, byte[] buffer, int length, int timeout) {
- return native_bulk_request(endpoint.getAddress(), buffer, length, timeout);
+ @Deprecated
+ public int bulkTransfer(UsbEndpoint endpoint,
+ byte[] buffer, int length, int timeout) {
+ return bulkTransfer(endpoint, buffer, 0, length, timeout);
+ }
+
+ /**
+ * Performs a bulk transaction on the given endpoint.
+ * The direction of the transfer is determined by the direction of the endpoint
+ *
+ * @param endpoint the endpoint for this transaction
+ * @param buffer buffer for data to send or receive
+ * @param start the index of the first byte in the buffer to send or receive
+ * @param length the length of the data to send or receive
+ * @param timeout in milliseconds
+ * @return length of data transferred (or zero) for success,
+ * or negative value for failure
+ */
+ public int bulkTransfer(UsbEndpoint endpoint,
+ byte[] buffer, int start, int length, int timeout) {
+ checkBounds(buffer, start, length);
+ return native_bulk_request(endpoint.getAddress(), buffer, start, length, timeout);
}
/**
@@ -168,6 +221,13 @@ public class UsbDeviceConnection {
return native_get_serial();
}
+ private static void checkBounds(byte[] buffer, int start, int length) {
+ final int bufferLength = (buffer != null ? buffer.length : 0);
+ if (start < 0 || start + length > bufferLength) {
+ throw new IllegalArgumentException("Buffer start or length out of bounds.");
+ }
+ }
+
private native boolean native_open(String deviceName, FileDescriptor pfd);
private native void native_close();
private native int native_get_fd();
@@ -175,8 +235,9 @@ public class UsbDeviceConnection {
private native boolean native_claim_interface(int interfaceID, boolean force);
private native boolean native_release_interface(int interfaceID);
private native int native_control_request(int requestType, int request, int value,
- int index, byte[] buffer, int length, int timeout);
- private native int native_bulk_request(int endpoint, byte[] buffer, int length, int timeout);
+ int index, byte[] buffer, int start, int length, int timeout);
+ private native int native_bulk_request(int endpoint, byte[] buffer,
+ int start, int length, int timeout);
private native UsbRequest native_request_wait();
private native String native_get_serial();
}
diff --git a/core/java/android/net/BaseNetworkStateTracker.java b/core/java/android/net/BaseNetworkStateTracker.java
index a554611..1165281 100644
--- a/core/java/android/net/BaseNetworkStateTracker.java
+++ b/core/java/android/net/BaseNetworkStateTracker.java
@@ -18,6 +18,7 @@ package android.net;
import android.content.Context;
import android.os.Handler;
+import android.os.Messenger;
import com.android.internal.util.Preconditions;
@@ -165,4 +166,9 @@ public abstract class BaseNetworkStateTracker implements NetworkStateTracker {
public void removeStackedLink(LinkProperties link) {
mLinkProperties.removeStackedLink(link);
}
+
+ @Override
+ public void supplyMessenger(Messenger messenger) {
+ // not supported on this network
+ }
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 3a04c27..4e4980d 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -23,6 +23,7 @@ import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context;
import android.os.Binder;
import android.os.Build.VERSION_CODES;
+import android.os.Messenger;
import android.os.RemoteException;
import android.provider.Settings;
@@ -1280,4 +1281,17 @@ public class ConnectivityManager {
}
}
+ /**
+ * Supply the backend messenger for a network tracker
+ *
+ * @param type NetworkType to set
+ * @param messenger {@link Messenger}
+ * {@hide}
+ */
+ public void supplyMessenger(int networkType, Messenger messenger) {
+ try {
+ mService.supplyMessenger(networkType, messenger);
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/core/java/android/net/DummyDataStateTracker.java b/core/java/android/net/DummyDataStateTracker.java
index db8f0bc..15a81f3 100644
--- a/core/java/android/net/DummyDataStateTracker.java
+++ b/core/java/android/net/DummyDataStateTracker.java
@@ -19,6 +19,7 @@ package android.net;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
+import android.os.Messenger;
import android.util.Slog;
/**
@@ -213,6 +214,11 @@ public class DummyDataStateTracker implements NetworkStateTracker {
mLinkProperties.removeStackedLink(link);
}
+ @Override
+ public void supplyMessenger(Messenger messenger) {
+ // not supported on this network
+ }
+
static private void log(String s) {
Slog.d(TAG, s);
}
diff --git a/core/java/android/net/EthernetDataTracker.java b/core/java/android/net/EthernetDataTracker.java
index b744a47..27d5a58 100644
--- a/core/java/android/net/EthernetDataTracker.java
+++ b/core/java/android/net/EthernetDataTracker.java
@@ -22,6 +22,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.Message;
+import android.os.Messenger;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
@@ -417,4 +418,9 @@ public class EthernetDataTracker implements NetworkStateTracker {
public void removeStackedLink(LinkProperties link) {
mLinkProperties.removeStackedLink(link);
}
+
+ @Override
+ public void supplyMessenger(Messenger messenger) {
+ // not supported on this network
+ }
}
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 056fa03..9e9b43d 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -22,6 +22,7 @@ import android.net.NetworkQuotaInfo;
import android.net.NetworkState;
import android.net.ProxyProperties;
import android.os.IBinder;
+import android.os.Messenger;
import android.os.ParcelFileDescriptor;
import com.android.internal.net.LegacyVpnInfo;
@@ -126,4 +127,6 @@ interface IConnectivityManager
boolean updateLockdownVpn();
void captivePortalCheckComplete(in NetworkInfo info);
+
+ void supplyMessenger(int networkType, in Messenger messenger);
}
diff --git a/core/java/android/net/LinkCapabilities.java b/core/java/android/net/LinkCapabilities.java
index eb9166f..fb444ea 100644
--- a/core/java/android/net/LinkCapabilities.java
+++ b/core/java/android/net/LinkCapabilities.java
@@ -314,8 +314,8 @@ public class LinkCapabilities implements Parcelable {
sb.append(":\"");
sb.append(entry.getValue());
sb.append("\"");
- return mCapabilities.toString();
}
+ sb.append("}");
return sb.toString();
}
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index eedc372..52b238f 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -290,7 +290,7 @@ public class LinkProperties implements Parcelable {
}
stacked += "] ";
}
- return ifaceName + linkAddresses + routes + dns + domainName + proxy + stacked;
+ return "{" + ifaceName + linkAddresses + routes + dns + domainName + proxy + stacked + "}";
}
/**
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index faf739b..e85dbcd 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -74,7 +74,6 @@ public class MobileDataStateTracker implements NetworkStateTracker {
private Handler mHandler;
private AsyncChannel mDataConnectionTrackerAc;
- private Messenger mMessenger;
/**
* Create a new MobileDataStateTracker
@@ -103,7 +102,6 @@ public class MobileDataStateTracker implements NetworkStateTracker {
IntentFilter filter = new IntentFilter();
filter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
filter.addAction(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED);
- filter.addAction(DctConstants.ACTION_DATA_CONNECTION_TRACKER_MESSENGER);
mContext.registerReceiver(new MobileDataStateReceiver(), filter);
mMobileDataState = PhoneConstants.DataState.DISCONNECTED;
@@ -285,13 +283,6 @@ public class MobileDataStateTracker implements NetworkStateTracker {
" broadcast" + reason == null ? "" : "(" + reason + ")");
}
setDetailedState(DetailedState.FAILED, reason, apnName);
- } else if (intent.getAction().equals(DctConstants
- .ACTION_DATA_CONNECTION_TRACKER_MESSENGER)) {
- if (VDBG) log(mApnType + " got ACTION_DATA_CONNECTION_TRACKER_MESSENGER");
- mMessenger =
- intent.getParcelableExtra(DctConstants.EXTRA_MESSENGER);
- AsyncChannel ac = new AsyncChannel();
- ac.connect(mContext, MobileDataStateTracker.this.mHandler, mMessenger);
} else {
if (DBG) log("Broadcast received: ignore " + intent.getAction());
}
@@ -613,6 +604,12 @@ public class MobileDataStateTracker implements NetworkStateTracker {
return new LinkCapabilities(mLinkCapabilities);
}
+ public void supplyMessenger(Messenger messenger) {
+ if (VDBG) log(mApnType + " got supplyMessenger");
+ AsyncChannel ac = new AsyncChannel();
+ ac.connect(mContext, MobileDataStateTracker.this.mHandler, messenger);
+ }
+
private void log(String s) {
Slog.d(TAG, mApnType + ": " + s);
}
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java
index b22159c..cf77a1c 100644
--- a/core/java/android/net/NetworkStateTracker.java
+++ b/core/java/android/net/NetworkStateTracker.java
@@ -18,6 +18,9 @@ package android.net;
import android.content.Context;
import android.os.Handler;
+import android.os.Messenger;
+
+import static com.android.internal.util.Protocol.BASE_NETWORK_STATE_TRACKER;
/**
* Interface provides the {@link com.android.server.ConnectivityService}
@@ -48,25 +51,38 @@ public interface NetworkStateTracker {
* msg.what = EVENT_STATE_CHANGED
* msg.obj = NetworkInfo object
*/
- public static final int EVENT_STATE_CHANGED = 1;
+ public static final int EVENT_STATE_CHANGED = BASE_NETWORK_STATE_TRACKER;
/**
* msg.what = EVENT_CONFIGURATION_CHANGED
* msg.obj = NetworkInfo object
*/
- public static final int EVENT_CONFIGURATION_CHANGED = 3;
+ public static final int EVENT_CONFIGURATION_CHANGED = BASE_NETWORK_STATE_TRACKER + 1;
/**
* msg.what = EVENT_RESTORE_DEFAULT_NETWORK
* msg.obj = FeatureUser object
*/
- public static final int EVENT_RESTORE_DEFAULT_NETWORK = 6;
+ public static final int EVENT_RESTORE_DEFAULT_NETWORK = BASE_NETWORK_STATE_TRACKER + 2;
/**
* msg.what = EVENT_NETWORK_SUBTYPE_CHANGED
* msg.obj = NetworkInfo object
*/
- public static final int EVENT_NETWORK_SUBTYPE_CHANGED = 7;
+ public static final int EVENT_NETWORK_SUBTYPE_CHANGED = BASE_NETWORK_STATE_TRACKER + 3;
+
+ /**
+ * msg.what = EVENT_NETWORK_CONNECTED
+ * msg.obj = LinkProperties object
+ */
+ public static final int EVENT_NETWORK_CONNECTED = BASE_NETWORK_STATE_TRACKER + 4;
+
+ /**
+ * msg.what = EVENT_NETWORK_CONNECTION_DISCONNECTED
+ * msg.obj = LinkProperties object, same iface name
+ */
+ public static final int EVENT_NETWORK_DISCONNECTED = BASE_NETWORK_STATE_TRACKER + 5;
+
/**
* -------------------------------------------------------------
@@ -207,4 +223,10 @@ public interface NetworkStateTracker {
* Informs the state tracker that a stacked interface has been removed.
**/
public void removeStackedLink(LinkProperties link);
+
+ /*
+ * Called once to setup async channel between this and
+ * the underlying network specific code.
+ */
+ public void supplyMessenger(Messenger messenger);
}
diff --git a/core/java/android/net/RouteInfo.java b/core/java/android/net/RouteInfo.java
index 3a7abc0..cc3c5f7 100644
--- a/core/java/android/net/RouteInfo.java
+++ b/core/java/android/net/RouteInfo.java
@@ -132,7 +132,10 @@ public class RouteInfo implements Parcelable {
}
private boolean isHost() {
- return (mGateway.equals(Inet4Address.ANY) || mGateway.equals(Inet6Address.ANY));
+ return (mDestination.getAddress() instanceof Inet4Address &&
+ mDestination.getNetworkPrefixLength() == 32) ||
+ (mDestination.getAddress() instanceof Inet6Address &&
+ mDestination.getNetworkPrefixLength() == 128);
}
private boolean isDefault() {
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index 4b83611..45524c8 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -152,16 +152,6 @@ interface INetworkManagementService
boolean isTetheringStarted();
/**
- * Start bluetooth reverse tethering services
- */
- void startReverseTethering(in String iface);
-
- /**
- * Stop currently running bluetooth reserse tethering services
- */
- void stopReverseTethering();
-
- /**
* Tethers the specified interface
*/
void tetherInterface(String iface);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 622308f..1ba16bd 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -86,8 +86,42 @@ public class UserManager {
* @see #setUserRestrictions(Bundle)
* @see #getUserRestrictions()
*/
+
public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
+ /**
+ * Key for user restrictions. Specifies if a user is disallowed from enabling the
+ * "Unknown Sources" setting, that allows installation of apps from unknown sources.
+ * The default value is <code>false</code>.
+ * <p/>
+ * Type: Boolean
+ * @see #setUserRestrictions(Bundle)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources";
+
+ /**
+ * Key for user restrictions. Specifies if a user is disallowed from configuring bluetooth.
+ * The default value is <code>false</code>.
+ * <p/>
+ * Type: Boolean
+ * @see #setUserRestrictions(Bundle)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
+
+
+ /**
+ * Key for user restrictions. Specifies if a user is disallowed from transferring files over
+ * USB. The default value is <code>false</code>.
+ * <p/>
+ * Type: Boolean
+ * @see #setUserRestrictions(Bundle)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer";
+
+
/** @hide */
public UserManager(Context context, IUserManager service) {
mService = service;
@@ -130,7 +164,7 @@ public class UserManager {
/**
* Used to determine whether the user making this call is subject to
* teleportations.
- * @return whether the user making this call is a goat
+ * @return whether the user making this call is a goat
*/
public boolean isUserAGoat() {
return false;
@@ -272,6 +306,16 @@ public class UserManager {
}
/**
+ * @hide
+ * Returns whether the current user has been disallowed from performing certain actions
+ * or setting certain settings.
+ * @param restrictionKey the string key representing the restriction
+ */
+ public boolean hasUserRestriction(String restrictionKey) {
+ return getUserRestrictions().getBoolean(restrictionKey, false);
+ }
+
+ /**
* Return the serial number for a user. This is a device-unique
* number assigned to that user; if the user is deleted and then a new
* user created, the new users will not be given the same serial number.
@@ -465,7 +509,7 @@ public class UserManager {
* Returns the maximum number of users that can be created on this device. A return value
* of 1 means that it is a single user device.
* @hide
- * @return a value greater than or equal to 1
+ * @return a value greater than or equal to 1
*/
public static int getMaxSupportedUsers() {
// Don't allow multiple users on certain builds
@@ -508,13 +552,6 @@ public class UserManager {
return -1;
}
- /**
- * Returns whether the current user is allowed to toggle location sharing settings.
- * @hide
- */
- public boolean isLocationSharingToggleAllowed() {
- return !getUserRestrictions().getBoolean(DISALLOW_SHARE_LOCATION, false);
- }
/**
* @hide
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 98edeae..dd36022 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5890,6 +5890,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
private boolean mNeedResolution = false;
private boolean mIsRtlCompatibilityMode = true;
+ private static int UNDEFINED_MARGIN = DEFAULT_MARGIN_RELATIVE;
+
+ private boolean mLeftMarginUndefined = false;
+ private boolean mRightMarginUndefined = false;
+
/**
* Creates a new set of layout parameters. The values are extracted from
* the supplied attributes set and context.
@@ -5916,16 +5921,26 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
} else {
leftMargin = a.getDimensionPixelSize(
R.styleable.ViewGroup_MarginLayout_layout_marginLeft,
- DEFAULT_MARGIN_RESOLVED);
- topMargin = a.getDimensionPixelSize(
- R.styleable.ViewGroup_MarginLayout_layout_marginTop,
- DEFAULT_MARGIN_RESOLVED);
+ UNDEFINED_MARGIN);
+ if (leftMargin == UNDEFINED_MARGIN) {
+ mLeftMarginUndefined = true;
+ leftMargin = DEFAULT_MARGIN_RESOLVED;
+ }
rightMargin = a.getDimensionPixelSize(
R.styleable.ViewGroup_MarginLayout_layout_marginRight,
+ UNDEFINED_MARGIN);
+ if (rightMargin == UNDEFINED_MARGIN) {
+ mRightMarginUndefined = true;
+ rightMargin = DEFAULT_MARGIN_RESOLVED;
+ }
+
+ topMargin = a.getDimensionPixelSize(
+ R.styleable.ViewGroup_MarginLayout_layout_marginTop,
DEFAULT_MARGIN_RESOLVED);
bottomMargin = a.getDimensionPixelSize(
R.styleable.ViewGroup_MarginLayout_layout_marginBottom,
DEFAULT_MARGIN_RESOLVED);
+
startMargin = a.getDimensionPixelSize(
R.styleable.ViewGroup_MarginLayout_layout_marginStart,
DEFAULT_MARGIN_RELATIVE);
@@ -5949,6 +5964,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
public MarginLayoutParams(int width, int height) {
super(width, height);
+ mLeftMarginUndefined = true;
+ mRightMarginUndefined = true;
+
mNeedResolution = false;
mIsRtlCompatibilityMode = false;
}
@@ -5969,6 +5987,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
this.startMargin = source.startMargin;
this.endMargin = source.endMargin;
+ this.mLeftMarginUndefined = source.mLeftMarginUndefined;
+ this.mRightMarginUndefined = source.mRightMarginUndefined;
+
this.mNeedResolution = source.mNeedResolution;
this.mIsRtlCompatibilityMode = source.mIsRtlCompatibilityMode;
@@ -5981,6 +6002,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
public MarginLayoutParams(LayoutParams source) {
super(source);
+ mLeftMarginUndefined = true;
+ mRightMarginUndefined = true;
+
mNeedResolution = false;
mIsRtlCompatibilityMode = false;
}
@@ -6005,6 +6029,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
topMargin = top;
rightMargin = right;
bottomMargin = bottom;
+ mLeftMarginUndefined = false;
+ mRightMarginUndefined = false;
mNeedResolution = isMarginRelative();
}
@@ -6147,30 +6173,42 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// No relative margin or pre JB-MR1 case or no need to resolve, just dont do anything
// Will use the left and right margins if no relative margin is defined.
- if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode) return;
+ if (!isMarginRelative() || !mNeedResolution) return;
// Proceed with resolution
doResolveMargins();
}
private void doResolveMargins() {
- // We have some relative margins (either the start one or the end one or both). So use
- // them and override what has been defined for left and right margins. If either start
- // or end margin is not defined, just set it to default "0".
- switch(mLayoutDirection) {
- case View.LAYOUT_DIRECTION_RTL:
- leftMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
- endMargin : DEFAULT_MARGIN_RESOLVED;
- rightMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
- startMargin : DEFAULT_MARGIN_RESOLVED;
- break;
- case View.LAYOUT_DIRECTION_LTR:
- default:
- leftMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
- startMargin : DEFAULT_MARGIN_RESOLVED;
- rightMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
- endMargin : DEFAULT_MARGIN_RESOLVED;
- break;
+
+ if (mIsRtlCompatibilityMode) {
+ // if left or right margins are not defined and if we have some start or end margin
+ // defined then use those start and end margins.
+ if (mLeftMarginUndefined && startMargin > DEFAULT_MARGIN_RELATIVE) {
+ leftMargin = startMargin;
+ }
+ if (mRightMarginUndefined && endMargin > DEFAULT_MARGIN_RELATIVE) {
+ rightMargin = endMargin;
+ }
+ } else {
+ // We have some relative margins (either the start one or the end one or both). So use
+ // them and override what has been defined for left and right margins. If either start
+ // or end margin is not defined, just set it to default "0".
+ switch(mLayoutDirection) {
+ case View.LAYOUT_DIRECTION_RTL:
+ leftMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
+ endMargin : DEFAULT_MARGIN_RESOLVED;
+ rightMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
+ startMargin : DEFAULT_MARGIN_RESOLVED;
+ break;
+ case View.LAYOUT_DIRECTION_LTR:
+ default:
+ leftMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
+ startMargin : DEFAULT_MARGIN_RESOLVED;
+ rightMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
+ endMargin : DEFAULT_MARGIN_RESOLVED;
+ break;
+ }
}
mNeedResolution = false;
}