forked from morristech/PDroid2.0_Framework_Patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CM10.1_framework.patch
15184 lines (15007 loc) · 712 KB
/
CM10.1_framework.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/Android.mk pang/frameworks/base/Android.mk
--- /media/ROM-Speicher/CM10.1/frameworks/base/Android.mk 2013-05-03 11:50:59.413852707 +0545
+++ pang/frameworks/base/Android.mk 2013-05-03 22:01:20.073753620 +0545
@@ -55,6 +55,7 @@ LOCAL_SRC_FILES := $(filter-out \
## across process boundaries.
##
## READ ME: ########################################################
+# BEGIN privacy-added: IPrivacySettingsManager.aidl
LOCAL_SRC_FILES += \
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl \
core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl \
@@ -213,6 +214,7 @@ LOCAL_SRC_FILES += \
media/java/android/media/IRemoteControlDisplay.aidl \
media/java/android/media/IRemoteVolumeObserver.aidl \
media/java/android/media/IRingtonePlayer.aidl \
+ privacy/java/android/privacy/IPrivacySettingsManager.aidl \
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
telephony/java/com/android/internal/telephony/ITelephony.aidl \
@@ -238,6 +240,7 @@ LOCAL_SRC_FILES += \
fmradio/java/com/stericsson/hardware/fm/IOnExtraCommandListener.aidl \
fmradio/java/com/stericsson/hardware/fm/IOnAutomaticSwitchListener.aidl
#
+# END privacy-added: IPrivacySettingsManager.aidl
# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk
@@ -277,6 +280,7 @@ framework_built := $(call java-lib-deps,
# AIDL files to be preprocessed and included in the SDK,
# relative to the root of the build tree.
# ============================================================
+# BEGIN privacy-added: PrivacySettings.aidl
aidl_files := \
frameworks/base/core/java/android/accounts/IAccountManager.aidl \
frameworks/base/core/java/android/accounts/IAccountManagerResponse.aidl \
@@ -325,6 +329,7 @@ aidl_files := \
frameworks/base/location/java/android/location/Criteria.aidl \
frameworks/base/location/java/android/location/Geofence.aidl \
frameworks/base/location/java/android/location/Location.aidl \
+ frameworks/base/privacy/java/android/privacy/PrivacySettings.aidl \
frameworks/base/location/java/android/location/LocationRequest.aidl \
frameworks/base/location/java/com/android/internal/location/ProviderProperties.aidl \
frameworks/base/location/java/com/android/internal/location/ProviderRequest.aidl \
@@ -333,6 +338,8 @@ aidl_files := \
frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl \
gen := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
+# END privacy-added: PrivacySettings.aidl
+
$(gen): PRIVATE_SRC_FILES := $(aidl_files)
ALL_SDK_FILES += $(gen)
$(gen): $(aidl_files) | $(AIDL)
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/ActivityManagerNative.java pang/frameworks/base/core/java/android/app/ActivityManagerNative.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/ActivityManagerNative.java 2013-04-02 21:48:00.353501856 +0545
+++ pang/frameworks/base/core/java/android/app/ActivityManagerNative.java 2013-05-03 21:34:13.395969959 +0545
@@ -47,6 +47,11 @@ import android.util.Singleton;
import java.util.ArrayList;
import java.util.List;
+///////////////////////////////////////////////
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+///////////////////////////////////////////////
+
/** {@hide} */
public abstract class ActivityManagerNative extends Binder implements IActivityManager
{
@@ -3087,6 +3092,12 @@ class ActivityManagerProxy implements IA
}
public int checkPermission(String permission, int pid, int uid)
throws RemoteException {
+ if (permission.equals("android.privacy.WRITE_PRIVACY_SETTINGS")) {
+ IPackageManager mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ String[] package_names = mPm.getPackagesForUid(uid);
+ for(String packageName : package_names)
+ if(!packageName.equals("com.android.privacy.pdroid20")) return PackageManager.PERMISSION_DENIED;
+ }
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/ContextImpl.java pang/frameworks/base/core/java/android/app/ContextImpl.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/ContextImpl.java 2013-04-02 21:48:00.385501449 +0545
+++ pang/frameworks/base/core/java/android/app/ContextImpl.java 2013-05-03 21:34:52.431950963 +0545
@@ -65,7 +65,7 @@ import android.location.ILocationManager
import android.location.LocationManager;
import android.media.AudioManager;
import android.media.MediaRouter;
-import android.net.ConnectivityManager;
+//import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
import android.net.INetworkPolicyManager;
import android.net.NetworkPolicyManager;
@@ -117,6 +117,16 @@ import android.accounts.IAccountManager;
import android.app.admin.DevicePolicyManager;
import com.android.internal.os.IDropBoxManagerService;
+// BEGIN privacy-added
+import android.privacy.IPrivacySettingsManager;
+import android.privacy.PrivacySettingsManager;
+import android.privacy.surrogate.PrivacyAccountManager;
+import android.privacy.surrogate.PrivacyLocationManager;
+import android.privacy.surrogate.PrivacyTelephonyManager;
+import android.privacy.surrogate.PrivacyWifiManager;
+import android.privacy.surrogate.PrivacyConnectivityManager;
+// END privacy-added
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -192,6 +202,9 @@ class ContextImpl extends Context {
private Resources mResources;
/*package*/ ActivityThread mMainThread;
private Context mOuterContext;
+ // BEGIN privacy-added
+ private static Context sOuterContext;
+ // END privacy-added
private IBinder mActivityToken = null;
private ApplicationContentResolver mContentResolver;
private int mThemeResource = 0;
@@ -307,7 +320,10 @@ class ContextImpl extends Context {
public Object createService(ContextImpl ctx) {
IBinder b = ServiceManager.getService(ACCOUNT_SERVICE);
IAccountManager service = IAccountManager.Stub.asInterface(b);
- return new AccountManager(ctx, service);
+ //return new AccountManager(ctx, service);
+ // BEGIN privacy-modified
+ return new PrivacyAccountManager(ctx, service);
+ // END privacy-modified
}});
registerService(ACTIVITY_SERVICE, new ServiceFetcher() {
@@ -346,7 +362,11 @@ class ContextImpl extends Context {
registerService(CONNECTIVITY_SERVICE, new StaticServiceFetcher() {
public Object createStaticService() {
IBinder b = ServiceManager.getService(CONNECTIVITY_SERVICE);
- return new ConnectivityManager(IConnectivityManager.Stub.asInterface(b));
+ //BEGIN PRIVACY ADDED
+ //return new ConnectivityManager(IConnectivityManager.Stub.asInterface(b));
+ IConnectivityManager service = IConnectivityManager.Stub.asInterface(b);
+ return new PrivacyConnectivityManager(service, getStaticOuterContext());
+ //END PRIVACY ADDED
}});
registerService(COUNTRY_DETECTOR, new StaticServiceFetcher() {
@@ -412,8 +432,15 @@ class ContextImpl extends Context {
registerService(LOCATION_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
- IBinder b = ServiceManager.getService(LOCATION_SERVICE);
- return new LocationManager(ctx, ILocationManager.Stub.asInterface(b));
+
+ IBinder b = ServiceManager.getService(LOCATION_SERVICE);
+
+ //return new LocationManager(ctx, ILocationManager.Stub.asInterface(b));
+
+ // BEGIN privacy-modified
+ return new PrivacyLocationManager(ILocationManager.Stub.asInterface(b), getStaticOuterContext());
+ // END privacy-modified
+
}});
registerService(NETWORK_POLICY_SERVICE, new ServiceFetcher() {
@@ -484,7 +511,10 @@ class ContextImpl extends Context {
registerService(TELEPHONY_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
- return new TelephonyManager(ctx.getOuterContext());
+ //return new TelephonyManager(ctx.getOuterContext());
+ // BEGIN privacy-modified
+ return new PrivacyTelephonyManager(ctx.getOuterContext());
+ // END privacy-modified
}});
registerService(THROTTLE_SERVICE, new StaticServiceFetcher() {
@@ -521,7 +551,10 @@ class ContextImpl extends Context {
public Object createService(ContextImpl ctx) {
IBinder b = ServiceManager.getService(WIFI_SERVICE);
IWifiManager service = IWifiManager.Stub.asInterface(b);
- return new WifiManager(ctx.getOuterContext(), service);
+ // BEGIN privacy
+ //return new WifiManager(ctx.getOuterContext(), service);
+ return new PrivacyWifiManager(service, ctx);
+ // END privacy
}});
registerService(WIFI_P2P_SERVICE, new ServiceFetcher() {
@@ -573,6 +606,14 @@ class ContextImpl extends Context {
IFmTransmitter service = IFmTransmitter.Stub.asInterface(b);
return new FmTransmitterImpl(service);
}});
+ // BEGIN privacy-added
+ registerService("privacy", new StaticServiceFetcher() {
+ public Object createStaticService() {
+ IBinder b = ServiceManager.getService("privacy");
+ IPrivacySettingsManager service = IPrivacySettingsManager.Stub.asInterface(b);
+ return new PrivacySettingsManager(getStaticOuterContext(),service);
+ }});
+ // END privacy-added
}
static ContextImpl getImpl(Context context) {
@@ -1081,7 +1122,8 @@ class ContextImpl extends Context {
@Override
public void sendBroadcast(Intent intent) {
- warnIfCallingFromSystemProcess();
+ if(!isPrivacyBroadCast(intent))
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1095,7 +1137,8 @@ class ContextImpl extends Context {
@Override
public void sendBroadcast(Intent intent, String receiverPermission) {
- warnIfCallingFromSystemProcess();
+ if(!isPrivacyBroadCast(intent))
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1110,7 +1153,8 @@ class ContextImpl extends Context {
@Override
public void sendOrderedBroadcast(Intent intent,
String receiverPermission) {
- warnIfCallingFromSystemProcess();
+ if(!isPrivacyBroadCast(intent))
+ warnIfCallingFromSystemProcess();
String resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
try {
intent.setAllowFds(false);
@@ -1764,6 +1808,18 @@ class ContextImpl extends Context {
message);
}
+ /**
+ * checks if current intent is a privacy related intent
+ * @param intent current intent
+ * @return true if intent contains privacy notifications, false otherwise
+ */
+ private boolean isPrivacyBroadCast(Intent intent) {
+ if(intent != null && intent.getAction() != null && intent.getAction().equals(PrivacySettingsManager.ACTION_PRIVACY_NOTIFICATION))
+ return true;
+ else
+ return false;
+ }
+
private void warnIfCallingFromSystemProcess() {
if (Process.myUid() == Process.SYSTEM_UID) {
Slog.w(TAG, "Calling a method in the system process without a qualified user: "
@@ -1886,7 +1942,7 @@ class ContextImpl extends Context {
}
ContextImpl() {
- mOuterContext = this;
+ sOuterContext = mOuterContext = this;
}
/**
@@ -1903,7 +1959,7 @@ class ContextImpl extends Context {
mContentResolver = context.mContentResolver;
mUser = context.mUser;
mDisplay = context.mDisplay;
- mOuterContext = this;
+ sOuterContext = mOuterContext = this;
}
final void init(LoadedApk packageInfo, IBinder activityToken, ActivityThread mainThread) {
@@ -1959,13 +2015,17 @@ class ContextImpl extends Context {
}
final void setOuterContext(Context context) {
- mOuterContext = context;
+ sOuterContext = mOuterContext = context;
}
final Context getOuterContext() {
return mOuterContext;
}
+ final static Context getStaticOuterContext() {
+ return sOuterContext;
+ }
+
final IBinder getActivityToken() {
return mActivityToken;
}
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/Instrumentation.java pang/frameworks/base/core/java/android/app/Instrumentation.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/app/Instrumentation.java 2013-04-02 21:48:00.389501400 +0545
+++ pang/frameworks/base/core/java/android/app/Instrumentation.java 2013-02-02 17:17:26.142024946 +0545
@@ -48,6 +48,14 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
+///////////////////////////////////////////////////
+import android.privacy.IPrivacySettingsManager;
+import android.privacy.PrivacySettings;
+import android.privacy.PrivacySettingsManager;
+import android.privacy.utilities.PrivacyDebugger;
+import android.telephony.TelephonyManager;
+///////////////////////////////////////////////////
+
/**
* Base class for implementing application instrumentation code. When running
@@ -88,6 +96,10 @@ public class Instrumentation {
private boolean mAutomaticPerformanceSnapshots = false;
private PerformanceCollector mPerformanceCollector;
private Bundle mPerfMetrics = new Bundle();
+
+ //---------------------------------------------------------------------------------------------------------------------------------------------------------
+ private PrivacySettingsManager pSetMan;
+ //---------------------------------------------------------------------------------------------------------------------------------------------------------
public Instrumentation() {
}
@@ -1391,6 +1403,62 @@ public class Instrumentation {
Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+ //we first do not intercept open activity, because we're looking forward if it works fine!
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ boolean isAllowed = true;
+ try{
+ PrivacyDebugger.i("PrivacyContext","now we are in execStartActivity() from package: " + who.getPackageName());
+ if(intent != null && intent.getAction() != null && (intent.getAction().equals(Intent.ACTION_CALL) || intent.getAction().equals(Intent.ACTION_DIAL))) {
+ PrivacyDebugger.i("PrivacyContext","package: " + who.getPackageName() + " tries to take a phone call");
+ if(pSetMan == null) pSetMan = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ PrivacySettings settings = pSetMan.getSettings(who.getPackageName(), -1);
+ if(pSetMan != null && settings != null && settings.getPhoneCallSetting() != PrivacySettings.REAL){ //is not allowed
+ //test if broadcasting works!
+ final Context tmp = who;
+ isAllowed = false;
+ new Thread(new Runnable() {
+ public void run() {
+ try{
+ Thread.sleep(1000); //wait 1 Second
+ }
+ catch(Exception e){
+ //nothing here
+ }
+ Intent privacy = new Intent("android.privacy.BLOCKED_PHONE_CALL");
+ Bundle extras = new Bundle();
+ extras.putString("packageName", tmp.getPackageName());
+ extras.putInt("phoneState", TelephonyManager.CALL_STATE_IDLE);
+ privacy.putExtras(extras);
+ tmp.sendBroadcast(privacy);
+ PrivacyDebugger.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+
+ if(settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+ else{ //is allowed
+ isAllowed = true;
+ if(settings != null && settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+
+ }
+ }
+ catch(Exception e){
+ //e.printStackTrace();
+ if(who != null)
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for package: " + who.getPackageName(), e);
+ else
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for unknown package", e);
+
+ }
+
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1406,6 +1474,15 @@ public class Instrumentation {
}
}
}
+ //now fake state
+ try{
+ if(!isAllowed) return new ActivityResult(requestCode, intent);
+ }
+ catch(Exception e){
+ //e.printStackTrace();
+ //nothing here
+ }
+ //end testing
try {
intent.setAllowFds(false);
intent.migrateExtraStreamToClipData();
@@ -1446,6 +1523,72 @@ public class Instrumentation {
IBinder token, Activity target, Intent[] intents, Bundle options,
int userId) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ boolean isAllowed = true;
+ try{
+ PrivacyDebugger.i("PrivacyContext","now we are in execStartActivities() from package: " + who.getPackageName());
+ List<Intent> tmp = new ArrayList<Intent>();
+ boolean call_detected = false;
+ for(int i=0;i<intents.length;i++){
+ if(intents[i].getAction() != null && (intents[i].getAction().equals(Intent.ACTION_CALL) || intents[i].getAction().equals(Intent.ACTION_DIAL))) {
+ call_detected = true;
+ continue;
+ }
+ tmp.add(intents[i]);
+ }
+ if(call_detected){
+ PrivacyDebugger.i("PrivacyContext","package: " + who.getPackageName() + " tries to take a phone call");
+ if(pSetMan == null) pSetMan = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ PrivacySettings settings = pSetMan.getSettings(who.getPackageName(), -1);
+ if(pSetMan != null && settings != null && settings.getPhoneCallSetting() != PrivacySettings.REAL){ //is not allowed
+ final Context ctx = who;
+ //now replace intents
+ intents = (Intent[]) tmp.toArray();
+ tmp = null;
+ System.gc();
+ new Thread(new Runnable() {
+ public void run() {
+ try{
+ Thread.sleep(1000); //wait 1 Second
+ }
+ catch(Exception e){
+ //nothing here
+ }
+ Intent privacy = new Intent("android.privacy.BLOCKED_PHONE_CALL");
+ Bundle extras = new Bundle();
+ extras.putString("packageName", ctx.getPackageName());
+ extras.putInt("phoneState", TelephonyManager.CALL_STATE_IDLE);
+ privacy.putExtras(extras);
+ ctx.sendBroadcast(privacy);
+ PrivacyDebugger.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ if(settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+ else{
+ if(settings != null && settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+
+ }
+ else{
+ tmp = null;
+ System.gc();
+ }
+ }
+ catch(Exception e){
+ //e.printStackTrace();
+ if(who != null)
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for package: " + who.getPackageName(), e);
+ else
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for unknown package", e);
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1506,6 +1649,56 @@ public class Instrumentation {
Context who, IBinder contextThread, IBinder token, Fragment target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ boolean isAllowed = true;
+ try{
+ PrivacyDebugger.i("PrivacyContext","now we are in execStartActivity() from package: " + who.getPackageName());
+ if(intent != null && intent.getAction() != null && (intent.getAction().equals(Intent.ACTION_CALL) || intent.getAction().equals(Intent.ACTION_DIAL))) {
+ PrivacyDebugger.i("PrivacyContext","package: " + who.getPackageName() + " tries to take a phone call");
+ if(pSetMan == null) pSetMan = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ PrivacySettings settings = pSetMan.getSettings(who.getPackageName(), -1);
+ if(pSetMan != null && settings != null && settings.getPhoneCallSetting() != PrivacySettings.REAL){ //is not allowed
+ final Context tmp = who;
+ isAllowed = false;
+ new Thread(new Runnable() {
+ public void run() {
+ try{
+ Thread.sleep(1000); //wait 1 Second
+ }
+ catch(Exception e){
+ //nothing here
+ }
+ Intent privacy = new Intent("android.privacy.BLOCKED_PHONE_CALL");
+ Bundle extras = new Bundle();
+ extras.putString("packageName", tmp.getPackageName());
+ extras.putInt("phoneState", TelephonyManager.CALL_STATE_IDLE);
+ privacy.putExtras(extras);
+ tmp.sendBroadcast(privacy);
+ PrivacyDebugger.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ if(settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+ else{
+ isAllowed = true;
+ if(settings != null && settings.isDefaultDenyObject())
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.ERROR, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ else
+ pSetMan.notification(who.getPackageName(), 0, PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null, settings);
+ }
+ }
+ }
+ catch(Exception e){
+ //e.printStackTrace();
+ if(who != null)
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for package: " + who.getPackageName(), e);
+ else
+ PrivacyDebugger.i("PrivacyContext","got exception while trying to resolve intents for unknown package", e);
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1521,6 +1714,15 @@ public class Instrumentation {
}
}
}
+ //fake state
+ try{
+ if(!isAllowed) return new ActivityResult(requestCode, intent);
+ }
+ catch(Exception e){
+ //e.printStackTrace();
+ //nothing here
+ }
+ //end faking
try {
intent.setAllowFds(false);
intent.migrateExtraStreamToClipData();
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/content/ContentResolver.java pang/frameworks/base/core/java/android/content/ContentResolver.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/content/ContentResolver.java 2013-04-02 21:48:00.401501253 +0545
+++ pang/frameworks/base/core/java/android/content/ContentResolver.java 2013-01-16 01:18:39.748746180 +0545
@@ -44,6 +44,10 @@ import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
+// BEGIN privacy-added
+import android.privacy.surrogate.PrivacyContentResolver;
+// END privacy-added
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -371,6 +375,9 @@ public abstract class ContentResolver {
try {
qCursor = unstableProvider.query(uri, projection,
selection, selectionArgs, sortOrder, remoteCancellationSignal);
+ // BEGIN privacy-added
+ qCursor = PrivacyContentResolver.enforcePrivacyPermission(uri, projection, mContext, qCursor);
+ // END privacy-added
} catch (DeadObjectException e) {
// The remote process has died... but we only hold an unstable
// reference though, so we might recover!!! Let's try!!!!
@@ -382,6 +389,10 @@ public abstract class ContentResolver {
}
qCursor = stableProvider.query(uri, projection,
selection, selectionArgs, sortOrder, remoteCancellationSignal);
+ // BEGIN privacy-added
+ qCursor = PrivacyContentResolver.enforcePrivacyPermission(uri, projection, mContext, qCursor);
+ // END privacy-added
+
}
if (qCursor == null) {
return null;
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/content/ContextWrapper.java pang/frameworks/base/core/java/android/content/ContextWrapper.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/content/ContextWrapper.java 2013-04-02 21:48:00.405501203 +0545
+++ pang/frameworks/base/core/java/android/content/ContextWrapper.java 2013-01-16 01:18:39.752744129 +0545
@@ -52,6 +52,8 @@ import java.io.InputStream;
*/
public class ContextWrapper extends Context {
Context mBase;
+
+ private static final String TAG = "PrivacyContextWrapper";
public ContextWrapper(Context base) {
mBase = base;
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/hardware/Camera.java pang/frameworks/base/core/java/android/hardware/Camera.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/hardware/Camera.java 2013-05-03 11:50:59.505805550 +0545
+++ pang/frameworks/base/core/java/android/hardware/Camera.java 2013-05-04 11:59:25.929628605 +0545
@@ -42,6 +42,27 @@ import java.util.HashMap;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
+///////////////////////////////////////////////////////
+import android.privacy.IPrivacySettingsManager;
+import android.privacy.PrivacySettings;
+import android.privacy.PrivacySettingsManager;
+import android.privacy.utilities.PrivacyDebugger;
+
+import android.content.Context;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+
+import android.os.Process;
+import android.os.ServiceManager;
+import java.util.Random;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+///////////////////////////////////////////////////////
+
/**
* The Camera class is used to set image capture settings, start/stop preview,
* snap pictures, and retrieve frames for encoding for video. This class is a
@@ -162,6 +183,158 @@ public class Camera {
private boolean mFaceDetectionRunning = false;
private Object mAutoFocusCallbackLock = new Object();
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+
+ private static final int IS_ALLOWED = -1;
+ private static final int IS_NOT_ALLOWED = -2;
+ private static final int GOT_ERROR = -3;
+
+ private static final String PRIVACY_TAG = "PM,Camera";
+
+ private Context context;
+
+ private PrivacySettingsManager pSetMan;
+
+ private boolean privacyMode = false;
+
+ private IPackageManager mPm;
+
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+ /**
+ * {@hide}
+ * @return package names of current process which is using this object or null if something went wrong
+ */
+ private String[] getPackageName(){
+ try{
+ if(mPm != null){
+ int uid = Process.myUid();
+ String[] package_names = mPm.getPackagesForUid(uid);
+ return package_names;
+ }
+ else{
+ mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ int uid = Process.myUid();
+ String[] package_names = mPm.getPackagesForUid(uid);
+ return package_names;
+ }
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ PrivacyDebugger.e(PRIVACY_TAG,"something went wrong with getting package name");
+ return null;
+ }
+ }
+ /**
+ * This method returns the fake image which should be in system folder!
+ * @return byte array of jpeg fake image or null if something went wrong
+ * {@hide}
+ */
+ private byte[] getFakeImage(){
+ try{
+ String filepath = "/system/media/PDroid.jpeg";
+ File imagefile = new File(filepath);
+ FileInputStream fis = null;
+
+ fis = new FileInputStream(imagefile);
+
+ Bitmap bm = BitmapFactory.decodeStream(fis);
+ ByteArrayOutputStream helper = new ByteArrayOutputStream();
+ bm.compress(Bitmap.CompressFormat.JPEG, 100 , helper);
+ return helper.toByteArray();
+ }
+ catch (Exception e){
+ PrivacyDebugger.e(PRIVACY_TAG,"something went wrong with getting the picture!");
+ e.printStackTrace();
+ return null;
+ }
+ }
+ /**
+ * {@hide}
+ * This method sets up all variables which are needed for privacy mode! It also writes to privacyMode, if everything was successfull or not!
+ * -> privacyMode = true ok! otherwise false!
+ * CALL THIS METHOD IN CONSTRUCTOR!
+ */
+ private void initiate(){
+ try{
+ context = null;
+ pSetMan = new PrivacySettingsManager(context, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ mPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
+ privacyMode = true;
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ PrivacyDebugger.e(PRIVACY_TAG, "Something went wrong with initalize variables");
+ privacyMode = false;
+ }
+ }
+
+ /**
+ * This method should be used, because in some devices the uid has more than one package within!
+ * It also includes the notification! It also handles the default deny mode!
+ * @return IS_ALLOWED (-1) if all packages allowed, IS_NOT_ALLOWED(-2) if one of these packages not allowed
+ */
+ private int checkIfPackagesAllowed(){
+ try{
+ if(pSetMan == null)
+ pSetMan = new PrivacySettingsManager(context, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ PrivacySettings pSet = null;
+ String[] package_names = getPackageName();
+ if(package_names != null){
+ for(String pack : package_names){
+ pSet = pSetMan.getSettings(pack);
+ if(pSet != null && (pSet.getCameraSetting() != PrivacySettings.REAL)){ //if pSet is null, we allow application to access to mic
+ if(pSet.isDefaultDenyObject())
+ pSetMan.notification(pack, 0, PrivacySettings.ERROR, PrivacySettings.DATA_CAMERA, null, null);
+ else
+ pSetMan.notification(pack, 0, PrivacySettings.EMPTY, PrivacySettings.DATA_CAMERA, null, null);
+ PrivacyDebugger.i(TAG, "package: " + pack + " is not allowed to access camera. Default deny mode on: " + pSet.isDefaultDenyObject());
+ return IS_NOT_ALLOWED;
+ }
+ pSet = null;
+ }
+ PrivacyDebugger.w(PRIVACY_TAG,"allowing package: " + package_names[0] + " accessing the camera");
+ pSetMan.notification(package_names[0], 0, PrivacySettings.REAL, PrivacySettings.DATA_CAMERA, null, null);
+ return IS_ALLOWED;
+ }
+ else{
+ int output;
+ PrivacyDebugger.w(PRIVACY_TAG, "can't parse packages, going to apply default deny mode");
+ if(PrivacySettings.CURRENT_DEFAULT_DENY_MODE != PrivacySettings.DEFAULT_DENY_REAL) {
+ pSetMan.notification("UNKNOWN", 0, PrivacySettings.ERROR, PrivacySettings.DATA_CAMERA, null, null);
+ output = IS_NOT_ALLOWED;
+ } else {
+ pSetMan.notification("UNKNOWN", 0, PrivacySettings.ERROR, PrivacySettings.DATA_CAMERA, null, null);
+ output = IS_ALLOWED;
+ }
+ return output;
+ }
+ }
+ catch (Exception e){
+ int output;
+ PrivacyDebugger.e(PRIVACY_TAG, "got error while trying to check permission. Going to apply default deny mode.", e);
+ if(PrivacySettings.CURRENT_DEFAULT_DENY_MODE != PrivacySettings.DEFAULT_DENY_REAL) {
+ pSetMan.notification("UNKNOWN", 0, PrivacySettings.ERROR, PrivacySettings.DATA_CAMERA, null, null);
+ output = IS_NOT_ALLOWED;
+ } else {
+ pSetMan.notification("UNKNOWN", 0, PrivacySettings.ERROR, PrivacySettings.DATA_CAMERA, null, null);
+ output = IS_ALLOWED;
+ }
+ return output;
+ }
+ }
+
+
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
/**
* Broadcast Action: A new picture is taken by the camera, and the entry of
* the picture has been added to the media store.
@@ -328,6 +501,14 @@ public class Camera {
mPostviewCallback = null;
mZoomListener = null;
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+
+ initiate();
+
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
Looper looper;
if ((looper = Looper.myLooper()) != null) {
mEventHandler = new EventHandler(this, looper);
@@ -750,6 +931,18 @@ public class Camera {
@Override
public void handleMessage(Message msg) {
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+
+ boolean access = true;
+ if(!privacyMode){
+ initiate();
+ }
+ if(checkIfPackagesAllowed() == IS_NOT_ALLOWED){
+ access = false;
+ }
+
+
switch(msg.what) {
case CAMERA_MSG_SHUTTER:
if (mShutterCallback != null) {
@@ -759,13 +952,19 @@ public class Camera {
case CAMERA_MSG_RAW_IMAGE:
if (mRawImageCallback != null) {
- mRawImageCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ if(access)
+ mRawImageCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ else
+ mRawImageCallback.onPictureTaken(null, mCamera);//this normally doesn't get a call, because we disabled this receiver in takepicture method!
}
return;
case CAMERA_MSG_COMPRESSED_IMAGE:
if (mJpegCallback != null) {
- mJpegCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ if(access)
+ mJpegCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ else
+ mJpegCallback.onPictureTaken(getFakeImage(), mCamera);
}
return;
@@ -783,13 +982,19 @@ public class Camera {
// Set to oneshot mode again.
setHasPreviewCallback(true, false);
}
- pCb.onPreviewFrame((byte[])msg.obj, mCamera);
+ if(access)
+ pCb.onPreviewFrame((byte[])msg.obj, mCamera);//leave the camera the preview frame!
+ else
+ pCb.onPreviewFrame(getFakeImage(), mCamera);
}
return;
case CAMERA_MSG_POSTVIEW_FRAME:
if (mPostviewCallback != null) {
- mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ if(access)
+ mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ else
+ mPostviewCallback.onPictureTaken(getFakeImage(), mCamera);
}
return;
@@ -834,6 +1039,8 @@ public class Camera {
return;
}
}
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
private static void postEventFromNative(Object camera_ref,
@@ -1077,6 +1284,21 @@ public class Camera {
mPostviewCallback = postview;
mJpegCallback = jpeg;
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+ //check if we are in privacy mode!, this is a to hard method to prevent from making pictures, because camera will freeze!
+ if(!privacyMode){
+ initiate();
+ }
+ if(checkIfPackagesAllowed() == IS_NOT_ALLOWED){
+ mRawImageCallback = null;
+ PrivacyDebugger.i(PRIVACY_TAG,"blocked rawImageCallback -> it will never be called!");
+ }
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
// If callback is not set, do not send me callbacks.
int msgType = 0;
if (mShutterCallback != null) {
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/ConnectivityManager.java pang/frameworks/base/core/java/android/net/ConnectivityManager.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/ConnectivityManager.java 2013-04-02 21:48:00.429500900 +0545
+++ pang/frameworks/base/core/java/android/net/ConnectivityManager.java 2013-01-16 01:18:39.764737978 +0545
@@ -338,6 +338,7 @@ public class ConnectivityManager {
*/
public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000;
+//added static to the mService
private final IConnectivityManager mService;
public static boolean isNetworkTypeValid(int networkType) {
@@ -653,9 +654,8 @@ public class ConnectivityManager {
}
}
- /**
- * {@hide}
- */
+
+ //hide entfernt!
public ConnectivityManager(IConnectivityManager service) {
mService = checkNotNull(service, "missing IConnectivityManager");
}
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/NetworkInfo.java pang/frameworks/base/core/java/android/net/NetworkInfo.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/NetworkInfo.java 2013-04-02 21:48:00.433500850 +0545
+++ pang/frameworks/base/core/java/android/net/NetworkInfo.java 2013-01-16 01:18:39.768735928 +0545
@@ -165,6 +165,13 @@ public class NetworkInfo implements Parc
}
}
+ //------------------------------------------------------------------------------------------------
+ /**{@hide}* Used for set state to get better working Privacy*/
+ public void setState(State state){
+ this.mState = state;
+ }
+ //------------------------------------------------------------------------------------------------
+
/**
* Reports the type of network to which the
* info in this {@code NetworkInfo} pertains.
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/RouteInfo.java pang/frameworks/base/core/java/android/net/RouteInfo.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/net/RouteInfo.java 2013-04-02 21:48:00.433500850 +0545
+++ pang/frameworks/base/core/java/android/net/RouteInfo.java 2013-01-16 01:18:39.768735928 +0545
@@ -236,6 +236,7 @@ public class RouteInfo implements Parcel
* @param routes a Collection of RouteInfos to chose from
* @param dest the InetAddress your trying to get to
* @return the RouteInfo from the Collection that best fits the given address
+ * @hide
*/
public static RouteInfo selectBestRoute(Collection<RouteInfo> routes, InetAddress dest) {
if ((routes == null) || (dest == null)) return null;
diff -rupN '--exclude=.svn' '--exclude=.git*' '--exclude=*.java~' '--exclude=*.mk~' '--exclude=*.orig~' '--exclude=*.txt' '--exclude=*.orig' '--exclude=*.rej' '--exclude=*.latest' '--exclude=*.txt~' '--exclude=*.xml~' '--exclude=*xml.orig~' '--exclude=*.xml.orig' '--exclude=*.patch~' '--exclude=*.patch' '--exclude=*.diff~' '--exclude=*.diff~' '--exclude=*.aidl~' '--exclude=*.xml~' '--exclude=*.latest' '--exclude=*.latest~' '--exclude=*~' /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/os/SystemProperties.java pang/frameworks/base/core/java/android/os/SystemProperties.java
--- /media/ROM-Speicher/CM10.1/frameworks/base/core/java/android/os/SystemProperties.java 2013-04-02 21:48:00.449500649 +0545
+++ pang/frameworks/base/core/java/android/os/SystemProperties.java 2013-02-08 19:58:32.154004827 +0545
@@ -21,6 +21,23 @@ import java.util.ArrayList;
import android.util.Log;
+//-----------------------------------------------------------
+import com.android.internal.telephony.TelephonyProperties;
+
+import android.os.Process;
+import android.os.ServiceManager;
+
+import android.privacy.IPrivacySettingsManager;
+import android.privacy.PrivacySettings;
+import android.privacy.PrivacySettingsManager;
+import android.privacy.utilities.PrivacyDebugger;
+
+import android.content.Context;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+import android.os.Binder;
+//----------------------------------------------------------
+
/**
* Gives access to the system properties store. The system properties
@@ -45,6 +62,128 @@ public class SystemProperties
private static native void native_set(String key, String def);
private static native void native_add_change_callback();
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+
+ private static final int IS_ALLOWED = -1;
+ private static final int IS_NOT_ALLOWED = -2;
+ private static final int GOT_ERROR = -3;
+
+ private static final String PRIVACY_TAG = "SystemProperties";
+ private static Context context;
+
+ private static PrivacySettingsManager pSetMan;
+
+ private static boolean privacyMode = false;
+
+ private static IPackageManager mPm;
+
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+ /**
+ * {@hide}
+ * @return package names of current process which is using this object or null if something went wrong
+ */
+ private static String[] getPackageName(){
+ try{
+ if(mPm != null){
+ int uid = Process.myUid();
+ String[] package_names = mPm.getPackagesForUid(uid);
+ return package_names;