Permalink
Browse files

Add a "No wallpaper" wallpaper option.

The simplest implementation is with a black 1x1px image,
but it could be implemented in a more efficient way in the future.
(i.e. the black image is an implementation detail of the
"no wallpaper" goal).

On Nexus One (OLED) this "no wallpaper" produces
45mA current saving compared to the "CM Earth" image wallpaper
when display is set to max brightness, and 20mA saving on low brightness.

Change-Id: I3551f9b6c7812ed32c4dc0d9ee3fa4f454714242
  • Loading branch information...
1 parent 96ffb2a commit ab57a8091a3405c9decfcb99aecce834c179e547 Mihai Preda committed Jun 11, 2011
View
@@ -17,6 +17,15 @@
</intent-filter>
</activity>
+ <activity
+ android:name="NoWallpaper"
+ android:label="@string/no_wallpaper" >
+ <intent-filter>
+ <action android:name="android.intent.action.SET_WALLPAPER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
</application>
</manifest>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -3,4 +3,5 @@
<string name="app_name">CyanogenMod Wallpapers</string>
<string name="app_label">CyanogenMod Wallpapers</string>
<string name="set_wallpaper">Set wallpaper</string>
+<string name="no_wallpaper">No wallpaper</string>
</resources>
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cyanogenmod.CMWallpapers;
+
+import android.app.Activity;
+import android.app.WallpaperManager;
+import android.os.Bundle;
+
+public class NoWallpaper extends Activity {
+ public void onCreate(Bundle bundle) {
+ super.onCreate(bundle);
+ finish();
+ try {
+ WallpaperManager wm = WallpaperManager.getInstance(this);
+ wm.setResource(R.drawable.black);
+ } catch (java.io.IOException e) {
+ }
+ }
+}

0 comments on commit ab57a80

Please sign in to comment.