Skip to content

Commit 13acaa1

Browse files
committed
fixes manifest, add getEngine()
1 parent b79c344 commit 13acaa1

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

core/src/processing/core/PApplet.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
import android.net.Uri;
4242
import android.os.Build;
4343
import android.os.Bundle;
44+
import android.service.wallpaper.WallpaperService;
4445
import android.support.v4.content.ContextCompat;
4546
import android.view.LayoutInflater;
4647
import android.view.MotionEvent;
4748
import android.view.SurfaceHolder;
48-
import android.view.SurfaceView;
4949
import android.view.View;
5050
import android.view.ViewGroup;
5151
import android.view.inputmethod.InputMethodManager;
@@ -446,6 +446,11 @@ public Activity getActivity() {
446446
}
447447

448448

449+
public WallpaperService.Engine getEngine() {
450+
return surface.getEngine();
451+
}
452+
453+
449454
public void initSurface(AppComponent component, SurfaceHolder holder) {
450455
parentLayout = -1;
451456
initSurface(null, null, null, component, holder);

src/processing/mode/android/Manifest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,38 +156,39 @@ public void setPermissions(String[] names) {
156156
for (XML kid : xml.getChildren("uses-permission")) {
157157
String name = kid.getString("android:name");
158158
// Don't remove required permissions for wallpapers, watchfaces and cardboard.
159+
if (-1 < name.indexOf(".")) continue;
159160
if (appComp == AndroidBuild.WALLPAPER) {
160161
} else if (appComp == AndroidBuild.WATCHFACE) {
161-
if (name.equals("android.permission.WAKE_LOCK")) continue;
162+
if (name.equals("WAKE_LOCK")) continue;
162163
} else if (appComp == AndroidBuild.CARDBOARD) {
163-
if (name.equals("android.permission.INTERNET") ||
164-
name.equals("android.permission.NFC") ||
165-
name.equals("android.permission.VIBRATE") ||
166-
name.equals("android.permission.READ_EXTERNAL_STORAGE") ||
167-
name.equals("android.permission.WRITE_EXTERNAL_STORAGE")) continue;
168-
}
164+
if (name.equals("INTERNET") ||
165+
name.equals("NFC") ||
166+
name.equals("VIBRATE") ||
167+
name.equals("READ_EXTERNAL_STORAGE") ||
168+
name.equals("WRITE_EXTERNAL_STORAGE")) continue;
169+
}
169170
xml.removeChild(kid);
170171
}
171172
// ...and add the new kids back
172173
for (String name : names) {
173174
// Don't add required permissions for wallpapers, watchfaces and cardboard again.
174175
if (appComp == AndroidBuild.WALLPAPER) {
175176
} else if (appComp == AndroidBuild.WATCHFACE) {
176-
if (name.equals("android.permission.WAKE_LOCK")) continue;
177+
if (name.equals("WAKE_LOCK")) continue;
177178
} else if (appComp == AndroidBuild.CARDBOARD) {
178-
if (name.equals("android.permission.INTERNET") ||
179-
name.equals("android.permission.NFC") ||
180-
name.equals("android.permission.VIBRATE") ||
181-
name.equals("android.permission.READ_EXTERNAL_STORAGE") ||
182-
name.equals("android.permission.WRITE_EXTERNAL_STORAGE")) continue;
179+
if (name.equals("INTERNET") ||
180+
name.equals("NFC") ||
181+
name.equals("VIBRATE") ||
182+
name.equals("READ_EXTERNAL_STORAGE") ||
183+
name.equals("WRITE_EXTERNAL_STORAGE")) continue;
183184
}
184185
XML newbie = xml.addChild("uses-permission");
185186
if (-1 < name.indexOf(".")) {
186187
// Permission string contains path
187188
newbie.setString("android:name", name);
188189
} else {
189190
newbie.setString("android:name", PERMISSION_PREFIX + name);
190-
}
191+
}
191192
}
192193
save();
193194
}

0 commit comments

Comments
 (0)