forked from M66B/XPrivacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes M66B#1524
- Loading branch information
M66B
authored and
Phylon
committed
Mar 10, 2014
1 parent
7a2fa37
commit 4c9a36c
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package biz.bokhorst.xprivacy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.SimpleTimeZone; | ||
|
||
import android.util.Log; | ||
|
||
public class XTimeZone extends XHook { | ||
private Methods mMethod; | ||
|
||
private XTimeZone(Methods method, String restrictionName) { | ||
super(restrictionName, method.name(), "TZ." + method.name()); | ||
mMethod = method; | ||
} | ||
|
||
public String getClassName() { | ||
return "java.util.TimeZone"; | ||
} | ||
|
||
// public static synchronized TimeZone getDefault() | ||
// http://developer.android.com/reference/android/app/ActivityManager.html | ||
|
||
private enum Methods { | ||
getDefault | ||
}; | ||
|
||
public static List<XHook> getInstances() { | ||
List<XHook> listHook = new ArrayList<XHook>(); | ||
listHook.add(new XTimeZone(Methods.getDefault, PrivacyManager.cSystem)); | ||
return listHook; | ||
} | ||
|
||
@Override | ||
protected void before(XParam param) throws Throwable { | ||
// Do nothing | ||
} | ||
|
||
@Override | ||
protected void after(XParam param) throws Throwable { | ||
if (mMethod == Methods.getDefault) { | ||
if (param.getResult() != null && isRestricted(param)) | ||
param.setResult(new SimpleTimeZone(0, "UTC")); | ||
|
||
} else | ||
Util.log(this, Log.WARN, "Unknown method=" + param.method.getName()); | ||
} | ||
} |