Skip to content

Commit 12902d6

Browse files
author
Jean-Baptiste Queru
committed
resolved conflicts for merge of 78742e0 to stage-korg-master
Change-Id: I0ce429afeb26184f075b4ed326fc4e1c0833e905
2 parents 1ee2394 + 78742e0 commit 12902d6

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

core/java/com/android/internal/app/NetInitiatedActivity.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import android.widget.Toast;
2727
import android.util.Log;
2828
import android.location.LocationManager;
29+
30+
import com.android.internal.R;
2931
import com.android.internal.location.GpsNetInitiatedHandler;
3032

3133
/**
@@ -42,10 +44,6 @@ public class NetInitiatedActivity extends AlertActivity implements DialogInterfa
4244
private static final int POSITIVE_BUTTON = AlertDialog.BUTTON_POSITIVE;
4345
private static final int NEGATIVE_BUTTON = AlertDialog.BUTTON_NEGATIVE;
4446

45-
// Dialog button text
46-
public static final String BUTTON_TEXT_ACCEPT = "Accept";
47-
public static final String BUTTON_TEXT_DENY = "Deny";
48-
4947
// Received ID from intent, -1 when no notification is in progress
5048
private int notificationId = -1;
5149

@@ -67,12 +65,13 @@ protected void onCreate(Bundle savedInstanceState) {
6765
// Set up the "dialog"
6866
final Intent intent = getIntent();
6967
final AlertController.AlertParams p = mAlertParams;
68+
Context context = getApplicationContext();
7069
p.mIconId = com.android.internal.R.drawable.ic_dialog_usb;
7170
p.mTitle = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TITLE);
7271
p.mMessage = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_MESSAGE);
73-
p.mPositiveButtonText = BUTTON_TEXT_ACCEPT;
72+
p.mPositiveButtonText = String.format(context.getString(R.string.gpsVerifYes));
7473
p.mPositiveButtonListener = this;
75-
p.mNegativeButtonText = BUTTON_TEXT_DENY;
74+
p.mNegativeButtonText = String.format(context.getString(R.string.gpsVerifNo));
7675
p.mNegativeButtonListener = this;
7776

7877
notificationId = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_NOTIF_ID, -1);

core/res/res/values/strings.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,4 +2348,19 @@
23482348
<!-- Text for message for an unknown external media state [CHAR LIMIT=NONE] -->
23492349
<string name="media_unknown_state">External media in unknown state.</string>
23502350

2351+
<!-- Network positioning notification ticker. The name of the user (e.g. John Doe) who sent
2352+
the request is shown as a dynamic string. -->
2353+
<string name="gpsNotifTicker">Location request from <xliff:g id="name">%s</xliff:g></string>
2354+
<!-- Network positioning notification and verification title to inform the user about
2355+
an incoming location request. -->
2356+
<string name="gpsNotifTitle">Location request</string>
2357+
<!-- Network positioning notification message. The name of the user (e.g. John Doe) and
2358+
service (SUPL-service) who sent the request is shown as dynamic strings.
2359+
Translation should not be longer than master text. -->
2360+
<string name="gpsNotifMessage">Requested by <xliff:g id="name">%1$s</xliff:g> (<xliff:g id="service" example="SUPL-service">%2$s</xliff:g>)</string>
2361+
<!-- Network positioning verification Yes. Button to push to share location information. -->
2362+
<string name="gpsVerifYes">Yes</string>
2363+
<!-- Network positioning verification No. Button to push to deny sharing of location
2364+
information. -->
2365+
<string name="gpsVerifNo">No</string>
23512366
</resources>

location/java/com/android/internal/location/GpsNetInitiatedHandler.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import android.os.RemoteException;
2929
import android.util.Log;
3030

31+
import com.android.internal.R;
32+
3133
/**
3234
* A GPS Network-initiated Handler class used by LocationManager.
3335
*
@@ -182,8 +184,8 @@ private synchronized void setNiNotification(GpsNiNotification notif) {
182184
return;
183185
}
184186

185-
String title = getNotifTitle(notif);
186-
String message = getNotifMessage(notif);
187+
String title = getNotifTitle(notif, mContext);
188+
String message = getNotifMessage(notif, mContext);
187189

188190
if (DEBUG) Log.d(TAG, "setNiNotification, notifyId: " + notif.notificationId +
189191
", title: " + title +
@@ -203,7 +205,7 @@ private synchronized void setNiNotification(GpsNiNotification notif) {
203205
}
204206

205207
mNiNotification.flags = Notification.FLAG_ONGOING_EVENT;
206-
mNiNotification.tickerText = getNotifTicker(notif);
208+
mNiNotification.tickerText = getNotifTicker(notif, mContext);
207209

208210
// if not to popup dialog immediately, pending intent will open the dialog
209211
Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent();
@@ -234,8 +236,8 @@ private void openNiDialog(GpsNiNotification notif)
234236
private Intent getDlgIntent(GpsNiNotification notif)
235237
{
236238
Intent intent = new Intent();
237-
String title = getDialogTitle(notif);
238-
String message = getDialogMessage(notif);
239+
String title = getDialogTitle(notif, mContext);
240+
String message = getDialogMessage(notif, mContext);
239241

240242
// directly bring up the NI activity
241243
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -412,41 +414,40 @@ static private String decodeString(String original, boolean isHex, int coding)
412414
}
413415

414416
// change this to configure notification display
415-
static private String getNotifTicker(GpsNiNotification notif)
417+
static private String getNotifTicker(GpsNiNotification notif, Context context)
416418
{
417-
String ticker = String.format("Position request! ReqId: [%s] ClientName: [%s]",
419+
String ticker = String.format(context.getString(R.string.gpsNotifTicker),
418420
decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding),
419421
decodeString(notif.text, mIsHexInput, notif.textEncoding));
420422
return ticker;
421423
}
422424

423425
// change this to configure notification display
424-
static private String getNotifTitle(GpsNiNotification notif)
426+
static private String getNotifTitle(GpsNiNotification notif, Context context)
425427
{
426-
String title = String.format("Position Request");
428+
String title = String.format(context.getString(R.string.gpsNotifTitle));
427429
return title;
428430
}
429431

430432
// change this to configure notification display
431-
static private String getNotifMessage(GpsNiNotification notif)
433+
static private String getNotifMessage(GpsNiNotification notif, Context context)
432434
{
433-
String message = String.format(
434-
"NI Request received from [%s] for client [%s]!",
435+
String message = String.format(context.getString(R.string.gpsNotifMessage),
435436
decodeString(notif.requestorId, mIsHexInput, notif.requestorIdEncoding),
436437
decodeString(notif.text, mIsHexInput, notif.textEncoding));
437438
return message;
438439
}
439440

440441
// change this to configure dialog display (for verification)
441-
static public String getDialogTitle(GpsNiNotification notif)
442+
static public String getDialogTitle(GpsNiNotification notif, Context context)
442443
{
443-
return getNotifTitle(notif);
444+
return getNotifTitle(notif, context);
444445
}
445446

446447
// change this to configure dialog display (for verification)
447-
static private String getDialogMessage(GpsNiNotification notif)
448+
static private String getDialogMessage(GpsNiNotification notif, Context context)
448449
{
449-
return getNotifMessage(notif);
450+
return getNotifMessage(notif, context);
450451
}
451452

452453
}

0 commit comments

Comments
 (0)