Bug 48153 - Permission can't be removed using tools:node="remove"
Summary: Permission can't be removed using tools:node="remove"
Status: RESOLVED DUPLICATE of bug 52857
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-11-28 08:52 UTC by Mikhail Melnik
Modified: 2017-10-04 16:43 UTC (History)
10 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Remove Permissions Forms Project (47.55 KB, application/x-zip-compressed)
2017-06-30 19:05 UTC, kyle.spearrin
Details

Description Mikhail Melnik 2016-11-28 08:52:24 UTC
I'm using couple of 3rd party libraries which define full set of required permissions in their manifests. As a result all of them got merged into the final manifest. 

But sometimes it is necessary to remove some of them and all of the vendors recommend to use following construction:
 
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" tools:node="remove" />

which seems not to be working for Xamarin.

Xamarin Studio Business
Version 6.1.2 (build 44)
Installation UUID: f31c63f5-caed-4b21-b062-e7fdfaa690d4
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.26 (Light theme)
	GTK# 2.12.38

NuGet
Version: 3.4.3.0

Xamarin.Profiler
Not Installed

Xamarin.Android
Version: 7.0.2.37 (Xamarin Business)
Android SDK: D:\Development\Android\bundle\sdk
	Supported Android versions:
		4.3 (API level 18)
		5.0 (API level 21)
		6.0 (API level 23)
		7.0 (API level 24)

SDK Tools Version: 25.2.3
SDK Platform Tools Version: 25.0.1
SDK Build Tools Version: 25.0.1

Java SDK: C:\Program Files\Java\jdk1.8.0_66
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Android Player
Not Installed

Build Information
Release ID: 601020044
Git revision: 0ccfcd52b95305ebd5b7eca0d88c1017035910ae
Build date: 2016-10-28 15:02:50-04
Xamarin addins: a39a869d8a78d87bdc6775f696c13a4cc9024501
Build lane: monodevelop-windows-cycle8

Operating System
Windows 10.0.14393.0 (64-bit)
Comment 1 Thomas Van den Bossche 2017-02-15 10:23:10 UTC
Any update on this?
Comment 2 Hines Vaughan III 2017-02-27 15:43:27 UTC
Indeed, would be very nice to be able to remove permissions.

For example, on Android 4.0.3 and below required the GET_ACCOUNTS permission. This permission is defined in certain push notification plugins and therefore gets defined in our app's final build. Our app, however, targets Android 4.1 and above so not only is the permission not needed but it also makes users uneasy to see that our app wants permission to view the device's "Accounts". The user does not necessarily know what this actually means but is still put off by it.

Any update you can provide on this? Thank you for your help.
Comment 3 Ağlarda Güvenlik 2017-03-29 12:40:50 UTC
Any update on this? Important issue!!
Comment 4 kyle.spearrin 2017-06-10 01:45:51 UTC
Any update?
Comment 5 John Miller [MSFT] 2017-06-30 18:45:50 UTC
Thank you for taking the time to submit the bug. We are unable to reproduce this issue. Please attach a reproduction to the bug by starting with a clean Xamarin.Android project and adding just the code necessary to demonstrate the issue. Thank you!
Comment 6 kyle.spearrin 2017-06-30 19:05:05 UTC
Created attachment 23246 [details]
Remove Permissions Forms Project

Open the attached Xamarin.Forms project, observe the `AndroidManifest.xml` has:

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
  <uses-permission android:name="android.permission.INTERNET" tools:node="remove" />

Build the project. Observe the merged manifest in `obj/Debug` has:

  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
  <uses-permission android:name="android.permission.INTERNET" tools:node="remove" />

`android.permission.WRITE_EXTERNAL_STORAGE` and `android.permission.INTERNET` should have been removed.
Comment 8 Jon Douglas [MSFT] 2017-10-04 16:43:45 UTC
I am marking this issue as a duplicate of my feature request in https://bugzilla.xamarin.com/show_bug.cgi?id=52857 which outlines the need for supporting more advanced features of AndroidManifest.xmml merging.

*** This bug has been marked as a duplicate of bug 52857 ***

Note You need to log in before you can comment on or make changes to this bug.