diff options
-rw-r--r-- | core/java/android/bluetooth/BluetoothTetheringDataTracker.java | 299 | ||||
-rw-r--r-- | core/java/android/net/ConnectivityManager.java | 10 | ||||
-rw-r--r-- | core/java/android/server/BluetoothEventLoop.java | 8 | ||||
-rw-r--r-- | core/java/android/server/BluetoothService.java | 17 | ||||
-rw-r--r-- | core/res/res/layout-xlarge/keyguard_screen_status_land.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout-xlarge/keyguard_screen_status_port.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_tab_unlock.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_tab_unlock_land.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_unlock_landscape.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout/keyguard_screen_unlock_portrait.xml | 5 | ||||
-rw-r--r-- | core/res/res/values/colors.xml | 5 | ||||
-rw-r--r-- | data/fonts/AndroidClock.ttf | bin | 2336 -> 3004 bytes | |||
-rw-r--r-- | data/fonts/AndroidClock_Highlight.ttf | bin | 2212 -> 2872 bytes | |||
-rw-r--r-- | services/java/com/android/server/ClipboardService.java | 4 | ||||
-rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 11 |
15 files changed, 356 insertions, 28 deletions
diff --git a/core/java/android/bluetooth/BluetoothTetheringDataTracker.java b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java new file mode 100644 index 0000000..7b083f1 --- /dev/null +++ b/core/java/android/bluetooth/BluetoothTetheringDataTracker.java @@ -0,0 +1,299 @@ +/* + * Copyright (C) 2010 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. + */ + +package android.bluetooth; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.DhcpInfo; +import android.net.LinkAddress; +import android.net.LinkCapabilities; +import android.net.LinkProperties; +import android.net.NetworkInfo; +import android.net.NetworkInfo.DetailedState; +import android.net.NetworkStateTracker; +import android.net.NetworkUtils; +import android.os.Handler; +import android.os.Message; +import android.util.Log; + +import java.net.InetAddress; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * This class tracks the data connection associated with Bluetooth + * reverse tethering. This is a singleton class and an instance will be + * created by ConnectivityService. BluetoothService will call into this + * when a reverse tethered connection needs to be activated. + * + * @hide + */ +public class BluetoothTetheringDataTracker implements NetworkStateTracker { + private static final String NETWORKTYPE = "BLUETOOTH_TETHER"; + private static final String TAG = "BluetoothTethering"; + + 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 LinkProperties mLinkProperties; + private LinkCapabilities mLinkCapabilities; + private NetworkInfo mNetworkInfo; + + private BluetoothPan mBluetoothPan; + private BluetoothDevice mDevice; + private static String mIface; + + /* For sending events to connectivity service handler */ + private Handler mCsHandler; + private Context mContext; + public static BluetoothTetheringDataTracker sInstance; + + private BluetoothTetheringDataTracker() { + mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_BLUETOOTH, 0, NETWORKTYPE, ""); + mLinkProperties = new LinkProperties(); + mLinkCapabilities = new LinkCapabilities(); + + mNetworkInfo.setIsAvailable(false); + setTeardownRequested(false); + } + + public static synchronized BluetoothTetheringDataTracker getInstance() { + if (sInstance == null) sInstance = new BluetoothTetheringDataTracker(); + return sInstance; + } + + public Object Clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException(); + } + + public void setTeardownRequested(boolean isRequested) { + mTeardownRequested.set(isRequested); + } + + public boolean isTeardownRequested() { + return mTeardownRequested.get(); + } + + /** + * Begin monitoring connectivity + */ + public void startMonitoring(Context context, Handler target) { + mContext = context; + mCsHandler = target; + mBluetoothPan = new BluetoothPan(mContext); + } + + /** + * Disable connectivity to a network + * TODO: do away with return value after making MobileDataStateTracker async + */ + public boolean teardown() { + mTeardownRequested.set(true); + for (BluetoothDevice device: mBluetoothPan.getConnectedDevices()) { + mBluetoothPan.disconnect(device); + } + return true; + } + + /** + * Re-enable connectivity to a network after a {@link #teardown()}. + */ + public boolean reconnect() { + mTeardownRequested.set(false); + //Ignore + return true; + } + + /** + * Turn the wireless radio off for a network. + * @param turnOn {@code true} to turn the radio on, {@code false} + */ + public boolean setRadio(boolean turnOn) { + return true; + } + + /** + * @return true - If are we currently tethered with another device. + */ + public synchronized boolean isAvailable() { + return mNetworkInfo.isAvailable(); + } + + /** + * Tells the underlying networking system that the caller wants to + * begin using the named feature. The interpretation of {@code feature} + * is completely up to each networking implementation. + * @param feature the name of the feature to be used + * @param callingPid the process ID of the process that is issuing this request + * @param callingUid the user ID of the process that is issuing this request + * @return an integer value representing the outcome of the request. + * The interpretation of this value is specific to each networking + * implementation+feature combination, except that the value {@code -1} + * always indicates failure. + * TODO: needs to go away + */ + public int startUsingNetworkFeature(String feature, int callingPid, int callingUid) { + return -1; + } + + /** + * Tells the underlying networking system that the caller is finished + * using the named feature. The interpretation of {@code feature} + * is completely up to each networking implementation. + * @param feature the name of the feature that is no longer needed. + * @param callingPid the process ID of the process that is issuing this request + * @param callingUid the user ID of the process that is issuing this request + * @return an integer value representing the outcome of the request. + * The interpretation of this value is specific to each networking + * implementation+feature combination, except that the value {@code -1} + * always indicates failure. + * TODO: needs to go away + */ + public int stopUsingNetworkFeature(String feature, int callingPid, int callingUid) { + return -1; + } + + /** + * @param enabled + */ + public void setDataEnable(boolean enabled) { + android.util.Log.d(TAG, "setDataEnabled: IGNORING enabled=" + enabled); + } + + /** + * Check if private DNS route is set for the network + */ + public boolean isPrivateDnsRouteSet() { + return mPrivateDnsRouteSet.get(); + } + + /** + * Set a flag indicating private DNS route is set + */ + public void privateDnsRouteSet(boolean enabled) { + mPrivateDnsRouteSet.set(enabled); + } + + /** + * Fetch NetworkInfo for the network + */ + public synchronized NetworkInfo getNetworkInfo() { + return mNetworkInfo; + } + + /** + * Fetch LinkProperties for the network + */ + public synchronized LinkProperties getLinkProperties() { + return new LinkProperties(mLinkProperties); + } + + /** + * A capability is an Integer/String pair, the capabilities + * are defined in the class LinkSocket#Key. + * + * @return a copy of this connections capabilities, may be empty but never null. + */ + public LinkCapabilities getLinkCapabilities() { + return new LinkCapabilities(mLinkCapabilities); + } + + /** + * Fetch default gateway address for the network + */ + public int getDefaultGatewayAddr() { + return mDefaultGatewayAddr.get(); + } + + /** + * Check if default route is set + */ + public boolean isDefaultRouteSet() { + return mDefaultRouteSet.get(); + } + + /** + * Set a flag indicating default route is set for the network + */ + public void defaultRouteSet(boolean enabled) { + mDefaultRouteSet.set(enabled); + } + + /** + * Return the system properties name associated with the tcp buffer sizes + * for this network. + */ + public String getTcpBufferSizesPropName() { + return "net.tcp.buffersize.wifi"; + } + + + public synchronized void startReverseTether(String iface, BluetoothDevice device) { + mIface = iface; + mDevice = device; + Thread dhcpThread = new Thread(new Runnable() { + public void run() { + //TODO(): Add callbacks for failure and success case. + //Currently this thread runs independently. + DhcpInfo dhcpInfo = new DhcpInfo(); + if (!NetworkUtils.runDhcp(mIface, dhcpInfo)) { + Log.e(TAG, "DHCP request error:" + NetworkUtils.getDhcpError()); + return; + } + mLinkProperties.addLinkAddress(new LinkAddress( + NetworkUtils.intToInetAddress(dhcpInfo.ipAddress), + NetworkUtils.intToInetAddress(dhcpInfo.netmask))); + mLinkProperties.setGateway(NetworkUtils.intToInetAddress(dhcpInfo.gateway)); + InetAddress dns1Addr = NetworkUtils.intToInetAddress(dhcpInfo.dns1); + if (dns1Addr == null || dns1Addr.equals("0.0.0.0")) { + mLinkProperties.addDns(dns1Addr); + } + InetAddress dns2Addr = NetworkUtils.intToInetAddress(dhcpInfo.dns2); + if (dns2Addr == null || dns2Addr.equals("0.0.0.0")) { + mLinkProperties.addDns(dns2Addr); + } + mLinkProperties.setInterfaceName(mIface); + + mNetworkInfo.setIsAvailable(true); + mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null); + + Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); + msg.sendToTarget(); + + msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); + msg.sendToTarget(); + } + }); + dhcpThread.start(); + } + + public synchronized void stopReverseTether(String iface) { + NetworkUtils.stopDhcp(iface); + + 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(); + } +} diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 3d685cb..7e809f5 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -213,10 +213,16 @@ public class ConnectivityManager */ public static final int TYPE_WIMAX = 6; + /** + * Bluetooth data connection. This is used for Bluetooth reverse tethering. + * @hide + */ + public static final int TYPE_BLUETOOTH = 7; + /** {@hide} */ - public static final int TYPE_DUMMY = 7; + public static final int TYPE_DUMMY = 8; /** {@hide} TODO: Need to adjust this for WiMAX. */ - public static final int MAX_RADIO_TYPE = TYPE_WIFI; + public static final int MAX_RADIO_TYPE = TYPE_DUMMY; /** {@hide} TODO: Need to adjust this for WiMAX. */ public static final int MAX_NETWORK_TYPE = TYPE_DUMMY; diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java index ff8be15..c04bb52 100644 --- a/core/java/android/server/BluetoothEventLoop.java +++ b/core/java/android/server/BluetoothEventLoop.java @@ -425,9 +425,11 @@ class BluetoothEventLoop { } } else if (name.equals("Interface")) { String iface = propValues[1]; - mBluetoothService.handlePanDeviceStateChange(device, iface, - BluetoothPan.STATE_CONNECTED, - BluetoothPan.LOCAL_PANU_ROLE); + if (!iface.equals("")) { + mBluetoothService.handlePanDeviceStateChange(device, iface, + BluetoothPan.STATE_CONNECTED, + BluetoothPan.LOCAL_PANU_ROLE); + } } } diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index eaf49bb..9261ff6 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -34,6 +34,7 @@ import android.bluetooth.BluetoothPan; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfileState; import android.bluetooth.BluetoothSocket; +import android.bluetooth.BluetoothTetheringDataTracker; import android.bluetooth.BluetoothUuid; import android.bluetooth.IBluetooth; import android.bluetooth.IBluetoothCallback; @@ -54,7 +55,6 @@ import android.os.Message; import android.os.ParcelUuid; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemService; import android.provider.Settings; import android.util.Log; import android.util.Pair; @@ -79,11 +79,9 @@ import java.net.InetAddress; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; public class BluetoothService extends IBluetooth.Stub { private static final String TAG = "BluetoothService"; @@ -169,6 +167,8 @@ public class BluetoothService extends IBluetooth.Stub { private static String mDockAddress; private String mDockPin; + private String mIface; + private int mAdapterConnectionState = BluetoothAdapter.STATE_DISCONNECTED; private static class RemoteService { @@ -1582,7 +1582,6 @@ public class BluetoothService extends IBluetooth.Stub { } if (prevState == state) return; - // TODO: We might need this for PANU role too. if (role == BluetoothPan.LOCAL_NAP_ROLE) { if (state == BluetoothPan.STATE_CONNECTED) { ifaceAddr = enableTethering(iface); @@ -1593,6 +1592,16 @@ public class BluetoothService extends IBluetooth.Stub { ifaceAddr = null; } } + } else { + // PANU Role = reverse Tether + if (state == BluetoothPan.STATE_CONNECTED) { + mIface = iface; + BluetoothTetheringDataTracker.getInstance().startReverseTether(iface, device); + } else if (state == BluetoothPan.STATE_DISCONNECTED && + (prevState == BluetoothPan.STATE_CONNECTED || + prevState == BluetoothPan.STATE_DISCONNECTING)) { + BluetoothTetheringDataTracker.getInstance().stopReverseTether(mIface); + } } Pair<Integer, String> value = new Pair<Integer, String>(state, ifaceAddr); diff --git a/core/res/res/layout-xlarge/keyguard_screen_status_land.xml b/core/res/res/layout-xlarge/keyguard_screen_status_land.xml index 7a20f9a..f91fe4f 100644 --- a/core/res/res/layout-xlarge/keyguard_screen_status_land.xml +++ b/core/res/res/layout-xlarge/keyguard_screen_status_land.xml @@ -60,7 +60,7 @@ android:ellipsize="none" android:textSize="120sp" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" android:layout_marginBottom="6dip" /> @@ -71,7 +71,7 @@ android:ellipsize="none" android:textSize="120sp" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" android:layout_marginBottom="6dip" @@ -87,6 +87,7 @@ android:textSize="30sp" android:layout_marginLeft="8dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/layout-xlarge/keyguard_screen_status_port.xml b/core/res/res/layout-xlarge/keyguard_screen_status_port.xml index 4e87b21..c529e0b 100644 --- a/core/res/res/layout-xlarge/keyguard_screen_status_port.xml +++ b/core/res/res/layout-xlarge/keyguard_screen_status_port.xml @@ -59,7 +59,7 @@ android:ellipsize="none" android:textSize="120sp" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" android:layout_marginBottom="6dip" /> @@ -70,7 +70,7 @@ android:ellipsize="none" android:textSize="120sp" android:textAppearance="?android:attr/textAppearanceMedium" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" android:layout_marginBottom="6dip" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" @@ -86,6 +86,7 @@ android:textSize="30sp" android:layout_marginLeft="8dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml index 03bd45b..77ae0d3 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml @@ -77,7 +77,7 @@ android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" /> <TextView android:id="@+id/timeDisplayForeground" @@ -88,7 +88,7 @@ android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" /> @@ -103,6 +103,7 @@ android:textSize="22sp" android:layout_marginLeft="8dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml index bb0c012..e48df20 100644 --- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml +++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml @@ -78,7 +78,7 @@ android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" /> <TextView android:id="@+id/timeDisplayForeground" @@ -89,7 +89,7 @@ android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" /> @@ -104,6 +104,7 @@ android:textSize="22sp" android:layout_marginLeft="8dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml index a6face9..c14afbf 100644 --- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml +++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml @@ -78,7 +78,7 @@ android:textSize="72sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" /> <TextView android:id="@+id/timeDisplayForeground" @@ -91,7 +91,7 @@ android:layout_marginBottom="6dip" android:layout_alignLeft="@id/timeDisplayBackground" android:layout_alignTop="@id/timeDisplayBackground" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" /> @@ -106,6 +106,7 @@ android:textSize="22sp" android:layout_marginLeft="8dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml index 42144ab..85e1db1 100644 --- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml +++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml @@ -68,7 +68,7 @@ android:textSize="56sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#999999" + android:textColor="@color/lockscreen_clock_background" /> <TextView android:id="@+id/timeDisplayForeground" @@ -79,7 +79,7 @@ android:textSize="56sp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_marginBottom="6dip" - android:textColor="#666666" + android:textColor="@color/lockscreen_clock_foreground" /> <TextView android:id="@+id/am_pm" @@ -92,6 +92,7 @@ android:textSize="18sp" android:layout_marginLeft="4dip" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="@color/lockscreen_clock_am_pm" /> </com.android.internal.widget.DigitalClock> diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index b1c54ff..a286265 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -103,6 +103,11 @@ <color name="keyguard_text_color_soundon">#e69310</color> <color name="keyguard_text_color_decline">#fe0a5a</color> + <!-- keyguard clock --> + <color name="lockscreen_clock_background">#ff9a9a9a</color> + <color name="lockscreen_clock_foreground">#ff666666</color> + <color name="lockscreen_clock_am_pm">#ff9a9a9a</color> + <!-- For holo theme --> <drawable name="screen_background_holo_light">#fff3f3f3</drawable> <drawable name="screen_background_holo_dark">#ff000000</drawable> diff --git a/data/fonts/AndroidClock.ttf b/data/fonts/AndroidClock.ttf Binary files differindex 3945183..24a7f08 100644 --- a/data/fonts/AndroidClock.ttf +++ b/data/fonts/AndroidClock.ttf diff --git a/data/fonts/AndroidClock_Highlight.ttf b/data/fonts/AndroidClock_Highlight.ttf Binary files differindex fa0221e..1e14a8f 100644 --- a/data/fonts/AndroidClock_Highlight.ttf +++ b/data/fonts/AndroidClock_Highlight.ttf diff --git a/services/java/com/android/server/ClipboardService.java b/services/java/com/android/server/ClipboardService.java index 30ea48c..bec35d1 100644 --- a/services/java/com/android/server/ClipboardService.java +++ b/services/java/com/android/server/ClipboardService.java @@ -115,7 +115,7 @@ public class ClipboardService extends IClipboard.Stub { public ClipDescription getPrimaryClipDescription() { synchronized (this) { - return mPrimaryClip.getDescription(); + return mPrimaryClip != null ? mPrimaryClip.getDescription() : null; } } @@ -211,7 +211,7 @@ public class ClipboardService extends IClipboard.Stub { } catch (NameNotFoundException e) { throw new IllegalArgumentException("Unknown package " + pkg, e); } - if (!mActivePermissionOwners.contains(pkg)) { + if (mPrimaryClip != null && !mActivePermissionOwners.contains(pkg)) { final int N = mPrimaryClip.getItemCount(); for (int i=0; i<N; i++) { grantItemLocked(mPrimaryClip.getItem(i), pkg); diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 3e2eac2..e7e4302 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -16,8 +16,7 @@ package com.android.server; -import android.app.Notification; -import android.app.NotificationManager; +import android.bluetooth.BluetoothTetheringDataTracker; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -26,9 +25,9 @@ import android.database.ContentObserver; import android.net.ConnectivityManager; import android.net.DummyDataStateTracker; import android.net.IConnectivityManager; +import android.net.LinkProperties; import android.net.MobileDataStateTracker; import android.net.NetworkInfo; -import android.net.LinkProperties; import android.net.NetworkStateTracker; import android.net.NetworkUtils; import android.net.Proxy; @@ -50,7 +49,6 @@ import android.util.EventLog; import android.util.Slog; import com.android.internal.telephony.Phone; - import com.android.server.connectivity.Tethering; import java.io.FileDescriptor; @@ -58,7 +56,6 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collection; @@ -412,6 +409,10 @@ public class ConnectivityService extends IConnectivityManager.Stub { mNetAttributes[netType].mName); mNetTrackers[netType].startMonitoring(context, mHandler); break; + case ConnectivityManager.TYPE_BLUETOOTH: + mNetTrackers[netType] = BluetoothTetheringDataTracker.getInstance(); + mNetTrackers[netType].startMonitoring(context, mHandler); + break; default: loge("Trying to create a DataStateTracker for an unknown radio type " + mNetAttributes[netType].mRadio); |