diff options
| author | 2011-07-18 09:42:55 -0700 | |
|---|---|---|
| committer | 2011-07-18 09:42:55 -0700 | |
| commit | 7adcdecf808fce832b8711aeeeb30b73371ee4ae (patch) | |
| tree | 9bf0446c330d8dafbc0932cb806e41f3131e5e54 | |
| parent | 3bfa72b119f1e701aeb9a80c59ba1d8e65f263c6 (diff) | |
NetInitiatedActivity: support AUTO response feature for SUPL IOT
Change-Id: I38a9ed0b03cb7f9ce2b81e0742ef48508d8392af
Signed-off-by: Mike Lockwood <lockwood@android.com>
| -rwxr-xr-x | core/java/com/android/internal/app/NetInitiatedActivity.java | 26 |
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 6039cc252631..e1166f120197 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(); } |