2828import android .os .RemoteException ;
2929import 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