Skip to content

Commit ef36752

Browse files
committed
Replaced raw string arguments for Context.getSystemService() with final Context variables
Change-Id: If5139a1526101292e5da557bfad3f4db80fb64a8
1 parent d6c1919 commit ef36752

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

core/java/android/app/Dialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public Dialog(Context context) {
136136
public Dialog(Context context, int theme) {
137137
mContext = new ContextThemeWrapper(
138138
context, theme == 0 ? com.android.internal.R.style.Theme_Dialog : theme);
139-
mWindowManager = (WindowManager)context.getSystemService("window");
139+
mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
140140
Window w = PolicyManager.makeNewWindow(mContext);
141141
mWindow = w;
142142
w.setCallback(this);

core/java/android/widget/MediaController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public MediaController(Context context) {
123123
}
124124

125125
private void initFloatingWindow() {
126-
mWindowManager = (WindowManager)mContext.getSystemService("window");
126+
mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
127127
mWindow = PolicyManager.makeNewWindow(mContext);
128128
mWindow.setWindowManager(mWindowManager, null, null);
129129
mWindow.requestFeature(Window.FEATURE_NO_TITLE);

tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import android.widget.ArrayAdapter;
2222
import android.view.View;
2323
import android.widget.ListView;
24+
import android.content.Context;
2425
import android.content.ContentResolver;
2526
import android.content.Intent;
2627
import android.app.Notification;
@@ -60,7 +61,7 @@ protected Test[] tests() {
6061
private Test[] mTests = new Test[] {
6162
new Test("Off and sound") {
6263
public void run() {
63-
PowerManager pm = (PowerManager)NotificationTestList.this.getSystemService("power");
64+
PowerManager pm = (PowerManager)NotificationTestList.this.getSystemService(Context.POWER_SERVICE);
6465
PowerManager.WakeLock wl =
6566
pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "sound");
6667
wl.acquire();
@@ -549,7 +550,7 @@ public void run() {
549550
public void run()
550551
{
551552
PowerManager.WakeLock wl
552-
= ((PowerManager)NotificationTestList.this.getSystemService("power"))
553+
= ((PowerManager)NotificationTestList.this.getSystemService(Context.POWER_SERVICE))
553554
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "crasher");
554555
wl.acquire();
555556
mHandler.postDelayed(new Runnable() {

0 commit comments

Comments
 (0)