summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@google.com>2011-07-18 10:27:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-18 10:27:42 -0700
commit55421aa80edbc5fdd9ce43029845ca0bd6ecc4c6 (patch)
tree1401af3dd28148ccecd08efbbc7939f576876880 /core/java
parentc79c0792a442e049726036682596664424fa1776 (diff)
parent7adcdecf808fce832b8711aeeeb30b73371ee4ae (diff)
downloadframeworks_base-55421aa80edbc5fdd9ce43029845ca0bd6ecc4c6.zip
frameworks_base-55421aa80edbc5fdd9ce43029845ca0bd6ecc4c6.tar.gz
frameworks_base-55421aa80edbc5fdd9ce43029845ca0bd6ecc4c6.tar.bz2
Merge "NetInitiatedActivity: support AUTO response feature for SUPL IOT"
Diffstat (limited to 'core/java')
-rwxr-xr-xcore/java/com/android/internal/app/NetInitiatedActivity.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/core/java/com/android/internal/app/NetInitiatedActivity.java b/core/java/com/android/internal/app/NetInitiatedActivity.java
index 6039cc2..e1166f1 100755
--- a/core/java/com/android/internal/app/NetInitiatedActivity.java
+++ b/core/java/com/android/internal/app/NetInitiatedActivity.java
@@ -23,6 +23,8 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
import android.widget.Toast;
import android.util.Log;
import android.location.LocationManager;
@@ -44,8 +46,12 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
private static final int POSITIVE_BUTTON = AlertDialog.BUTTON_POSITIVE;
private static final int NEGATIVE_BUTTON = AlertDialog.BUTTON_NEGATIVE;
+ private static final int GPS_NO_RESPONSE_TIME_OUT = 1;
// Received ID from intent, -1 when no notification is in progress
private int notificationId = -1;
+ private int timeout = -1;
+ private int default_response = -1;
+ private int default_response_timeout = 6;
/** Used to detect when NI request is received */
private BroadcastReceiver mNetInitiatedReceiver = new BroadcastReceiver() {
@@ -58,6 +64,21 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
}
};
+ private final Handler mHandler = new Handler() {
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case GPS_NO_RESPONSE_TIME_OUT: {
+ if (notificationId != -1) {
+ sendUserResponse(default_response);
+ }
+ finish();
+ }
+ break;
+ default:
+ }
+ }
+ };
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -75,8 +96,11 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
p.mNegativeButtonListener = this;
notificationId = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_NOTIF_ID, -1);
- if (DEBUG) Log.d(TAG, "onCreate, notifId: " + notificationId);
+ timeout = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TIMEOUT, default_response_timeout);
+ default_response = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_DEFAULT_RESPONSE, GpsNetInitiatedHandler.GPS_NI_RESPONSE_ACCEPT);
+ if (DEBUG) Log.d(TAG, "onCreate() : notificationId: " + notificationId + " timeout: " + timeout + " default_response:" + default_response);
+ mHandler.sendMessageDelayed(mHandler.obtainMessage(GPS_NO_RESPONSE_TIME_OUT), (timeout * 1000));
setupAlert();
}