-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Currently, a new proxy class is created that inherits the class that is supposed to be protected:
- PrivacyCDMALTEPhone
- PrivacyCDMAPhone
- PrivacyGSMPhone
- PrivacySipPhone
In these classes, you unconditionally ask PDroid for sanitizing the ID. Read on why this is a bad idea.
The TelephonyManager methods for retrieving things like IMEI call methods on an implementation of the IPhoneSubInfo interface that is retrieved from the iphonesubinfo service.
This is actually a PhoneSubInfoProxy, methods like getDeviceId are called on a PhoneSubInfo instance that was passed through the constructor (or changed with setmPhoneSubInfo as done in PhoneProxy).
I see no point in replacing PhoneProxy instantiations by PrivacyPhoneProxy in PhoneFactory.java as permissions are not checked in the proxy class. They are checked in PhoneSubInfo, where you can see methods like:
/**
* Retrieves the unique device ID, e.g., IMEI for GSM phones and MEID for CDMA phones.
*/
public String getDeviceId() {
mContext.enforceCallingOrSelfPermission(READ_PHONE_STATE, "Requires READ_PHONE_STATE");
return mPhone.getDeviceId();
}With the current patches, mPhone is the Privacy...Phone instance. Well, why not avoid duplicate code and insert all code in these functions? Those other classes are internal anyway. Also, please keep DRY in mind.
Once the git/review infrastructure is ready, I can send in some patches that simplifies this and makes it less repeating.