-
Notifications
You must be signed in to change notification settings - Fork 30
/
openpdroid_4.3_frameworks_base.patch
9114 lines (9006 loc) · 392 KB
/
openpdroid_4.3_frameworks_base.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 --git a/Android.mk b/Android.mk
index 151621c..d395346 100644
--- a/Android.mk
+++ b/Android.mk
--- a/Android.mk
+++ b/Android.mk
@@ -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 \
@@ -236,6 +237,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/msim/IPhoneSubInfoMSim.aidl \
@@ -262,6 +264,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
@@ -301,6 +304,7 @@ framework_built := $(call java-lib-deps,framework)
# 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 \
@@ -353,6 +357,7 @@ aidl_files := \
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 \
+ frameworks/base/privacy/java/android/privacy/PrivacySettings.aidl \
frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
frameworks/base/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
frameworks/base/telephony/java/com/android/internal/telephony/msim/IPhoneSubInfoMSim.aidl \
diff --git a/api/current.txt b/api/current.txt
index 02b95a0..9f81110 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -21633,6 +21633,7 @@ package android.telephony {
public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable {
method public android.telephony.CellIdentityGsm getCellIdentity();
method public android.telephony.CellSignalStrengthGsm getCellSignalStrength();
+ method public void setCellIdentity(android.telephony.CellIdentityGsm);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 3fc82fa..b7a58e7 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -59,7 +59,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;
@@ -109,6 +109,16 @@ import android.app.admin.DevicePolicyManager;
import com.android.internal.app.IAppOpsService;
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;
@@ -177,6 +187,9 @@ class ContextImpl extends Context {
private Resources mResources;
/*package*/ ActivityThread mMainThread;
private Context mOuterContext;
+ // BEGIN privacy-added
+ private static Context sOuterContext = null;
+ // END privacy-added
private IBinder mActivityToken = null;
private ApplicationContentResolver mContentResolver;
private int mThemeResource = 0;
@@ -292,7 +305,11 @@ 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);
+ // BEGIN privacy-modified
+ Log.d(TAG, "PDroid:ContextImpl: returning PrivacyAccountManager rather than AccountManager");
+ //return new AccountManager(ctx, service);
+ return new PrivacyAccountManager(ctx, service);
+ // END privacy-modified
}});
registerService(ACTIVITY_SERVICE, new ServiceFetcher() {
@@ -331,7 +348,14 @@ 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-modified
+ // SM: Having a 'static outer context' may be problematic if
+ // there is more than one instance of this class, ever.
+ Log.d(TAG, "PDroid:ContextImpl: returning PrivacyConnectivityManager");
+ //return new ConnectivityManager(IConnectivityManager.Stub.asInterface(b));
+ IConnectivityManager service = IConnectivityManager.Stub.asInterface(b);
+ return new PrivacyConnectivityManager(service, getStaticOuterContext());
+ // END privacy-modified
}});
registerService(COUNTRY_DETECTOR, new StaticServiceFetcher() {
@@ -397,8 +421,16 @@ 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);
+
+ // BEGIN privacy-modified
+ //return new LocationManager(ctx, ILocationManager.Stub.asInterface(b));
+ Log.d(TAG, "PDroid:ContextImpl: returning PrivacyLocationManager");
+ // SM: I'm not sure whyt this is using getStaticOuterContext rather than getOuterContext.
+ // Would have thought it should have been the following line:
+ // return new PrivacyLocationManager(ILocationManager.Stub.asInterface(b), ctx.getOuterContext());
+ return new PrivacyLocationManager(ILocationManager.Stub.asInterface(b), getStaticOuterContext());
+ // END privacy-modified
}});
registerService(NETWORK_POLICY_SERVICE, new ServiceFetcher() {
@@ -471,7 +503,11 @@ class ContextImpl extends Context {
registerService(TELEPHONY_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
- return new TelephonyManager(ctx.getOuterContext());
+ // BEGIN privacy-modified
+ //return new TelephonyManager(ctx.getOuterContext());
+ Log.d(TAG, "PDroid:ContextImpl: returning PrivacyTelephonyManager");
+ return new PrivacyTelephonyManager(ctx.getOuterContext());
+ // END privacy-modified
}});
registerService(UI_MODE_SERVICE, new ServiceFetcher() {
@@ -502,7 +538,11 @@ 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-modified
+ //return new WifiManager(ctx.getOuterContext(), service);
+ Log.d(TAG, "PDroid:ContextImpl: returning PrivacyWifiManager");
+ return new PrivacyWifiManager(ctx.getOuterContext(), service);
+ // END privacy-modified
}});
registerService(WIFI_P2P_SERVICE, new ServiceFetcher() {
@@ -512,6 +552,16 @@ class ContextImpl extends Context {
return new WifiP2pManager(service);
}});
+ // BEGIN privacy-added
+ registerService("privacy", new StaticServiceFetcher() {
+ public Object createStaticService() {
+ Log.d(TAG, "PDroid:ContextImpl: Creating static privacy service");
+ IBinder b = ServiceManager.getService("privacy");
+ IPrivacySettingsManager service = IPrivacySettingsManager.Stub.asInterface(b);
+ return new PrivacySettingsManager(getStaticOuterContext(), service);
+ }});
+ // END privacy-added
+
registerService(WINDOW_SERVICE, new ServiceFetcher() {
public Object getService(ContextImpl ctx) {
Display display = ctx.mDisplay;
@@ -1868,7 +1918,10 @@ class ContextImpl extends Context {
}
ContextImpl() {
- mOuterContext = this;
+ if (sOuterContext != null) {
+ Log.w(TAG, "PDroid:ContextImpl: ContextImpl being created but already has sOuterContext");
+ }
+ sOuterContext = mOuterContext = this;
}
/**
@@ -1885,7 +1938,12 @@ class ContextImpl extends Context {
mContentResolver = context.mContentResolver;
mUser = context.mUser;
mDisplay = context.mDisplay;
- mOuterContext = this;
+
+ if (sOuterContext != null) {
+ Log.w(TAG, "PDroid:ContextImpl: ContextImpl being created but already has sOuterContext");
+ }
+
+ sOuterContext = mOuterContext = this;
}
final void init(LoadedApk packageInfo, IBinder activityToken, ActivityThread mainThread) {
@@ -1941,13 +1999,21 @@ class ContextImpl extends Context {
}
final void setOuterContext(Context context) {
- mOuterContext = context;
+ if (sOuterContext != null) {
+ Log.w(TAG, "PDroid:ContextImpl: ContextImpl being created but already has sOuterContext");
+ }
+
+ sOuterContext = mOuterContext = context;
}
final Context getOuterContext() {
return mOuterContext;
}
+ final static Context getStaticOuterContext() {
+ return sOuterContext;
+ }
+
final IBinder getActivityToken() {
return mActivityToken;
}
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index a307a73..98548fb 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -16,6 +16,13 @@
package android.app;
+// BEGIN privacy additions
+import android.privacy.IPrivacySettingsManager;
+import android.privacy.PrivacySettings;
+import android.privacy.PrivacySettingsManager;
+import android.telephony.TelephonyManager;
+// End privacy
+
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
@@ -92,6 +99,10 @@ public class Instrumentation {
private Bundle mPerfMetrics = new Bundle();
private UiAutomation mUiAutomation;
+ // BEGIN privacy added
+ private PrivacySettingsManager mPrvSvc;
+ // END privacy
+
public Instrumentation() {
}
@@ -1398,6 +1409,79 @@ public class Instrumentation {
Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+
+ // BEGIN privacy-added
+ boolean allowIntent = true;
+ try{
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: execStartActivity for " + who.getPackageName());
+ if (intent.getAction() != null && (intent.getAction().equals(Intent.ACTION_CALL) || intent.getAction().equals(Intent.ACTION_DIAL))){
+ allowIntent = false;
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Intent action = Intent.ACTION_CALL or Intent.ACTION_DIAL for " + who.getPackageName());
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ mPrvSvc = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ if (mPrvSvc != null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Obtained privacy service");
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Privacy service not obtained");
+ }
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Already had privacy service");
+ }
+
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Privacy service not available: rejecting call attempt");
+ allowIntent = false;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ PrivacySettings privacySettings = mPrvSvc.getSettings(who.getPackageName());
+ if (privacySettings == null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Call allowed: No settings for package: " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null);
+ } else if (privacySettings.getPhoneCallSetting() == PrivacySettings.REAL) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Call allowed: Settings permit " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity: Call denied: Settings deny " + who.getPackageName());
+ // No settings = allowed; any phone call setting but real == disallowed
+
+ allowIntent = false;
+
+ // test if broadcasting works! SM: I don't know what 'test if broadcasting works' means.
+ // Send the notification intent
+ final Context tmp = who;
+ // SM: the BLOCKED_PHONE_CALL intent is handled by the privacy service to fake a change in call state
+ new Thread(new Runnable() {
+ public void run() {
+ // SM: Not clear why there is this delay
+ 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);
+ Log.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ }
+ }
+ }
+ } catch(Exception e){
+ if(who != null) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity: Exception occurred handling intent for " + who.getPackageName(), e);
+ } else {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity: Exception occurred handling intent for unknown package", e);
+ }
+ }
+ // END privacy-added
+
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1413,6 +1497,16 @@ public class Instrumentation {
}
}
}
+
+ // BEGIN privacy-added
+ try{
+ if (!allowIntent) return new ActivityResult(requestCode, intent);
+ } catch(Exception e) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity: Exception occurred while trying to create ActivityResult", e);
+ return null;
+ }
+ // END privacy-added
+
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess();
@@ -1453,6 +1547,109 @@ public class Instrumentation {
IBinder token, Activity target, Intent[] intents, Bundle options,
int userId) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+
+ // BEGIN privacy-added
+
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: execStartActivitiesAsUser for " + who.getPackageName());
+ if (intents != null) {
+ boolean checkPrivacySettings = false;
+
+ // If any intents are Intent.ACTION_CALL or Intent.ACTION_DIAL, need to check permissions
+ for (Intent intent : intents) {
+ try {
+ if (intent.getAction() != null && (
+ intent.getAction().equals(Intent.ACTION_CALL) ||
+ intent.getAction().equals(Intent.ACTION_DIAL))) {
+ checkPrivacySettings = true;
+ break;
+ }
+ } catch (Exception e) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Exception occurred when checking intents for " + who.getPackageName(), e);
+ // If an exception occurred, then check the privacy settings as the default action
+ checkPrivacySettings = true;
+ }
+ }
+
+ if (!checkPrivacySettings) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: No provided intents triggered checking for " + who.getPackageName());
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: One or more intents triggered checking for " + who.getPackageName());
+
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ mPrvSvc = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ if (mPrvSvc != null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Obtained privacy service");
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Privacy service not obtained");
+ }
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Already had privacy service");
+ }
+
+ boolean allowCallIntents = false;
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Privacy service not available - assuming permission denied");
+ allowCallIntents = false;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ PrivacySettings privacySettings = mPrvSvc.getSettings(who.getPackageName());
+ if (privacySettings == null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Call intents allowed: No settings for package: " + who.getPackageName());
+ allowCallIntents = true;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null);
+ } else if (privacySettings.getPhoneCallSetting() == PrivacySettings.REAL) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Call intents allowed: Settings permit " + who.getPackageName());
+ allowCallIntents = true;
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Call intents denied: Settings deny " + who.getPackageName());
+ allowCallIntents = false;
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ }
+ }
+
+ // If call intents are not allowed, need to regenerate the
+ // intents list to remove call-related intents
+ if (!allowCallIntents) {
+ List<Intent> filteredIntents = new ArrayList<Intent>(intents.length);
+ for (Intent intent : intents) {
+ try {
+ if (intent.getAction() == null || !(
+ intent.getAction().equals(Intent.ACTION_CALL) ||
+ intent.getAction().equals(Intent.ACTION_DIAL))) {
+ filteredIntents.add(intent);
+ }
+ } catch (Exception e) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivitiesAsUser: Exception occurred when checking intent for " + who.getPackageName(), e);
+ }
+ }
+ intents = filteredIntents.toArray(new Intent [filteredIntents.size()]);
+
+ // Send the notification intent
+ final Context tmp = who;
+ // SM: the BLOCKED_PHONE_CALL intent is handled by the privacy service to fake a change in call state
+ new Thread(new Runnable() {
+ public void run() {
+ // SM: Not clear why there is this delay
+ 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);
+ Log.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ }
+ }
+ }
+ // END privacy-added
+
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1515,6 +1712,77 @@ public class Instrumentation {
Context who, IBinder contextThread, IBinder token, Fragment target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+ // BEGIN privacy-added
+ boolean allowIntent = true;
+ try{
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): execStartActivity for " + who.getPackageName());
+ if (intent.getAction() != null && (intent.getAction().equals(Intent.ACTION_CALL) || intent.getAction().equals(Intent.ACTION_DIAL))){
+ allowIntent = false;
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Intent action = Intent.ACTION_CALL or Intent.ACTION_DIAL for " + who.getPackageName());
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ mPrvSvc = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ if (mPrvSvc != null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Obtained privacy service");
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Privacy service not obtained");
+ }
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Already had privacy service");
+ }
+
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Privacy service not available: rejecting call attempt");
+ allowIntent = false;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ PrivacySettings privacySettings = mPrvSvc.getSettings(who.getPackageName());
+ if (privacySettings == null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Call allowed: No settings for package: " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null);
+ } else if (privacySettings.getPhoneCallSetting() == PrivacySettings.REAL) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Call allowed: Settings permit " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Call denied: Settings deny " + who.getPackageName());
+ // No settings = allowed; any phone call setting but real == disallowed
+
+ // test if broadcasting works! SM: I don't know what 'test if broadcasting works' means.
+ // Send the notification intent
+ final Context tmp = who;
+ allowIntent = false;
+ // SM: Why is all of this done? It seems like a weirdly unnecessary bit of code...
+ new Thread(new Runnable() {
+ public void run() {
+ // SM: Not clear why there is this delay
+ 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);
+ Log.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ }
+ }
+ }
+ } catch(Exception e){
+ if(who != null) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Exception occurred handling intent for " + who.getPackageName(), e);
+ } else {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Exception occurred handling intent for unknown package", e);
+ }
+ }
+ // END privacy-added
+
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1530,6 +1798,16 @@ public class Instrumentation {
}
}
}
+
+ // BEGIN privacy-added
+ try{
+ if (!allowIntent) return new ActivityResult(requestCode, intent);
+ } catch(Exception e) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with Fragments): Exception occurred while trying to create ActivityResult", e);
+ return null;
+ }
+ // END privacy-added
+
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess();
@@ -1575,6 +1853,78 @@ public class Instrumentation {
Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options, UserHandle user) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
+
+ // BEGIN privacy-added
+ boolean allowIntent = true;
+ try{
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): execStartActivity for " + who.getPackageName());
+ if (intent.getAction() != null && (intent.getAction().equals(Intent.ACTION_CALL) || intent.getAction().equals(Intent.ACTION_DIAL))){
+ allowIntent = false;
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Intent action = Intent.ACTION_CALL or Intent.ACTION_DIAL for " + who.getPackageName());
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ mPrvSvc = new PrivacySettingsManager(who, IPrivacySettingsManager.Stub.asInterface(ServiceManager.getService("privacy")));
+ if (mPrvSvc != null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Obtained privacy service");
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Privacy service not obtained");
+ }
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Already had privacy service");
+ }
+
+ if (mPrvSvc == null || !mPrvSvc.isServiceAvailable()) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Privacy service not available: rejecting call attempt");
+ allowIntent = false;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.EMPTY, PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ PrivacySettings privacySettings = mPrvSvc.getSettings(who.getPackageName());
+ if (privacySettings == null) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Call allowed: No settings for package: " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), PrivacySettings.REAL, PrivacySettings.DATA_PHONE_CALL, null);
+ } else if (privacySettings.getPhoneCallSetting() == PrivacySettings.REAL) {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Call allowed: Settings permit " + who.getPackageName());
+ allowIntent = true;
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ } else {
+ Log.d(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Call denied: Settings deny " + who.getPackageName());
+ // No settings = allowed; any phone call setting but real == disallowed
+
+ // test if broadcasting works! SM: I don't know what 'test if broadcasting works' means.
+ // Send the notification intent
+ final Context tmp = who;
+ allowIntent = false;
+ // SM: Why is all of this done? It seems like a weirdly unnecessary bit of code...
+ new Thread(new Runnable() {
+ public void run() {
+ // SM: Not clear why there is this delay
+ 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);
+ Log.i("PrivacyContext","sent privacy intent");
+ }
+ }).start();
+ mPrvSvc.notification(who.getPackageName(), privacySettings.getPhoneCallSetting(), PrivacySettings.DATA_PHONE_CALL, null);
+ }
+ }
+ }
+ } catch(Exception e){
+ if(who != null) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Exception occurred handling intent for " + who.getPackageName(), e);
+ } else {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Exception occurred handling intent for unknown package", e);
+ }
+ }
+ // END privacy-added
+
if (mActivityMonitors != null) {
synchronized (mSync) {
final int N = mActivityMonitors.size();
@@ -1590,6 +1940,16 @@ public class Instrumentation {
}
}
}
+
+ // BEGIN privacy-added
+ try{
+ if (!allowIntent) return new ActivityResult(requestCode, intent);
+ } catch(Exception e) {
+ Log.e(TAG,"PDroid:Instrumentation:execStartActivity (with UserHandle): Exception occurred while trying to create ActivityResult", e);
+ return null;
+ }
+ // END privacy-added
+
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess();
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index fefd343..71aca4b 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -45,6 +45,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;
@@ -413,6 +417,10 @@ public abstract class ContentResolver {
try {
qCursor = unstableProvider.query(mPackageName, uri, projection,
selection, selectionArgs, sortOrder, remoteCancellationSignal);
+ // BEGIN privacy-added
+ // Log.d(TAG, "PDroid:ContentResolver:wrapping content resolver in PrivacyContentResolver");
+ 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!!!!
@@ -424,6 +432,11 @@ public abstract class ContentResolver {
}
qCursor = stableProvider.query(mPackageName, uri, projection,
selection, selectionArgs, sortOrder, remoteCancellationSignal);
+ // BEGIN privacy-added
+ // Log.d(TAG, "PDroid:ContentResolver:wrapping content resolver in PrivacyContentResolver");
+ qCursor = PrivacyContentResolver.enforcePrivacyPermission(uri, projection, mContext, qCursor);
+ // END privacy-added
+
}
if (qCursor == null) {
return null;
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 4e51080..91815ba 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -43,6 +43,26 @@ 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.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
@@ -163,6 +183,157 @@ 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();
+ Log.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){
+ Log.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();
+ Log.e(PRIVACY_TAG, "Something went wrong with initalize variables");
+ privacyMode = false;
+ }
+ }
+
+ /**
+ * {@hide}
+ * This method should be used, because in some devices the uid has more than one package within!
+ * @return IS_ALLOWED (-1) if all packages allowed, IS_NOT_ALLOWED(-2) if one of these packages not allowed, GOT_ERROR (-3) if something went wrong
+ */
+ private int checkIfPackagesAllowed(){
+ try{
+ //boolean isAllowed = false;
+ if(pSetMan != null){
+ PrivacySettings pSet = null;
+ String[] package_names = getPackageName();
+ int uid = Process.myUid();
+ if(package_names != null){
+
+ for(int i=0;i < package_names.length; i++){
+ pSet = pSetMan.getSettings(package_names[i], uid);
+ if(pSet != null && (pSet.getCameraSetting() != PrivacySettings.REAL)){ //if pSet is null, we allow application to access to mic
+ return IS_NOT_ALLOWED;
+ }
+ pSet = null;
+ }
+ return IS_ALLOWED;
+ }
+ else{
+ Log.e(PRIVACY_TAG,"return GOT_ERROR, because package_names are NULL");
+ return GOT_ERROR;
+ }
+ }
+ else{
+ Log.e(PRIVACY_TAG,"return GOT_ERROR, because pSetMan is NULL");
+ return GOT_ERROR;
+ }
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ Log.e(PRIVACY_TAG,"Got exception in checkIfPackagesAllowed");
+ return GOT_ERROR;
+ }
+ }
+
+ /**
+ * Loghelper method, true = access successful, false = blocked access
+ * {@hide}
+ */
+ private void dataAccess(boolean success){
+ String package_names[] = getPackageName();
+ if(success && package_names != null){
+ for(int i=0;i<package_names.length;i++)
+ Log.i(PRIVACY_TAG,"Allowed Package: -" + package_names[i] + "- accessing camera.");
+ }
+ else if(package_names != null){
+ for(int i=0;i<package_names.length;i++)
+ Log.i(PRIVACY_TAG,"Blocked Package: -" + package_names[i] + "- accessing camera.");
+ }
+ }
+ //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.
@@ -329,6 +500,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);
@@ -755,6 +934,27 @@ public class Camera {
@Override
public void handleMessage(Message msg) {
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //BEGIN PRIVACY
+
+ boolean access = true;
+ if(!privacyMode){
+ initiate();
+ }
+ String packageName[] = getPackageName();
+ if(checkIfPackagesAllowed() == IS_NOT_ALLOWED){
+ access = false;
+ dataAccess(false);
+ if(packageName != null)
+ pSetMan.notification(packageName[0], 0, PrivacySettings.EMPTY, PrivacySettings.DATA_CAMERA, null, pSetMan.getSettings(packageName[0], Process.myUid()));
+ }
+ else{
+ dataAccess(true);
+ if(packageName != null)
+ pSetMan.notification(packageName[0], 0, PrivacySettings.REAL, PrivacySettings.DATA_CAMERA, null, pSetMan.getSettings(packageName[0], Process.myUid()));
+ }
+
+
switch(msg.what) {
case CAMERA_MSG_SHUTTER:
if (mShutterCallback != null) {
@@ -764,13 +964,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;
@@ -788,13 +994,21 @@ public class Camera {
// Set to oneshot mode again.
setHasPreviewCallback(true, false);
}
- pCb.onPreviewFrame((byte[])msg.obj, mCamera);
+ //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);//here we go testing if it is able to give preview of fake image, if it doesn't work -> pass null
}
return;
case CAMERA_MSG_POSTVIEW_FRAME:
if (mPostviewCallback != null) {
- mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ //mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ if(access)
+ mPostviewCallback.onPictureTaken((byte[])msg.obj, mCamera);
+ else
+ mPostviewCallback.onPictureTaken(getFakeImage(), mCamera);//same as in onpreviewframe -> give test fake image
}
return;
@@ -839,6 +1053,8 @@ public class Camera {
return;
}
}
+ //END PRIVACY
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
private static void postEventFromNative(Object camera_ref,
@@ -1082,6 +1298,28 @@ 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){