Skip to content

Commit e0a07f9

Browse files
Jawnnypoorogerhu
authored andcommitted
Remove obsolete code
1 parent cc6b62b commit e0a07f9

File tree

3 files changed

+0
-252
lines changed

3 files changed

+0
-252
lines changed

Parse/src/main/java/com/parse/ManifestInfo.java

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,10 @@ public class ManifestInfo {
3535
private static final String TAG = "com.parse.ManifestInfo";
3636

3737
private static final Object lock = new Object();
38-
private static long lastModified = -1;
3938
/* package */ static int versionCode = -1;
4039
/* package */ static String versionName = null;
4140
private static int iconId = 0;
4241
private static String displayName = null;
43-
44-
/**
45-
* Returns the last time this application's APK was modified on disk. This is a proxy for both
46-
* version changes and if the APK has been restored from backup onto a different device.
47-
*/
48-
public static long getLastModified() {
49-
synchronized (lock) {
50-
if (lastModified == -1) {
51-
File apkPath = new File(getContext().getApplicationInfo().sourceDir);
52-
lastModified = apkPath.lastModified();
53-
}
54-
}
55-
56-
return lastModified;
57-
}
5842

5943
/**
6044
* Returns the version code for this app, as specified by the android:versionCode attribute in the
@@ -151,15 +135,6 @@ public static int getIconId() {
151135
}
152136
return list;
153137
}
154-
155-
/*
156-
* Returns a message that can be written to the system log if an app expects push to be enabled,
157-
* but push isn't actually enabled because the manifest is misconfigured.
158-
*/
159-
static String getPushDisabledMessage() {
160-
return "Push is not configured for this app";
161-
}
162-
163138

164139
private static Context getContext() {
165140
return Parse.getApplicationContext();
@@ -187,114 +162,4 @@ public static Bundle getApplicationMetadata(Context context) {
187162
}
188163
return null;
189164
}
190-
191-
private static PackageInfo getPackageInfo(String name) {
192-
PackageInfo info = null;
193-
194-
try {
195-
info = getPackageManager().getPackageInfo(name, 0);
196-
} catch (NameNotFoundException e) {
197-
// do nothing
198-
}
199-
200-
return info;
201-
}
202-
203-
static ServiceInfo getServiceInfo(Class<? extends Service> clazz) {
204-
ServiceInfo info = null;
205-
try {
206-
info = getPackageManager().getServiceInfo(new ComponentName(getContext(), clazz), 0);
207-
} catch (NameNotFoundException e) {
208-
// do nothing
209-
}
210-
211-
return info;
212-
}
213-
214-
private static ActivityInfo getReceiverInfo(Class<? extends BroadcastReceiver> clazz) {
215-
ActivityInfo info = null;
216-
try {
217-
info = getPackageManager().getReceiverInfo(new ComponentName(getContext(), clazz), 0);
218-
} catch (NameNotFoundException e) {
219-
// do nothing
220-
}
221-
222-
return info;
223-
}
224-
225-
/**
226-
* Returns {@code true} if this package has requested all of the listed permissions.
227-
* <p />
228-
* <strong>Note:</strong> This package might have requested all the permissions, but may not
229-
* be granted all of them.
230-
*/
231-
public static boolean hasRequestedPermissions(Context context, String... permissions) {
232-
String packageName = context.getPackageName();
233-
try {
234-
PackageInfo pi = context.getPackageManager().getPackageInfo(
235-
packageName, PackageManager.GET_PERMISSIONS);
236-
if (pi.requestedPermissions == null) {
237-
return false;
238-
}
239-
return Arrays.asList(pi.requestedPermissions).containsAll(Arrays.asList(permissions));
240-
} catch (NameNotFoundException e) {
241-
PLog.e(TAG, "Couldn't find info about own package", e);
242-
return false;
243-
}
244-
}
245-
246-
/**
247-
* Returns {@code true} if this package has been granted all of the listed permissions.
248-
* <p />
249-
* <strong>Note:</strong> This package might have requested all the permissions, but may not
250-
* be granted all of them.
251-
*/
252-
public static boolean hasGrantedPermissions(Context context, String... permissions) {
253-
String packageName = context.getPackageName();
254-
PackageManager packageManager = context.getPackageManager();
255-
for (String permission : permissions) {
256-
if (packageManager.checkPermission(permission, packageName) != PackageManager.PERMISSION_GRANTED) {
257-
return false;
258-
}
259-
}
260-
261-
return true;
262-
}
263-
264-
private static boolean checkResolveInfo(Class<? extends BroadcastReceiver> clazz, List<ResolveInfo> infoList, String permission) {
265-
for (ResolveInfo info : infoList) {
266-
if (info.activityInfo != null) {
267-
final Class resolveInfoClass;
268-
try {
269-
resolveInfoClass = Class.forName(info.activityInfo.name);
270-
} catch (ClassNotFoundException e) {
271-
break;
272-
}
273-
if (clazz.isAssignableFrom(resolveInfoClass) && (permission == null || permission.equals(info.activityInfo.permission))) {
274-
return true;
275-
}
276-
}
277-
}
278-
279-
return false;
280-
}
281-
282-
public static boolean checkReceiver(Class<? extends BroadcastReceiver> clazz, String permission, Intent[] intents) {
283-
for (Intent intent : intents) {
284-
List<ResolveInfo> receivers = getPackageManager().queryBroadcastReceivers(intent, 0);
285-
if (receivers.isEmpty()) {
286-
return false;
287-
}
288-
289-
if (!checkResolveInfo(clazz, receivers, permission)) {
290-
return false;
291-
}
292-
}
293-
294-
return true;
295-
}
296-
297-
public static boolean isGooglePlayServicesAvailable() {
298-
return getPackageInfo("com.google.android.gsf") != null;
299-
}
300165
}

Parse/src/main/java/com/parse/ParsePushChannelsController.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
import bolts.Task;
1616

1717
/** package */ class ParsePushChannelsController {
18-
private static final String TAG = "com.parse.ParsePushChannelsController";
1918

2019
private static ParseCurrentInstallationController getCurrentInstallationController() {
2120
return ParseCorePlugins.getInstance().getCurrentInstallationController();
2221
}
2322

2423
public Task<Void> subscribeInBackground(final String channel) {
25-
checkManifestAndLogErrorIfNecessary();
2624
if (channel == null) {
2725
throw new IllegalArgumentException("Can't subscribe to null channel.");
2826
}
@@ -44,7 +42,6 @@ public Task<Void> then(Task<ParseInstallation> task) throws Exception {
4442
}
4543

4644
public Task<Void> unsubscribeInBackground(final String channel) {
47-
checkManifestAndLogErrorIfNecessary();
4845
if (channel == null) {
4946
throw new IllegalArgumentException("Can't unsubscribe from null channel.");
5047
}
@@ -63,13 +60,4 @@ public Task<Void> then(Task<ParseInstallation> task) throws Exception {
6360
}
6461
});
6562
}
66-
67-
private static boolean loggedManifestError = false;
68-
private static void checkManifestAndLogErrorIfNecessary() {
69-
if (!loggedManifestError && ManifestInfo.getPushType() == PushType.NONE) {
70-
loggedManifestError = true;
71-
PLog.e(TAG, "Tried to subscribe or unsubscribe from a channel, but push is not enabled " +
72-
"correctly. " + ManifestInfo.getPushDisabledMessage());
73-
}
74-
}
7563
}

Parse/src/test/java/com/parse/PushServiceTest.java

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)