Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed res/drawable-ldpi/icon.png
Binary file not shown.
Binary file removed res/drawable-mdpi/icon.png
Binary file not shown.
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<resources>
<string name="hello">Hello World!</string>
<string name="app_name">AndroidCommon</string>
<string name="no_superuser_perms">su rights required to access alarms are not available / were not granted</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.asksven.andoid.common;
package com.asksven.android.common;

/**
* @author sven
*
*/
public class CommonLogSettings
{
public static final String LOGGING_TAG = "AndoidCommon";
public static boolean DEBUG = false;
public static boolean TRACE = false;
public class CommonLogSettings {
public static final String LOGGING_TAG = "AndroidCommon";
public static boolean DEBUG = false;
public static boolean TRACE = false;

}
Original file line number Diff line number Diff line change
@@ -1,68 +1,37 @@
/*******************************************************************************
* Copyright (c) 2011 Adam Shanks (ChainsDD)
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.asksven.andoid.common.contrib;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
package com.asksven.android.common.contrib;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.util.Log;
import android.util.SparseArray;

import java.io.*;
import java.util.ArrayList;


public class Util {
private static final String TAG = "Util";





public static ArrayList<String> run(String command) {
return run("/system/bin/sh", command);
}

public static ArrayList<String> run(String shell, String command) {
return run(shell, new String[] {
return run(shell, new String[]{
command
});
}
Expand Down Expand Up @@ -134,29 +103,29 @@ public static boolean writeStoreFile(Context context, int uid, int execUid, Stri
}
return true;
}

public static boolean writeDetaultStoreFile(Context context, String action) {
File storedDir = new File(context.getFilesDir().getAbsolutePath() + File.separator + "stored");
storedDir.mkdirs();
File defFile = new File(storedDir.getAbsolutePath() + File.separator + "default");
try {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(defFile.getAbsolutePath()));
if (action.equals("allow")) {
out.write("1");
} else if (action.equals("deny")) {
out.write("0");
} else {
out.write("-1");
}
out.flush();
out.close();
} catch (FileNotFoundException e) {
Log.w(TAG, "Default file not written", e);
return false;
} catch (IOException e) {
Log.w(TAG, "Default file not written", e);
return false;
}
return true;
File storedDir = new File(context.getFilesDir().getAbsolutePath() + File.separator + "stored");
storedDir.mkdirs();
File defFile = new File(storedDir.getAbsolutePath() + File.separator + "default");
try {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(defFile.getAbsolutePath()));
if (action.equals("allow")) {
out.write("1");
} else if (action.equals("deny")) {
out.write("0");
} else {
out.write("-1");
}
out.flush();
out.close();
} catch (FileNotFoundException e) {
Log.w(TAG, "Default file not written", e);
return false;
} catch (IOException e) {
Log.w(TAG, "Default file not written", e);
return false;
}
return true;
}
}
Loading