Merge "Clean up dead code in NetInitiatedActivity" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
91568eb50e
@@ -17,18 +17,14 @@
|
|||||||
package com.android.internal.app;
|
package com.android.internal.app;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.location.LocationManagerInternal;
|
import android.location.LocationManagerInternal;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
import com.android.internal.location.GpsNetInitiatedHandler;
|
import com.android.internal.location.GpsNetInitiatedHandler;
|
||||||
@@ -43,7 +39,6 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
|
|||||||
private static final String TAG = "NetInitiatedActivity";
|
private static final String TAG = "NetInitiatedActivity";
|
||||||
|
|
||||||
private static final boolean DEBUG = true;
|
private static final boolean DEBUG = true;
|
||||||
private static final boolean VERBOSE = false;
|
|
||||||
|
|
||||||
private static final int POSITIVE_BUTTON = AlertDialog.BUTTON_POSITIVE;
|
private static final int POSITIVE_BUTTON = AlertDialog.BUTTON_POSITIVE;
|
||||||
private static final int NEGATIVE_BUTTON = AlertDialog.BUTTON_NEGATIVE;
|
private static final int NEGATIVE_BUTTON = AlertDialog.BUTTON_NEGATIVE;
|
||||||
@@ -55,17 +50,6 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
|
|||||||
private int default_response = -1;
|
private int default_response = -1;
|
||||||
private int default_response_timeout = 6;
|
private int default_response_timeout = 6;
|
||||||
|
|
||||||
/** Used to detect when NI request is received */
|
|
||||||
private BroadcastReceiver mNetInitiatedReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (DEBUG) Log.d(TAG, "NetInitiatedReceiver onReceive: " + intent.getAction());
|
|
||||||
if (intent.getAction() == GpsNetInitiatedHandler.ACTION_NI_VERIFY) {
|
|
||||||
handleNIVerify(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final Handler mHandler = new Handler() {
|
private final Handler mHandler = new Handler() {
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
@@ -109,14 +93,12 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (DEBUG) Log.d(TAG, "onResume");
|
if (DEBUG) Log.d(TAG, "onResume");
|
||||||
registerReceiver(mNetInitiatedReceiver, new IntentFilter(GpsNetInitiatedHandler.ACTION_NI_VERIFY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (DEBUG) Log.d(TAG, "onPause");
|
if (DEBUG) Log.d(TAG, "onPause");
|
||||||
unregisterReceiver(mNetInitiatedReceiver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,17 +123,4 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
|
|||||||
LocationManagerInternal lm = LocalServices.getService(LocationManagerInternal.class);
|
LocationManagerInternal lm = LocalServices.getService(LocationManagerInternal.class);
|
||||||
lm.sendNiResponse(notificationId, response);
|
lm.sendNiResponse(notificationId, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
private void handleNIVerify(Intent intent) {
|
|
||||||
int notifId = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_NOTIF_ID, -1);
|
|
||||||
notificationId = notifId;
|
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "handleNIVerify action: " + intent.getAction());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showNIError() {
|
|
||||||
Toast.makeText(this, "NI error" /* com.android.internal.R.string.usb_storage_error_message */,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ public class GpsNetInitiatedHandler {
|
|||||||
|
|
||||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||||
|
|
||||||
// NI verify activity for bringing up UI (not used yet)
|
|
||||||
public static final String ACTION_NI_VERIFY = "android.intent.action.NETWORK_INITIATED_VERIFY";
|
|
||||||
|
|
||||||
// string constants for defining data fields in NI Intent
|
// string constants for defining data fields in NI Intent
|
||||||
public static final String NI_INTENT_KEY_NOTIF_ID = "notif_id";
|
public static final String NI_INTENT_KEY_NOTIF_ID = "notif_id";
|
||||||
public static final String NI_INTENT_KEY_TITLE = "title";
|
public static final String NI_INTENT_KEY_TITLE = "title";
|
||||||
|
|||||||
Reference in New Issue
Block a user