Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Fix AppWidgetManager
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Feb 14, 2015
1 parent 99f3957 commit 7cdd431
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
<string name="system_getInstalledProviders" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#getInstalledProviders()">Google documentation</a>]]></string>
<string name="system_getInstalledProvidersForProfile" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#getInstalledProvidersForProfile(android.os.UserHandle)">Google documentation</a>]]></string>
<string name="system_Srv_getInstalledProviders" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#getInstalledProviders()">Google documentation</a>]]></string>
<string name="system_Srv_getInstalledProvidersForProfile" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/appwidget/AppWidgetManager.html#getInstalledProviders()">Google documentation</a>]]></string>
<string name="system_getRecentTasks" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/app/ActivityManager.html#getRecentTasks(int,%20int)">Google documentation</a>]]></string>
<string name="system_getRunningAppProcesses" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/app/ActivityManager.html#getRunningAppProcesses()">Google documentation</a>]]></string>
<string name="system_getRunningServices" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/app/ActivityManager.html#getRunningServices(int)">Google documentation</a>]]></string>
Expand Down
3 changes: 2 additions & 1 deletion src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ public static List<Hook> get() {

mListHook.add(new Hook("system", "getInstalledProviders", "", 3, null, null).notAOSP(19).dangerous());
mListHook.add(new Hook("system", "getInstalledProvidersForProfile", "", 21, "3.5.6", null).notAOSP(21).dangerous());
mListHook.add(new Hook("system", "Srv_getInstalledProviders", "", 3, "2.99", "getInstalledProviders").AOSP(19).dangerous());
mListHook.add(new Hook("system", "Srv_getInstalledProviders", "", 3, "2.99", "getInstalledProviders").AOSP(19).to(19).dangerous());
mListHook.add(new Hook("system", "Srv_getInstalledProvidersForProfile", "", 3, "3.6.6", null).AOSP(21).dangerous());

mListHook.add(new Hook("system", "getRecentTasks", "GET_TASKS", 1, null, null).notAOSP(19).dangerous());
mListHook.add(new Hook("system", "getRunningAppProcesses", "", 3, null, null).notAOSP(19).dangerous());
Expand Down
10 changes: 8 additions & 2 deletions src/biz/bokhorst/xprivacy/XAppWidgetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import android.appwidget.AppWidgetProviderInfo;
import android.os.Build;

public class XAppWidgetManager extends XHook {
private Methods mMethod;
Expand All @@ -13,7 +14,10 @@ private XAppWidgetManager(Methods method, String restrictionName) {
super(restrictionName, method.name().replace("Srv_", ""), method.name());
mMethod = method;
if (method.name().startsWith("Srv_"))
mClassName = "com.android.server.AppWidgetService";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mClassName = "com.android.server.appwidget.AppWidgetServiceImpl";
else
mClassName = "com.android.server.AppWidgetService";
else
mClassName = "android.appwidget.AppWidgetManager";
}
Expand All @@ -35,14 +39,15 @@ public String getClassName() {
// @formatter:on

private enum Methods {
getInstalledProviders, getInstalledProvidersForProfile, Srv_getInstalledProviders
getInstalledProviders, getInstalledProvidersForProfile, Srv_getInstalledProviders, Srv_getInstalledProvidersForProfile
};

public static List<XHook> getInstances() {
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XAppWidgetManager(Methods.getInstalledProviders, PrivacyManager.cSystem));
listHook.add(new XAppWidgetManager(Methods.getInstalledProvidersForProfile, PrivacyManager.cSystem));
listHook.add(new XAppWidgetManager(Methods.Srv_getInstalledProviders, PrivacyManager.cSystem));
listHook.add(new XAppWidgetManager(Methods.Srv_getInstalledProvidersForProfile, PrivacyManager.cSystem));
return listHook;
}

Expand All @@ -57,6 +62,7 @@ protected void after(XParam param) throws Throwable {
case getInstalledProviders:
case getInstalledProvidersForProfile:
case Srv_getInstalledProviders:
case Srv_getInstalledProvidersForProfile:
if (param.getResult() != null)
if (isRestricted(param))
param.setResult(new ArrayList<AppWidgetProviderInfo>());
Expand Down

0 comments on commit 7cdd431

Please sign in to comment.