@@ -165,18 +165,17 @@ public void setPermissions(String[] names) {
165165 // just remove all the old ones
166166 for (XML kid : xml .getChildren ("uses-permission" )) {
167167 String name = kid .getString ("android:name" );
168- // Don't remove required permissions for wallpapers, watchfaces and VR.
169- if (-1 < name .indexOf ("." )) continue ;
168+ // Don't remove required permissions for wallpapers, watchfaces and VR.
170169 if (appComp == AndroidBuild .WALLPAPER ) {
171170 } else if (appComp == AndroidBuild .WATCHFACE ) {
172171 if (name .equals ("WAKE_LOCK" )) continue ;
173172 } else if (appComp == AndroidBuild .VR ) {
174- if (name .equals ("INTERNET" ) ||
175- name .equals ("NFC" ) ||
176- name .equals ("VIBRATE" ) ||
177- name .equals ("READ_EXTERNAL_STORAGE" ) ||
178- name .equals ("WRITE_EXTERNAL_STORAGE" )) continue ;
173+ if (name .equals ("VIBRATE" ) ||
174+ name .equals ("READ_EXTERNAL_STORAGE" )) continue ;
179175 }
176+ // Don't remove non-standard permissions, such as
177+ // com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA
178+ if (-1 < name .indexOf ("com.google.android" )) continue ;
180179 xml .removeChild (kid );
181180 }
182181 // ...and add the new kids back
@@ -186,12 +185,9 @@ public void setPermissions(String[] names) {
186185 } else if (appComp == AndroidBuild .WATCHFACE ) {
187186 if (name .equals ("WAKE_LOCK" )) continue ;
188187 } else if (appComp == AndroidBuild .VR ) {
189- if (name .equals ("INTERNET" ) ||
190- name .equals ("NFC" ) ||
191- name .equals ("VIBRATE" ) ||
192- name .equals ("READ_EXTERNAL_STORAGE" ) ||
193- name .equals ("WRITE_EXTERNAL_STORAGE" )) continue ;
194- }
188+ if (name .equals ("VIBRATE" ) ||
189+ name .equals ("READ_EXTERNAL_STORAGE" )) continue ;
190+ }
195191 XML newbie = xml .addChild ("uses-permission" );
196192 if (-1 < name .indexOf ("." )) {
197193 // Permission string contains path
@@ -226,8 +222,8 @@ private void writeBlankManifest(final File xmlFile, final int appComp) {
226222 * Save a new version of the manifest info to the build location.
227223 * Also fill in any missing attributes that aren't yet set properly.
228224 */
229- protected void writeCopy (File file , String className ,
230- boolean debug ) throws IOException {
225+ protected void writeCopy (File file , String className , boolean setDebugAttrib ,
226+ boolean debug ) throws IOException {
231227 // write a copy to the build location
232228 save (file );
233229
@@ -257,7 +253,9 @@ protected void writeCopy(File file, String className,
257253 }
258254 }
259255
260- app .setString ("android:debuggable" , debug ? "true" : "false" );
256+ if (setDebugAttrib ) {
257+ app .setString ("android:debuggable" , debug ? "true" : "false" );
258+ }
261259
262260// XML activity = app.getChild("activity");
263261 // the '.' prefix is just an alias for the full package name
0 commit comments