2727import android .os .RemoteException ;
2828import android .util .Log ;
2929
30+ import com .android .internal .R ;
31+
3032/**
3133 * A GPS Network-initiated Handler class used by LocationManager.
3234 *
@@ -187,8 +189,8 @@ private synchronized void setNiNotification(GpsNiNotification notif) {
187189 return ;
188190 }
189191
190- String title = getNotifTitle (notif );
191- String message = getNotifMessage (notif );
192+ String title = getNotifTitle (notif , mContext );
193+ String message = getNotifMessage (notif , mContext );
192194
193195 if (DEBUG ) Log .d (TAG , "setNiNotification, notifyId: " + notif .notificationId +
194196 ", title: " + title +
@@ -208,7 +210,7 @@ private synchronized void setNiNotification(GpsNiNotification notif) {
208210 }
209211
210212 mNiNotification .flags = Notification .FLAG_ONGOING_EVENT ;
211- mNiNotification .tickerText = getNotifTicker (notif );
213+ mNiNotification .tickerText = getNotifTicker (notif , mContext );
212214
213215 // if not to popup dialog immediately, pending intent will open the dialog
214216 Intent intent = !mPopupImmediately ? getDlgIntent (notif ) : new Intent ();
@@ -239,8 +241,8 @@ private void openNiDialog(GpsNiNotification notif)
239241 private Intent getDlgIntent (GpsNiNotification notif )
240242 {
241243 Intent intent = new Intent ();
242- String title = getDialogTitle (notif );
243- String message = getDialogMessage (notif );
244+ String title = getDialogTitle (notif , mContext );
245+ String message = getDialogMessage (notif , mContext );
244246
245247 // directly bring up the NI activity
246248 intent .setFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
@@ -417,41 +419,40 @@ static private String decodeString(String original, boolean isHex, int coding)
417419 }
418420
419421 // change this to configure notification display
420- static private String getNotifTicker (GpsNiNotification notif )
422+ static private String getNotifTicker (GpsNiNotification notif , Context context )
421423 {
422- String ticker = String .format ("Position request! ReqId: [%s] ClientName: [%s]" ,
424+ String ticker = String .format (context . getString ( R . string . gpsNotifTicker ) ,
423425 decodeString (notif .requestorId , mIsHexInput , notif .requestorIdEncoding ),
424426 decodeString (notif .text , mIsHexInput , notif .textEncoding ));
425427 return ticker ;
426428 }
427429
428430 // change this to configure notification display
429- static private String getNotifTitle (GpsNiNotification notif )
431+ static private String getNotifTitle (GpsNiNotification notif , Context context )
430432 {
431- String title = String .format ("Position Request" );
433+ String title = String .format (context . getString ( R . string . gpsNotifTitle ) );
432434 return title ;
433435 }
434436
435437 // change this to configure notification display
436- static private String getNotifMessage (GpsNiNotification notif )
438+ static private String getNotifMessage (GpsNiNotification notif , Context context )
437439 {
438- String message = String .format (
439- "NI Request received from [%s] for client [%s]!" ,
440+ String message = String .format (context .getString (R .string .gpsNotifMessage ),
440441 decodeString (notif .requestorId , mIsHexInput , notif .requestorIdEncoding ),
441442 decodeString (notif .text , mIsHexInput , notif .textEncoding ));
442443 return message ;
443444 }
444445
445446 // change this to configure dialog display (for verification)
446- static public String getDialogTitle (GpsNiNotification notif )
447+ static public String getDialogTitle (GpsNiNotification notif , Context context )
447448 {
448- return getNotifTitle (notif );
449+ return getNotifTitle (notif , context );
449450 }
450451
451452 // change this to configure dialog display (for verification)
452- static private String getDialogMessage (GpsNiNotification notif )
453+ static private String getDialogMessage (GpsNiNotification notif , Context context )
453454 {
454- return getNotifMessage (notif );
455+ return getNotifMessage (notif , context );
455456 }
456457
457458}
0 commit comments