<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://sdkwiki.wizarpos.com/index.php?action=history&amp;feed=atom&amp;title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD%2F%E5%88%A0%E9%99%A4</id>
	<title>非系统应用怎样设置不能卸载/删除 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://sdkwiki.wizarpos.com/index.php?action=history&amp;feed=atom&amp;title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD%2F%E5%88%A0%E9%99%A4"/>
	<link rel="alternate" type="text/html" href="http://sdkwiki.wizarpos.com/index.php?title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD/%E5%88%A0%E9%99%A4&amp;action=history"/>
	<updated>2026-04-09T04:50:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>http://sdkwiki.wizarpos.com/index.php?title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD/%E5%88%A0%E9%99%A4&amp;diff=4887&amp;oldid=prev</id>
		<title>Mahong at 05:26, 7 August 2024</title>
		<link rel="alternate" type="text/html" href="http://sdkwiki.wizarpos.com/index.php?title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD/%E5%88%A0%E9%99%A4&amp;diff=4887&amp;oldid=prev"/>
		<updated>2024-08-07T05:26:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:26, 7 August 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l39&quot;&gt;Line 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[https://github.com/SmartPOSSamples/SetUninstallApp Demo]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[https://github.com/SmartPOSSamples/SetUninstallApp Demo]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}&lt;/ins&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key media_wiki-wk:diff::1.12:old-4880:rev-4887 --&gt;
&lt;/table&gt;</summary>
		<author><name>Mahong</name></author>
	</entry>
	<entry>
		<id>http://sdkwiki.wizarpos.com/index.php?title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD/%E5%88%A0%E9%99%A4&amp;diff=4880&amp;oldid=prev</id>
		<title>Mahong: Created page with &quot;{{#ifeq:{{currentloggeduser}}||     &lt;div style=&quot;background-color: #ffcccc;border: 1px dashed red; padding: 10px;&quot;&gt; This content is restricted to authorized users only. Please log in to access additional information.	 &lt;/div&gt; |  目前有些客户希望在我们系统中增加他们自己的应用作为系统应用，主要目的就是利用谷歌的原声机制：系统应用不能被删除，只能被更新。但是从安全角度和固件版本管...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sdkwiki.wizarpos.com/index.php?title=%E9%9D%9E%E7%B3%BB%E7%BB%9F%E5%BA%94%E7%94%A8%E6%80%8E%E6%A0%B7%E8%AE%BE%E7%BD%AE%E4%B8%8D%E8%83%BD%E5%8D%B8%E8%BD%BD/%E5%88%A0%E9%99%A4&amp;diff=4880&amp;oldid=prev"/>
		<updated>2024-08-05T08:46:41Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{#ifeq:{{currentloggeduser}}||     &amp;lt;div style=&amp;quot;background-color: #ffcccc;border: 1px dashed red; padding: 10px;&amp;quot;&amp;gt; This content is restricted to authorized users only. Please &lt;a href=&quot;/index.php?title=Special:UserLogin&quot; title=&quot;Special:UserLogin&quot;&gt;log in&lt;/a&gt; to access additional information.	 &amp;lt;/div&amp;gt; |  目前有些客户希望在我们系统中增加他们自己的应用作为系统应用，主要目的就是利用谷歌的原声机制：系统应用不能被删除，只能被更新。但是从安全角度和固件版本管...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{#ifeq:{{currentloggeduser}}||&lt;br /&gt;
    &amp;lt;div style=&amp;quot;background-color: #ffcccc;border: 1px dashed red; padding: 10px;&amp;quot;&amp;gt;&lt;br /&gt;
This content is restricted to authorized users only. Please [[Special:UserLogin|log in]] to access additional information.	&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
目前有些客户希望在我们系统中增加他们自己的应用作为系统应用，主要目的就是利用谷歌的原声机制：系统应用不能被删除，只能被更新。但是从安全角度和固件版本管理角度，我们不希望客户在我们system中增加客户的apk。因此增加了这个功能：应用删除禁止列表。&lt;br /&gt;
所有在应用删除禁止列表中的package包名对应的应用，不会被系统删除，包括通过设置界面手工操作、adb uninstall或者程序使用系统API删除应用。&lt;br /&gt;
&lt;br /&gt;
调用管理接口需要申明权限：android.permission.CLOUDPOS_UNINSTALL_PROHIBITED_APPLICATION。&lt;br /&gt;
&lt;br /&gt;
在PackageManager中增加了addUninstallProhibitedApp， removeUninstallProhibitedApp和clearUninstallProhibitedApps三个方法用来管理列表。&lt;br /&gt;
但是由于这个不是谷歌原生暴露的API，建议反射调用：&lt;br /&gt;
&lt;br /&gt;
新增：&lt;br /&gt;
&lt;br /&gt;
PackageManager pm = getPackageManager();&lt;br /&gt;
&lt;br /&gt;
Method add = PackageManager.class.getMethod(&amp;quot;addUninstallProhibitedApp&amp;quot;, String.class);&lt;br /&gt;
&lt;br /&gt;
boolean result = (Boolean)add.invoke(pm, &amp;quot;com.example.realfullscreensample&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
删除：&lt;br /&gt;
&lt;br /&gt;
PackageManager pm = getPackageManager();&lt;br /&gt;
&lt;br /&gt;
Method remove = PackageManager.class.getMethod(&amp;quot;removeUninstallProhibitedApp&amp;quot;, String.class);&lt;br /&gt;
&lt;br /&gt;
boolean result = (Boolean)remove.invoke(pm, &amp;quot;com.example.realfullscreensample&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
清除：&lt;br /&gt;
&lt;br /&gt;
PackageManager pm = getPackageManager();&lt;br /&gt;
&lt;br /&gt;
Method clear = PackageManager.class.getMethod(&amp;quot;clearUninstallProhibitedApps&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
boolean result = (Boolean)remove.invoke(pm);&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SmartPOSSamples/SetUninstallApp Demo]&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Mahong</name></author>
	</entry>
</feed>