summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt7
-rw-r--r--core/java/android/preference/PreferenceActivity.java58
-rw-r--r--core/java/android/provider/Settings.java6
-rwxr-xr-xcore/java/android/view/KeyEvent.java17
-rw-r--r--core/jni/android_net_wifi_Wifi.cpp18
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml35
-rwxr-xr-xcore/res/res/values/attrs.xml7
-rwxr-xr-xcore/res/res/values/config.xml6
-rwxr-xr-xinclude/ui/KeycodeLabels.h7
-rw-r--r--media/libmedia/Android.mk4
-rw-r--r--media/libmedia/AudioSystem.cpp4
-rw-r--r--media/libstagefright/FLACExtractor.cpp8
-rw-r--r--native/include/android/keycodes.h7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerButton.java2
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java47
-rw-r--r--services/java/com/android/server/NetworkManagementService.java40
-rw-r--r--services/surfaceflinger/Layer.cpp7
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java5
-rw-r--r--telephony/java/com/android/internal/telephony/SamsungRIL.java139
-rw-r--r--wifi/java/android/net/wifi/WifiConfigStore.java35
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java27
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java6
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java82
23 files changed, 418 insertions, 156 deletions
diff --git a/api/current.txt b/api/current.txt
index a492702..630ab00 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22208,6 +22208,9 @@ package android.view {
field public static final int KEYCODE_BACKSLASH = 73; // 0x49
field public static final int KEYCODE_BOOKMARK = 174; // 0xae
field public static final int KEYCODE_BREAK = 121; // 0x79
+ field public static final int KEYCODE_BRIGHTNESS_AUTO = 216; // 0xd8
+ field public static final int KEYCODE_BRIGHTNESS_DOWN = 214; // 0xd6
+ field public static final int KEYCODE_BRIGHTNESS_UP = 215; // 0xd7
field public static final int KEYCODE_BUTTON_1 = 188; // 0xbc
field public static final int KEYCODE_BUTTON_10 = 197; // 0xc5
field public static final int KEYCODE_BUTTON_11 = 198; // 0xc6
@@ -22361,6 +22364,7 @@ package android.view {
field public static final int KEYCODE_R = 46; // 0x2e
field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
field public static final int KEYCODE_S = 47; // 0x2f
+ field public static final int KEYCODE_SCREENSHOT = 217; // 0xd9
field public static final int KEYCODE_SCROLL_LOCK = 116; // 0x74
field public static final int KEYCODE_SEARCH = 84; // 0x54
field public static final int KEYCODE_SEMICOLON = 74; // 0x4a
@@ -22379,6 +22383,9 @@ package android.view {
field public static final int KEYCODE_SYSRQ = 120; // 0x78
field public static final int KEYCODE_T = 48; // 0x30
field public static final int KEYCODE_TAB = 61; // 0x3d
+ field public static final int KEYCODE_TOGGLE_BT = 212; // 0xd4
+ field public static final int KEYCODE_TOGGLE_TOUCHPAD = 213; // 0xd5
+ field public static final int KEYCODE_TOGGLE_WIFI = 211; // 0xd3
field public static final int KEYCODE_TV = 170; // 0xaa
field public static final int KEYCODE_TV_INPUT = 178; // 0xb2
field public static final int KEYCODE_TV_POWER = 177; // 0xb1
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 1029161..f31d18e 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -143,6 +143,10 @@ public abstract class PreferenceActivity extends ListActivity implements
*/
public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title";
+ // fix for title text for startPreferencePanel in a single pane mode
+ /** @hide */
+ public static final String EXTRA_SHOW_FRAGMENT_TITLE_TEXT = ":android:show_fragment_title_text";
+
/**
* When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
* this extra can also be specify to supply the short title to be shown for
@@ -151,6 +155,11 @@ public abstract class PreferenceActivity extends ListActivity implements
public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE
= ":android:show_fragment_short_title";
+ // fix for short title text for startPreferencePanel in a single pane mode
+ /** @hide */
+ public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT
+ = ":android:show_fragment_short_title_text";
+
/**
* When starting this activity, the invoking Intent can contain this extra
* boolean that the header list should not be displayed. This is most often
@@ -535,6 +544,13 @@ public abstract class PreferenceActivity extends ListActivity implements
CharSequence initialShortTitleStr = initialShortTitle != 0
? getText(initialShortTitle) : null;
showBreadCrumbs(initialTitleStr, initialShortTitleStr);
+ } else {
+ CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT);
+ if ( initialTitleStr != null ) {
+ CharSequence initialShortTitleStr
+ = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT);
+ showBreadCrumbs(initialTitleStr, initialShortTitleStr);
+ }
}
} else {
@@ -568,6 +584,13 @@ public abstract class PreferenceActivity extends ListActivity implements
CharSequence initialShortTitleStr = initialShortTitle != 0
? getText(initialShortTitle) : null;
showBreadCrumbs(initialTitleStr, initialShortTitleStr);
+ } else {
+ CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT);
+ if ( initialTitleStr != null ) {
+ CharSequence initialShortTitleStr
+ = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT);
+ showBreadCrumbs(initialTitleStr, initialShortTitleStr);
+ }
}
} else if (mHeaders.size() > 0) {
setListAdapter(new HeaderAdapter(this, mHeaders));
@@ -1011,7 +1034,21 @@ public abstract class PreferenceActivity extends ListActivity implements
intent.putExtra(EXTRA_NO_HEADERS, true);
return intent;
}
-
+
+ // fix for title text for startPreferencePanel in a single pane mode
+ /** @hide */
+ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args,
+ CharSequence titleText, CharSequence shortTitleText) {
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.setClass(this, getClass());
+ intent.putExtra(EXTRA_SHOW_FRAGMENT, fragmentName);
+ intent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
+ intent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT, titleText);
+ intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT, shortTitleText);
+ intent.putExtra(EXTRA_NO_HEADERS, true);
+ return intent;
+ }
+
/**
* Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)}
* but uses a 0 titleRes.
@@ -1048,6 +1085,18 @@ public abstract class PreferenceActivity extends ListActivity implements
}
}
+ // fix for title text for startPreferencePanel in a single pane mode
+ /** @hide */
+ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo,
+ int resultRequestCode, CharSequence titleText, CharSequence shortTitleText) {
+ Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleText, shortTitleText);
+ if (resultTo == null) {
+ startActivity(intent);
+ } else {
+ resultTo.startActivityForResult(intent, resultRequestCode);
+ }
+ }
+
/**
* Change the base title of the bread crumbs for the current preferences.
* This will normally be called for you. See
@@ -1238,7 +1287,12 @@ public abstract class PreferenceActivity extends ListActivity implements
public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes,
CharSequence titleText, Fragment resultTo, int resultRequestCode) {
if (mSinglePane) {
- startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0);
+ // fix for title text for startPreferencePanel in a single pane mode
+ if (titleRes == 0 && titleText != null) {
+ startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleText, null);
+ } else {
+ startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0);
+ }
} else {
Fragment f = Fragment.instantiate(this, fragmentClass, args);
if (resultTo != null) {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index d5d4a5d..8a14edb 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3166,6 +3166,12 @@ public final class Settings {
*/
public static final String TETHER_DUN_APN = "tether_dun_apn";
+ /** DHCP lease time for tethering in seconds {@hide} */
+ public static final String TETHER_LEASE_TIME = "tether_lease_time";
+
+ /** Default value for TETHER_LEASE_TIME {@hide} */
+ public static final int TETHER_LEASE_TIME_DEFAULT = -1;
+
/**
* No longer supported.
*/
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index f53e42c..458eb85 100755
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -592,7 +592,15 @@ public class KeyEvent extends InputEvent implements Parcelable {
* Used to launch a calculator application. */
public static final int KEYCODE_CALCULATOR = 210;
- private static final int LAST_KEYCODE = KEYCODE_CALCULATOR;
+ public static final int KEYCODE_TOGGLE_WIFI = 211;
+ public static final int KEYCODE_TOGGLE_BT = 212;
+ public static final int KEYCODE_TOGGLE_TOUCHPAD = 213;
+ public static final int KEYCODE_BRIGHTNESS_DOWN = 214;
+ public static final int KEYCODE_BRIGHTNESS_UP = 215;
+ public static final int KEYCODE_BRIGHTNESS_AUTO = 216;
+ public static final int KEYCODE_SCREENSHOT = 217;
+
+ private static final int LAST_KEYCODE = KEYCODE_SCREENSHOT;
// NOTE: If you add a new keycode here you must also add it to:
// isSystem()
@@ -825,6 +833,13 @@ public class KeyEvent extends InputEvent implements Parcelable {
names.append(KEYCODE_CALENDAR, "KEYCODE_CALENDAR");
names.append(KEYCODE_MUSIC, "KEYCODE_MUSIC");
names.append(KEYCODE_CALCULATOR, "KEYCODE_CALCULATOR");
+ names.append(KEYCODE_TOGGLE_WIFI, "KEYCODE_TOGGLE_WIFI");
+ names.append(KEYCODE_TOGGLE_BT, "KEYCODE_TOGGLE_BT");
+ names.append(KEYCODE_TOGGLE_TOUCHPAD, "KEYCODE_TOGGLE_TOUCHPAD");
+ names.append(KEYCODE_BRIGHTNESS_DOWN, "KEYCODE_BRIGHTNESS_DOWN");
+ names.append(KEYCODE_BRIGHTNESS_UP, "KEYCODE_BRIGHTNESS_UP");
+ names.append(KEYCODE_BRIGHTNESS_AUTO, "KEYCODE_BRIGHTNESS_AUTO");
+ names.append(KEYCODE_SCREENSHOT, "KEYCODE_SCREENSHOT");
};
// Symbolic names of all metakeys in bit order from least significant to most significant.
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp
index 84c636b..62e574b 100644
--- a/core/jni/android_net_wifi_Wifi.cpp
+++ b/core/jni/android_net_wifi_Wifi.cpp
@@ -119,6 +119,21 @@ static jboolean android_net_wifi_unloadDriver(JNIEnv* env, jobject)
return (jboolean)(::wifi_unload_driver() == 0);
}
+static jboolean android_net_wifi_isHotspotDriverLoaded(JNIEnv* env, jobject)
+{
+ return (jboolean)(::is_wifi_hotspot_driver_loaded() == 1);
+}
+
+static jboolean android_net_wifi_loadHotspotDriver(JNIEnv* env, jobject)
+{
+ return (jboolean)(::wifi_load_hotspot_driver() == 0);
+}
+
+static jboolean android_net_wifi_unloadHotspotDriver(JNIEnv* env, jobject)
+{
+ return (jboolean)(::wifi_unload_hotspot_driver() == 0);
+}
+
static jboolean android_net_wifi_startSupplicant(JNIEnv* env, jobject)
{
return (jboolean)(::wifi_start_supplicant() == 0);
@@ -561,6 +576,9 @@ static JNINativeMethod gWifiMethods[] = {
{ "loadDriver", "()Z", (void *)android_net_wifi_loadDriver },
{ "isDriverLoaded", "()Z", (void *)android_net_wifi_isDriverLoaded},
{ "unloadDriver", "()Z", (void *)android_net_wifi_unloadDriver },
+ { "loadHotspotDriver", "()Z", (void *)android_net_wifi_loadHotspotDriver },
+ { "isHotspotDriverLoaded", "()Z", (void *)android_net_wifi_isHotspotDriverLoaded},
+ { "unloadHotspotDriver", "()Z", (void *)android_net_wifi_unloadHotspotDriver },
{ "startSupplicant", "()Z", (void *)android_net_wifi_startSupplicant },
{ "startP2pSupplicant", "()Z", (void *)android_net_wifi_startP2pSupplicant },
{ "stopSupplicant", "()Z", (void*) android_net_wifi_stopSupplicant },
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml
index d8bea56..5d04ff5 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_sim_pin_portrait.xml
@@ -20,11 +20,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:background="@android:color/background_dark"
- android:gravity="center_horizontal">
+ android:background="@android:color/transparent"
+ android:cacheColorHint="@android:color/transparent"
+ android:gravity="center|center_horizontal">
<LinearLayout android:id="@+id/topDisplayGroup"
- android:layout_width="match_parent"
+ android:layout_width="400dp"
android:layout_height="wrap_content"
android:orientation="vertical">
@@ -81,39 +82,19 @@
<include
android:id="@+id/keyPad"
layout="@android:layout/twelve_key_entry"
- android:layout_width="fill_parent"
+ android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_below="@id/topDisplayGroup"
android:layout_marginTop="10dip"
/>
-
- <!-- spacer below keypad -->
- <View
- android:id="@+id/spacerBottom"
- android:layout_width="match_parent"
- android:layout_height="1dip"
- android:layout_marginTop="6dip"
- android:layout_above="@id/emergencyCallButton"
- android:background="@android:drawable/divider_horizontal_dark"
- />
-
- <!-- The emergency button should take the rest of the space and be centered vertically -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:gravity="center"
- android:orientation="vertical">
-
- <!-- emergency call button -->
+
+ <!-- emergency call button -->
<Button
android:id="@+id/emergencyCallButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@android:drawable/ic_emergency"
android:drawablePadding="8dip"
- android:text="@android:string/lockscreen_emergency_call"
- />
- </LinearLayout>
+ android:text="@android:string/lockscreen_emergency_call" />
</LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index af59198..320aac9 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1497,6 +1497,13 @@
<enum name="KEYCODE_CALENDAR" value="208" />
<enum name="KEYCODE_MUSIC" value="209" />
<enum name="KEYCODE_CALCULATOR" value="210" />
+ <enum name="KEYCODE_TOGGLE_WIFI" value="211" />
+ <enum name="KEYCODE_TOGGLE_BT" value="212" />
+ <enum name="KEYCODE_TOGGLE_TOUCHPAD" value="213" />
+ <enum name="KEYCODE_BRIGHTNESS_DOWN" value="214" />
+ <enum name="KEYCODE_BRIGHTNESS_UP" value="215" />
+ <enum name="KEYCODE_BRIGHTNESS_AUTO" value="216" />
+ <enum name="KEYCODE_SCREENSHOT" value="217" />
</attr>
<!-- ***************************************************************** -->
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index bae6ec8..f007e78 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -265,6 +265,12 @@
point on the move. A value of 0 means no periodic scans will be used in the framework. -->
<integer translatable="false" name="config_wifi_framework_scan_interval">300000</integer>
+ <!-- Boolean indicating whether Softap rely only on one interface -->
+ <bool name="config_wifi_ap_use_single_interface">false</bool>
+
+ <!-- Boolean indicating whether Softap require reloading AP firware -->
+ <bool name="config_wifi_ap_firmware_reload">true</bool>
+
<!-- Flag indicating whether the keyguard should be bypassed when
the slider is open. This can be set or unset depending how easily
the slider can be opened (for example, in a pocket or purse). -->
diff --git a/include/ui/KeycodeLabels.h b/include/ui/KeycodeLabels.h
index c5bd0c5..a443232 100755
--- a/include/ui/KeycodeLabels.h
+++ b/include/ui/KeycodeLabels.h
@@ -235,6 +235,13 @@ static const KeycodeLabel KEYCODES[] = {
{ "CALENDAR", 208 },
{ "MUSIC", 209 },
{ "CALCULATOR", 210 },
+ { "TOGGLE_WIFI", 211 },
+ { "TOGGLE_BT", 212 },
+ { "TOGGLE_TOUCHPAD", 213 },
+ { "BRIGHTNESS_DOWN", 214 },
+ { "BRIGHTNESS_UP", 215 },
+ { "BRIGHTNESS_AUTO", 216 },
+ { "SCREENSHOT", 217 },
// NOTE: If you add a new keycode here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index f0cc684..f928c07 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -58,8 +58,8 @@ ifeq ($(BOARD_USE_KINETO_COMPATIBILITY),true)
LOCAL_CFLAGS += -DUSE_KINETO_COMPATIBILITY
endif
-ifeq ($(BOARD_USE_YAMAHAPLAYER),true)
- LOCAL_CFLAGS += -DYAMAHAPLAYER
+ifeq ($(BOARD_USE_SAMSUNG_SEPARATEDSTREAM),true)
+ LOCAL_CFLAGS += -DUSE_SAMSUNG_SEPARATEDSTREAM
endif
LOCAL_SHARED_LIBRARIES := \
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 99cc4e0..f35b007 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -810,7 +810,7 @@ extern "C" bool _ZN7android11AudioSystem15isLowVisibilityENS0_11stream_typeE(aud
#endif // AUDIO_LEGACY
-#ifdef YAMAHAPLAYER
+#ifdef USE_SAMSUNG_SEPARATEDSTREAM
extern "C" bool _ZN7android11AudioSystem17isSeparatedStreamE19audio_stream_type_t(audio_stream_type_t stream)
{
LOGD("android::AudioSystem::isSeparatedStream(audio_stream_type_t) called!");
@@ -828,7 +828,7 @@ extern "C" bool _ZN7android11AudioSystem17isSeparatedStreamE19audio_stream_type_
LOGD("isSeparatedStream: false");
return false;
}
-#endif // YAMAHAPLAYER
+#endif // USE_SAMSUNG_SEPARATEDSTREAM
}; // namespace android
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 8ba5a2d..5b05582 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -793,13 +793,9 @@ bool SniffFLAC(
const sp<DataSource> &source, String8 *mimeType, float *confidence,
sp<AMessage> *)
{
- // first 4 is the signature word
- // second 4 is the sizeof STREAMINFO
- // 042 is the mandatory STREAMINFO
- // no need to read rest of the header, as a premature EOF will be caught later
- uint8_t header[4+4];
+ uint8_t header[4];
if (source->readAt(0, header, sizeof(header)) != sizeof(header)
- || memcmp("fLaC\0\0\0\042", header, 4+4))
+ || memcmp("fLaC", header, 4))
{
return false;
}
diff --git a/native/include/android/keycodes.h b/native/include/android/keycodes.h
index 8414ff6..f9c808d 100644
--- a/native/include/android/keycodes.h
+++ b/native/include/android/keycodes.h
@@ -254,6 +254,13 @@ enum {
AKEYCODE_CALENDAR = 208,
AKEYCODE_MUSIC = 209,
AKEYCODE_CALCULATOR = 210,
+ AKEYCODE_TOGGLE_WIFI = 211,
+ AKEYCODE_TOGGLE_BT = 212,
+ AKEYCODE_TOGGLE_TOUCHPAD = 213,
+ AKEYCODE_BRIGHTNESS_DOWN = 214,
+ AKEYCODE_BRIGHTNESS_UP = 215,
+ AKEYCODE_BRIGHTNESS_AUTO = 216,
+ AKEYCODE_SCREENSHOT = 217,
// NOTE: If you add a new keycode here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerButton.java
index a166a1e..864ba35 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerButton.java
@@ -114,7 +114,7 @@ public abstract class PowerButton {
int sColorMaskBase = Settings.System.getInt(context.getContentResolver(),
Settings.System.EXPANDED_VIEW_WIDGET_COLOR, 0xFF33B5E5);
- int sColorMaskOn = (sColorMaskBase & 0x00FFFFFF) | 0xA0000000;
+ int sColorMaskOn = sColorMaskBase;
int sColorMaskOff = (sColorMaskBase & 0x00FFFFFF) | 0x33000000;
int sColorMaskInter = (sColorMaskBase & 0x00FFFFFF) | 0x60000000;
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 09d411f..8976c3c 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -122,7 +122,6 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
*/
protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000;
-
/**
* The default amount of time we stay awake (used for all key input) when
* the keyboard is open
@@ -356,11 +355,21 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mScreenOn = false;
if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
- // Lock immediately based on setting if secure (user has a pin/pattern/password).
- // This also "locks" the device when not secure to provide easy access to the
- // camera while preventing unwanted input.
- final boolean lockImmediately =
- mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
+ // Prepare for handling Lock/Slide lock delay and timeout
+ boolean lockImmediately = false;
+ final ContentResolver cr = mContext.getContentResolver();
+ boolean separateSlideLockTimeoutEnabled = Settings.System.getInt(cr,
+ Settings.System.SCREEN_LOCK_SLIDE_DELAY_TOGGLE, 0) == 1;
+ if (mLockPatternUtils.isSecure()) {
+ // Lock immediately based on setting if secure (user has a pin/pattern/password)
+ // This is retained as-is to ensue AOSP security integrity is maintained
+ lockImmediately = true;
+ } else {
+ // Unless a separate slide lock timeout is enabled, this "locks" the device when
+ // not secure to provide easy access to the camera while preventing unwanted input
+ lockImmediately = separateSlideLockTimeoutEnabled ? false
+ : mLockPatternUtils.getPowerButtonInstantlyLocks();
+ }
if (mExitSecureCallback != null) {
if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled");
@@ -375,11 +384,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
} else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
|| (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) {
// if the screen turned off because of timeout or the user hit the power button
- // and we don't need to lock immediately, set an alarm
- // to enable it a little bit later (i.e, give the user a chance
- // to turn the screen back on within a certain window without
- // having to unlock the screen)
- final ContentResolver cr = mContext.getContentResolver();
+ // and we don't need to lock immediately, set an alarm to enable it a little
+ // bit later (i.e, give the user a chance to turn the screen back on within
+ // a certain window without having to unlock the screen)
// From DisplaySettings
long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
@@ -390,17 +397,33 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
KEYGUARD_LOCK_AFTER_DELAY_DEFAULT);
+ // From CyanogenMod specific Settings
+ int slideLockTimeoutDelay = (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT ? Settings.System
+ .getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_TIMEOUT_DELAY,
+ KEYGUARD_LOCK_AFTER_DELAY_DEFAULT) : Settings.System.getInt(cr,
+ Settings.System.SCREEN_LOCK_SLIDE_SCREENOFF_DELAY, 0));
+
// From DevicePolicyAdmin
final long policyTimeout = mLockPatternUtils.getDevicePolicyManager()
.getMaximumTimeToLock(null);
+ if (DEBUG) Log.d(TAG, "Security lock screen timeout delay is " + lockAfterTimeout
+ + " ms; slide lock screen timeout delay is "
+ + slideLockTimeoutDelay
+ + " ms; Separate slide lock delay settings considered: "
+ + separateSlideLockTimeoutEnabled
+ + "; Policy timeout is "
+ + policyTimeout
+ + " ms");
+
long timeout;
if (policyTimeout > 0) {
// policy in effect. Make sure we don't go beyond policy limit.
displayTimeout = Math.max(displayTimeout, 0); // ignore negative values
timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout);
} else {
- timeout = lockAfterTimeout;
+ // Not sure lockAfterTimeout is needed any more but keeping it for AOSP compatibility
+ timeout = separateSlideLockTimeoutEnabled ? slideLockTimeoutDelay : lockAfterTimeout;
}
if (timeout <= 0) {
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 6622438..1b15269 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -25,10 +25,12 @@ import static android.net.NetworkStats.TAG_NONE;
import static android.net.NetworkStats.UID_ALL;
import static android.net.TrafficStats.UID_TETHERING;
import static android.provider.Settings.Secure.NETSTATS_ENABLED;
+import static android.provider.Settings.Secure.TETHER_LEASE_TIME;
import static com.android.server.NetworkManagementSocketTagger.PROP_QTAGUID_ENABLED;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.net.INetworkManagementEventObserver;
import android.net.InterfaceConfiguration;
import android.net.LinkAddress;
@@ -90,6 +92,11 @@ public class NetworkManagementService extends INetworkManagementService.Stub
*/
public static final String LIMIT_GLOBAL_ALERT = "globalAlert";
+ /**
+ * Constant representing the default DHCP lease time
+ */
+ public static final int DEFAULT_LEASE_TIME = -1;
+
class NetdResponseCode {
/* Keep in sync with system/netd/ResponseCode.h */
public static final int InterfaceListResult = 110;
@@ -730,16 +737,31 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
public void startTethering(String[] dhcpRange)
+ throws IllegalStateException {
+ startTethering(dhcpRange, Settings.Secure.getInt(mContext.getContentResolver(),
+ TETHER_LEASE_TIME, Settings.Secure.TETHER_LEASE_TIME_DEFAULT));
+ }
+
+ public void startTethering(String[] dhcpRange, int leaseTime)
throws IllegalStateException {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
- // cmd is "tether start first_start first_stop second_start second_stop ..."
- // an odd number of addrs will fail
+
+ // cmd is "tether start first_start first_stop second_start second_stop ... [lease_time]"
+
+ // Make sure CMD_ARGS_MAX in system/core/include/sysutils/FrameworkListener.h is big
+ // enough to hold 2 (tether start) + dhcpRange.length (by default 14) + optionally
+ // 1 (lease time) = (16/17) arguments.
String cmd = "tether start";
+
for (String d : dhcpRange) {
cmd += " " + d;
}
+ if (leaseTime != Settings.Secure.TETHER_LEASE_TIME_DEFAULT) {
+ cmd += " " + leaseTime;
+ }
+
try {
mConnector.doCommand(cmd);
} catch (NativeDaemonConnectorException e) {
@@ -947,10 +969,16 @@ public class NetworkManagementService extends INetworkManagementService.Stub
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CHANGE_WIFI_STATE, "NetworkManagementService");
try {
- wifiFirmwareReload(wlanIface, "AP");
- mConnector.doCommand(String.format("softap start " + wlanIface));
+ Resources resources = mContext.getResources();
+ String mainIface = resources.getBoolean(
+ com.android.internal.R.bool.config_wifi_ap_use_single_interface)
+ ? softapIface : wlanIface;
+
+ if (resources.getBoolean(com.android.internal.R.bool.config_wifi_ap_firmware_reload))
+ wifiFirmwareReload(wlanIface, "AP");
+ mConnector.doCommand(String.format("softap start " + mainIface));
if (wifiConfig == null) {
- mConnector.doCommand(String.format("softap set " + wlanIface + " " + softapIface));
+ mConnector.doCommand(String.format("softap set " + mainIface + " " + softapIface));
} else {
/**
* softap set arg1 arg2 arg3 [arg4 arg5 arg6 arg7 arg8]
@@ -963,7 +991,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
* argv7 - Preamble
* argv8 - Max SCB
*/
- String str = String.format("softap set " + wlanIface + " " + softapIface +
+ String str = String.format("softap set " + mainIface + " " + softapIface +
" %s %s %s", convertQuotedString(wifiConfig.SSID),
getSecurityType(wifiConfig),
convertQuotedString(wifiConfig.preSharedKey));
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a7f05e0..ba0ebec 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -505,6 +505,13 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
// update the active buffer
mActiveBuffer = mSurfaceTexture->getCurrentBuffer();
+#ifdef QCOM_HARDWARE
+ //Buffer validity changed. Reset HWC geometry flags.
+ if(oldActiveBuffer == NULL && mActiveBuffer != NULL) {
+ mFlinger->invalidateHwcGeometry();
+ }
+#endif
+
const Rect crop(mSurfaceTexture->getCurrentCrop());
const uint32_t transform(mSurfaceTexture->getCurrentTransform());
const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode());
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 7468cd4..b005721 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -2187,7 +2187,6 @@ public class RIL extends BaseCommands implements CommandsInterface {
protected void
processSolicited (Parcel p) {
int serial, error;
- boolean found = false;
serial = p.readInt();
error = p.readInt();
@@ -3560,7 +3559,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
case RIL_REQUEST_ISIM_AUTHENTICATION: return "RIL_REQUEST_ISIM_AUTHENTICATION";
case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU";
case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS";
- default: return "<unknown request>";
+ default: return "<unknown request: "+request+">";
}
}
@@ -3608,7 +3607,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOl_CDMA_PRL_CHANGED: return "UNSOL_CDMA_PRL_CHANGED";
case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED";
- default: return "<unknown reponse>";
+ default: return "<unknown response: "+request+">";
}
}
diff --git a/telephony/java/com/android/internal/telephony/SamsungRIL.java b/telephony/java/com/android/internal/telephony/SamsungRIL.java
index 5f379de..25976ad 100644
--- a/telephony/java/com/android/internal/telephony/SamsungRIL.java
+++ b/telephony/java/com/android/internal/telephony/SamsungRIL.java
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ * Copyright (C) 2011, 2012 The CyanogenMod 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 com.android.internal.telephony;
import java.util.ArrayList;
@@ -45,25 +62,31 @@ public class SamsungRIL extends RIL implements CommandsInterface {
super(context, networkMode, cdmaSubscription);
}
- //SAMSUNG SGS STATES
+ // SAMSUNG SGS STATES
static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002;
static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007;
static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008;
static final int RIL_UNSOL_GPS_NOTI = 11009;
- static final int RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST_3 = 11010;
+ static final int RIL_UNSOL_AM = 11010;
+ static final int RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST = 11012;
static final int RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST_2 = 11011;
static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016;
- static final int RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST = 11012;
static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
+ static String
+ requestToString(int request) {
+ switch (request) {
+ case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY";
+ default: return RIL.requestToString(request);
+ }
+ }
+
@Override
public void
setRadioPower(boolean on, Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADIO_POWER, result);
- //samsung crap for airplane mode
- if (on)
- {
+ if (on) {
rr.mp.writeInt(1);
rr.mp.writeInt(1);
} else {
@@ -71,6 +94,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
rr.mp.writeInt(0);
rr.mp.writeInt(0);
}
+
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
send(rr);
}
@@ -79,13 +103,12 @@ public class SamsungRIL extends RIL implements CommandsInterface {
protected void
processSolicited (Parcel p) {
int serial, error;
- boolean found = false;
serial = p.readInt();
error = p.readInt();
- Log.d(LOG_TAG,"Serial: "+ serial);
- Log.d(LOG_TAG,"Error: "+ error);
+ Log.d(LOG_TAG, "Serial: " + serial);
+ Log.d(LOG_TAG, "Error: " + error);
RILRequest rr;
@@ -210,6 +233,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break;
+ case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break;
default:
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
//break;
@@ -267,15 +291,12 @@ public class SamsungRIL extends RIL implements CommandsInterface {
dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
RILRequest rr;
if (!mIsSamsungCdma && PhoneNumberUtils.isEmergencyNumber(address)) {
- Log.v(LOG_TAG, "Emergency dial: " + address);
- rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
- rr.mp.writeString(address + "/");
- }
- else {
- rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
- rr.mp.writeString(address);
+ dialEmergencyCall(address, clirMode, result);
+ return;
}
+ rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
+ rr.mp.writeString(address);
rr.mp.writeInt(clirMode);
rr.mp.writeInt(0); // UUS information is absent
@@ -293,6 +314,22 @@ public class SamsungRIL extends RIL implements CommandsInterface {
send(rr);
}
+ public void
+ dialEmergencyCall(String address, int clirMode, Message result) {
+ RILRequest rr;
+ Log.v(LOG_TAG, "Emergency dial: " + address);
+
+ rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
+ rr.mp.writeString(address + "/");
+ rr.mp.writeInt(clirMode);
+ rr.mp.writeInt(0);
+ rr.mp.writeInt(0);
+
+ if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+ send(rr);
+ }
+
@Override
protected void
processUnsolicited (Parcel p) {
@@ -349,7 +386,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
case RIL_UNSOL_GPS_NOTI: ret = responseVoid(p); break; // Ignored in TW RIL.
case RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST: ret = responseVoid(p); break;
case RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST_2: ret = responseVoid(p); break;
- case RIL_UNSOL_SAMSUNG_UNKNOWN_MAGIC_REQUEST_3: ret = responseVoid(p); break;
+ case RIL_UNSOL_AM: ret = responseVoid(p); break;
default:
throw new RuntimeException("Unrecognized unsol response: " + response);
@@ -466,12 +503,14 @@ public class SamsungRIL extends RIL implements CommandsInterface {
String nitz = (String)ret;
if (RILJ_LOGD) riljLog(" RIL_UNSOL_NITZ_TIME_RECEIVED length = "
+ nitz.split("[/:,+-]").length);
- //remove the tailing information that samsung added to the string
- //it will screw the NITZ parser
+
+ // remove the tailing information that samsung added to the string
if(nitz.split("[/:,+-]").length >= 9)
nitz = nitz.substring(0,(nitz.lastIndexOf(",")));
+
if (RILJ_LOGD) riljLog(" RIL_UNSOL_NITZ_TIME_RECEIVED striped nitz = "
+ nitz);
+
result[0] = nitz;
result[1] = Long.valueOf(nitzReceiveTime);
@@ -688,7 +727,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
protected Object
responseCallList(Parcel p) {
int num;
- int voiceSettings;
+ boolean isVideo;
ArrayList<DriverCall> response;
DriverCall dc;
int dataAvail = p.dataAvail();
@@ -699,11 +738,7 @@ public class SamsungRIL extends RIL implements CommandsInterface {
Log.d(LOG_TAG, "Parcel pos = " + pos);
Log.d(LOG_TAG, "Parcel dataAvail = " + dataAvail);
- //Samsung fucked up here
-
num = p.readInt();
-
- Log.d(LOG_TAG, "num = " + num);
response = new ArrayList<DriverCall>(num);
for (int i = 0 ; i < num ; i++) {
@@ -712,36 +747,34 @@ public class SamsungRIL extends RIL implements CommandsInterface {
else
dc = new DriverCall();
- dc.state = DriverCall.stateFromCLCC(p.readInt());
+ dc.state = DriverCall.stateFromCLCC(p.readInt());
+ dc.index = p.readInt();
+ dc.TOA = p.readInt();
+ dc.isMpty = (0 != p.readInt());
+ dc.isMT = (0 != p.readInt());
+ dc.als = p.readInt();
+ dc.isVoice = (0 != p.readInt());
+ isVideo = (0 != p.readInt());
+ dc.isVoicePrivacy = (0 != p.readInt());
+ dc.number = p.readString();
+ int np = p.readInt();
+ dc.numberPresentation = DriverCall.presentationFromCLIP(np);
+ dc.name = p.readString();
+ dc.namePresentation = p.readInt();
+ int uusInfoPresent = p.readInt();
+
Log.d(LOG_TAG, "state = " + dc.state);
- dc.index = p.readInt();
Log.d(LOG_TAG, "index = " + dc.index);
- dc.TOA = p.readInt();
Log.d(LOG_TAG, "state = " + dc.TOA);
- dc.isMpty = (0 != p.readInt());
Log.d(LOG_TAG, "isMpty = " + dc.isMpty);
- dc.isMT = (0 != p.readInt());
Log.d(LOG_TAG, "isMT = " + dc.isMT);
- dc.als = p.readInt();
Log.d(LOG_TAG, "als = " + dc.als);
- voiceSettings = p.readInt();
- dc.isVoice = (0 == voiceSettings) ? false : true;
Log.d(LOG_TAG, "isVoice = " + dc.isVoice);
- dc.isVoicePrivacy = (0 != p.readInt());
- //Some Samsung magic data for Videocalls
- voiceSettings = p.readInt();
- //printing it to cosole for later investigation
- Log.d(LOG_TAG, "Samsung magic = " + voiceSettings);
- dc.number = p.readString();
+ Log.d(LOG_TAG, "isVideo = " + isVideo);
Log.d(LOG_TAG, "number = " + dc.number);
- int np = p.readInt();
- Log.d(LOG_TAG, "np = " + np);
- dc.numberPresentation = DriverCall.presentationFromCLIP(np);
- dc.name = p.readString();
+ Log.d(LOG_TAG, "numberPresentation = " + np);
Log.d(LOG_TAG, "name = " + dc.name);
- dc.namePresentation = p.readInt();
Log.d(LOG_TAG, "namePresentation = " + dc.namePresentation);
- int uusInfoPresent = p.readInt();
Log.d(LOG_TAG, "uusInfoPresent = " + uusInfoPresent);
if (uusInfoPresent == 1) {
@@ -820,17 +853,17 @@ public class SamsungRIL extends RIL implements CommandsInterface {
Method taken from Samsungs cdma/gsmSignalStateTracker */
if(mSignalbarCount)
{
- //Samsung sends the count of bars that should be displayed instead of
- //a real signal strength
- response[0] = ((response[0] & 0xFF00) >> 8) * 3; //gsmDbm
+ // Samsung sends the count of bars that should be displayed instead of
+ // a real signal strength
+ response[0] = ((response[0] & 0xFF00) >> 8) * 3; // gsmDbm
} else {
- response[0] = response[0] & 0xFF; //gsmDbm
+ response[0] = response[0] & 0xFF; // gsmDbm
}
- response[1] = -1; //gsmEcio
- response[2] = (response[2] < 0)?-120:-response[2]; //cdmaDbm
- response[3] = (response[3] < 0)?-160:-response[3]; //cdmaEcio
- response[4] = (response[4] < 0)?-120:-response[4]; //evdoRssi
- response[5] = (response[5] < 0)?-1:-response[5]; //evdoEcio
+ response[1] = -1; // gsmEcio
+ response[2] = (response[2] < 0)?-120:-response[2]; // cdmaDbm
+ response[3] = (response[3] < 0)?-160:-response[3]; // cdmaEcio
+ response[4] = (response[4] < 0)?-120:-response[4]; // evdoRssi
+ response[5] = (response[5] < 0)?-1:-response[5]; // evdoEcio
if(response[6] < 0 || response[6] > 8)
response[6] = -1;
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index 568a485..54b760f 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -1025,6 +1025,32 @@ class WifiConfigStore {
break setVariables;
}
+ // Android sometimes call this function with infrastructure
+ // configuration for ad-hoc networks (from selectNetwork),
+ // so we only set the variable if the mode is ad-hoc.
+ // (Infrastructure is default and does not have to be set.)
+ if (config.mode == WifiConfiguration.Mode.ADHOC) {
+ if (!WifiNative.setNetworkVariableCommand(
+ netId,
+ WifiConfiguration.Mode.varName,
+ Integer.toString(config.mode))) {
+ loge(config.SSID + ": failed to set mode: "
+ +config.mode);
+ break setVariables;
+ }
+
+ // Some drivers/wpa_supplicant require the frequency
+ // to be set for ad-hoc networks, even though it will
+ // not actually be used. Set it to Channel 11.
+ if (!WifiNative.setNetworkVariableCommand(
+ netId,
+ "frequency",
+ "2462")) {
+ loge(config.SSID + ": failed to set frequency: 2462");
+ break setVariables;
+ }
+ }
+
for (WifiConfiguration.EnterpriseField field
: config.enterpriseFields) {
String varName = field.varName();
@@ -1246,6 +1272,15 @@ class WifiConfigStore {
}
}
+ value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.Mode.varName);
+ config.mode = WifiConfiguration.Mode.INFRASTRUCTURE;
+ if (!TextUtils.isEmpty(value)) {
+ try {
+ config.mode = Integer.parseInt(value);
+ } catch (NumberFormatException ignore) {
+ }
+ }
+
value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.wepTxKeyIdxVarName);
config.wepTxKeyIndex = -1;
if (!TextUtils.isEmpty(value)) {
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 85a6f27..01125c5 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -211,6 +211,23 @@ public class WifiConfiguration implements Parcelable {
public static final String[] strings = { "current", "disabled", "enabled" };
}
+ /**
+ * Possible modes of a network configuration.
+ * @hide
+ */
+ public static class Mode {
+ private Mode() { }
+
+ /** this is an infrastructure network */
+ public static final int INFRASTRUCTURE = 0;
+ /** this is an ad-hoc network */
+ public static final int ADHOC = 1;
+
+ public static final String varName = "mode";
+
+ public static final String[] strings = { "infrastructure", "ad-hoc" };
+ }
+
/** @hide */
public static final int DISABLED_UNKNOWN_REASON = 0;
/** @hide */
@@ -291,6 +308,12 @@ public class WifiConfiguration implements Parcelable {
public boolean hiddenSSID;
/**
+ * The mode this access point operates on (infrastructure or ad-hoc)
+ * @hide
+ */
+ public int mode;
+
+ /**
* The set of key management protocols supported by this configuration.
* See {@link KeyMgmt} for descriptions of the values.
* Defaults to WPA-PSK WPA-EAP.
@@ -368,6 +391,7 @@ public class WifiConfiguration implements Parcelable {
BSSID = null;
priority = 0;
hiddenSSID = false;
+ mode = Mode.INFRASTRUCTURE;
disableReason = DISABLED_UNKNOWN_REASON;
allowedKeyManagement = new BitSet();
allowedProtocols = new BitSet();
@@ -542,6 +566,7 @@ public class WifiConfiguration implements Parcelable {
wepTxKeyIndex = source.wepTxKeyIndex;
priority = source.priority;
hiddenSSID = source.hiddenSSID;
+ mode = source.mode;
allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone();
allowedProtocols = (BitSet) source.allowedProtocols.clone();
allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone();
@@ -570,6 +595,7 @@ public class WifiConfiguration implements Parcelable {
dest.writeInt(wepTxKeyIndex);
dest.writeInt(priority);
dest.writeInt(hiddenSSID ? 1 : 0);
+ dest.writeInt(mode);
writeBitSet(dest, allowedKeyManagement);
writeBitSet(dest, allowedProtocols);
@@ -601,6 +627,7 @@ public class WifiConfiguration implements Parcelable {
config.wepTxKeyIndex = in.readInt();
config.priority = in.readInt();
config.hiddenSSID = in.readInt() != 0;
+ config.mode = in.readInt();
config.allowedKeyManagement = readBitSet(in);
config.allowedProtocols = readBitSet(in);
config.allowedAuthAlgorithms = readBitSet(in);
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index 6ff1bc2..f4389ad 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -58,6 +58,12 @@ public class WifiNative {
public native static boolean unloadDriver();
+ public native static boolean loadHotspotDriver();
+
+ public native static boolean isHotspotDriverLoaded();
+
+ public native static boolean unloadHotspotDriver();
+
public native static boolean startSupplicant();
public native static boolean startP2pSupplicant();
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index d9e9b25..33737f2 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1954,27 +1954,27 @@ public class WifiStateMachine extends StateMachine {
switch(message.arg1) {
case WIFI_STATE_ENABLING:
setWifiState(WIFI_STATE_ENABLING);
+ if(WifiNative.loadDriver()) {
+ if (DBG) log("Driver load successful");
+ sendMessage(CMD_LOAD_DRIVER_SUCCESS);
+ } else {
+ if (DBG) log("Failed to load driver!");
+ setWifiState(WIFI_STATE_UNKNOWN);
+ sendMessage(CMD_LOAD_DRIVER_FAILURE);
+ }
break;
case WIFI_AP_STATE_ENABLING:
setWifiApState(WIFI_AP_STATE_ENABLING);
+ if(WifiNative.loadHotspotDriver()) {
+ if (DBG) log("Hotspot driver load successful");
+ sendMessage(CMD_LOAD_DRIVER_SUCCESS);
+ } else {
+ if (DBG) log("Failed to load Hotspot driver!");
+ setWifiState(WIFI_AP_STATE_FAILED);
+ sendMessage(CMD_LOAD_DRIVER_FAILURE);
+ }
break;
}
-
- if(WifiNative.loadDriver()) {
- if (DBG) log("Driver load successful");
- sendMessage(CMD_LOAD_DRIVER_SUCCESS);
- } else {
- loge("Failed to load driver!");
- switch(message.arg1) {
- case WIFI_STATE_ENABLING:
- setWifiState(WIFI_STATE_UNKNOWN);
- break;
- case WIFI_AP_STATE_ENABLING:
- setWifiApState(WIFI_AP_STATE_FAILED);
- break;
- }
- sendMessage(CMD_LOAD_DRIVER_FAILURE);
- }
mWakeLock.release();
}
}).start();
@@ -2080,35 +2080,35 @@ public class WifiStateMachine extends StateMachine {
public void run() {
if (DBG) log(getName() + message.toString() + "\n");
mWakeLock.acquire();
- if(WifiNative.unloadDriver()) {
- if (DBG) log("Driver unload successful");
- sendMessage(CMD_UNLOAD_DRIVER_SUCCESS);
-
- switch(message.arg1) {
- case WIFI_STATE_DISABLED:
- case WIFI_STATE_UNKNOWN:
+ switch(message.arg1) {
+ case WIFI_STATE_DISABLED:
+ case WIFI_STATE_UNKNOWN:
+ if(WifiNative.unloadDriver()) {
+ if (DBG) log("Driver unload successful");
+ sendMessage(CMD_UNLOAD_DRIVER_SUCCESS);
setWifiState(message.arg1);
- break;
- case WIFI_AP_STATE_DISABLED:
- case WIFI_AP_STATE_FAILED:
- setWifiApState(message.arg1);
- break;
- }
- } else {
- loge("Failed to unload driver!");
- sendMessage(CMD_UNLOAD_DRIVER_FAILURE);
-
- switch(message.arg1) {
- case WIFI_STATE_DISABLED:
- case WIFI_STATE_UNKNOWN:
+ } else {
+ loge("Failed to unload driver!");
+ sendMessage(CMD_UNLOAD_DRIVER_FAILURE);
setWifiState(WIFI_STATE_UNKNOWN);
- break;
- case WIFI_AP_STATE_DISABLED:
- case WIFI_AP_STATE_FAILED:
+ }
+
+ setWifiState(message.arg1);
+ break;
+ case WIFI_AP_STATE_DISABLED:
+ case WIFI_AP_STATE_FAILED:
+ if(WifiNative.unloadHotspotDriver()) {
+ if (DBG) log("Hotspot driver unload successful");
+ sendMessage(CMD_UNLOAD_DRIVER_SUCCESS);
+ setWifiApState(message.arg1);
+ } else {
+ loge("Failed to unload hotspot driver!");
+ sendMessage(CMD_UNLOAD_DRIVER_FAILURE);
setWifiApState(WIFI_AP_STATE_FAILED);
- break;
- }
+ }
+ break;
}
+
mWakeLock.release();
}
}).start();