Skip to content

Commit

Permalink
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbradymobile committed Nov 13, 2013
2 parents c4a37bb + aaa4d9c commit 5f260d4
Show file tree
Hide file tree
Showing 21 changed files with 1,024 additions and 72 deletions.
4 changes: 2 additions & 2 deletions cmds/svc/src/com/android/commands/svc/WifiCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void run(String[] args) {
IWifiManager wifiMgr
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
try {
wifiMgr.setWifiEnabled(flag);
wifiMgr.setWifiEnabled("com.android.commands.svc", flag);
}
catch (RemoteException e) {
System.err.println("Wi-Fi operation failed: " + e);
Expand All @@ -75,4 +75,4 @@ public void run(String[] args) {
}
System.err.println(longHelp());
}
}
}
111 changes: 109 additions & 2 deletions core/java/android/app/AppOpsManager.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/*
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -59,6 +62,7 @@ public class AppOpsManager {
public static final int MODE_ALLOWED = 0;
public static final int MODE_IGNORED = 1;
public static final int MODE_ERRORED = 2;
public static final int MODE_ASK = 3;

// when adding one of these:
// - increment _NUM_OP
Expand Down Expand Up @@ -97,7 +101,55 @@ public class AppOpsManager {
public static final int OP_READ_CLIPBOARD = 29;
public static final int OP_WRITE_CLIPBOARD = 30;
/** @hide */
public static final int _NUM_OP = 31;
public static final int OP_WIFI_CHANGE = 31;
public static final int OP_BLUETOOTH_CHANGE = 32;
public static final int OP_DATA_CONNECT_CHANGE = 33;
public static final int OP_ALARM_WAKEUP = 34;
public static final int _NUM_OP = 35;

/**
* Map to check if each operation is strict or not, to determine default
* value of each operation.
* If strict then AppOpsService should assign MODE_ASK value to operation
* by default.
*/
private static boolean[] sOpStrict = new boolean[] {
true, //OP_COARSE_LOCATION
true, //OP_FINE_LOCATION
true, //OP_GPS
false, //OP_VIBRATE
true, //OP_READ_CONTACTS
true, //OP_WRITE_CONTACTS
true, //OP_READ_CALL_LOG
true, //OP_WRITE_CALL_LOG
false, //OP_READ_CALENDAR
false, //OP_WRITE_CALENDAR
true, //OP_WIFI_SCAN
false, //OP_POST_NOTIFICATION
false, //OP_NEIGHBORING_CELLS
true, //OP_CALL_PHONE
true, //OP_READ_SMS
true, //OP_WRITE_SMS
true, //OP_RECEIVE_SMS
false, //OP_RECEIVE_EMERGECY_SMS
true, //OP_RECEIVE_MMS
false, //OP_RECEIVE_WAP_PUSH
true, //OP_SEND_SMS
true, //OP_READ_ICC_SMS
true, //OP_WRITE_ICC_SMS
false, //OP_WRITE_SETTINGS
false, //OP_SYSTEM_ALERT_WINDOW
false, //OP_ACCESS_NOTIFICATIONS
true, //OP_CAMERA
true, //OP_RECORD_AUDIO
true, //OP_PLAY_AUDIO
false, //OP_READ_CLIPBOARD
false, //OP_WRITE_CLIPBOARD
true, //OP_WIFI_CHANGE
true, //OP_BLUETOOTH_CHANGE
true, //OP_DATA_CONNECT_CHANGE
false, //OP_ALARM_WAKEUP
};

/**
* This maps each operation to the operation that serves as the
Expand Down Expand Up @@ -139,6 +191,10 @@ public class AppOpsManager {
OP_PLAY_AUDIO,
OP_READ_CLIPBOARD,
OP_WRITE_CLIPBOARD,
OP_WIFI_CHANGE,
OP_BLUETOOTH_CHANGE,
OP_DATA_CONNECT_CHANGE,
OP_ALARM_WAKEUP,
};

/**
Expand Down Expand Up @@ -177,6 +233,10 @@ public class AppOpsManager {
"PLAY_AUDIO",
"READ_CLIPBOARD",
"WRITE_CLIPBOARD",
"WIFI_CHANGE",
"BLUETOOTH_CHANGE",
"DATA_CONNECT_CHANGE",
"ALARM_WAKEUP",
};

/**
Expand Down Expand Up @@ -215,8 +275,19 @@ public class AppOpsManager {
null, // no permission for playing audio
null, // no permission for reading clipboard
null, // no permission for writing clipboard
android.Manifest.permission.CHANGE_WIFI_STATE,
android.Manifest.permission.BLUETOOTH,
android.Manifest.permission.CHANGE_NETWORK_STATE,
null, // no permission for alarm wakeups
};

/**
* Check if given operation is strict or not.
*/
public static boolean opStrict(int op) {
return sOpStrict[op];
}

/**
* Retrieve the op switch that controls the given operation.
*/
Expand All @@ -232,6 +303,18 @@ public static String opToName(int op) {
return op < sOpNames.length ? sOpNames[op] : ("Unknown(" + op + ")");
}

/**
* Map a non-localized name for the operation back to the Op number
*/
public static int nameToOp(String name) {
for (int i = 0; i < sOpNames.length; i++) {
if (sOpNames[i].equals(name)) {
return i;
}
}
return OP_NONE;
}

/**
* Retrieve the permission associated with an operation, or null if there is not one.
*/
Expand Down Expand Up @@ -310,13 +393,18 @@ public static class OpEntry implements Parcelable {
private final long mTime;
private final long mRejectTime;
private final int mDuration;
private final int mAllowedCount;
private final int mIgnoredCount;

public OpEntry(int op, int mode, long time, long rejectTime, int duration) {
public OpEntry(int op, int mode, long time, long rejectTime, int duration,
int allowedCount, int ignoredCount) {
mOp = op;
mMode = mode;
mTime = time;
mRejectTime = rejectTime;
mDuration = duration;
mAllowedCount = allowedCount;
mIgnoredCount = ignoredCount;
}

public int getOp() {
Expand All @@ -343,6 +431,14 @@ public int getDuration() {
return mDuration == -1 ? (int)(System.currentTimeMillis()-mTime) : mDuration;
}

public int getAllowedCount() {
return mAllowedCount;
}

public int getIgnoredCount() {
return mIgnoredCount;
}

@Override
public int describeContents() {
return 0;
Expand All @@ -355,6 +451,8 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mTime);
dest.writeLong(mRejectTime);
dest.writeInt(mDuration);
dest.writeInt(mAllowedCount);
dest.writeInt(mIgnoredCount);
}

OpEntry(Parcel source) {
Expand All @@ -363,6 +461,8 @@ public void writeToParcel(Parcel dest, int flags) {
mTime = source.readLong();
mRejectTime = source.readLong();
mDuration = source.readInt();
mAllowedCount = source.readInt();
mIgnoredCount = source.readInt();
}

public static final Creator<OpEntry> CREATOR = new Creator<OpEntry>() {
Expand Down Expand Up @@ -555,4 +655,11 @@ public void setPrivacyGuardSettingForPackage(int uid, String packageName,
} catch (RemoteException e) {
}
}

public void resetCounters() {
try {
mService.resetCounters();
} catch (RemoteException e) {
}
}
}
3 changes: 2 additions & 1 deletion core/java/android/bluetooth/BluetoothAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.ActivityThread;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
Expand Down Expand Up @@ -518,7 +519,7 @@ public boolean enable() {
return true;
}
try {
return mManagerService.enable();
return mManagerService.enable(ActivityThread.currentPackageName());
} catch (RemoteException e) {Log.e(TAG, "", e);}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion core/java/android/bluetooth/IBluetoothManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface IBluetoothManager
void registerStateChangeCallback(in IBluetoothStateChangeCallback callback);
void unregisterStateChangeCallback(in IBluetoothStateChangeCallback callback);
boolean isEnabled();
boolean enable();
boolean enable(String callingPackage);
boolean enableNoAutoConnect();
boolean disable(boolean persist);
IBluetoothGatt getBluetoothGatt();
Expand Down
3 changes: 2 additions & 1 deletion core/java/android/net/ConnectivityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.ActivityThread;
import android.content.Context;
import android.os.Binder;
import android.os.Build.VERSION_CODES;
Expand Down Expand Up @@ -849,7 +850,7 @@ public boolean getMobileDataEnabled() {
*/
public void setMobileDataEnabled(boolean enabled) {
try {
mService.setMobileDataEnabled(enabled);
mService.setMobileDataEnabled(ActivityThread.currentPackageName(), enabled);
} catch (RemoteException e) {
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/java/android/net/IConnectivityManager.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ interface IConnectivityManager
boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);

boolean getMobileDataEnabled();
void setMobileDataEnabled(boolean enabled);
void setMobileDataEnabled(String callingPackage, boolean enabled);

/** Policy control over specific {@link NetworkStateTracker}. */
void setPolicyDataEnable(int networkType, boolean enabled);
Expand Down
1 change: 1 addition & 0 deletions core/java/com/android/internal/app/IAppOpsService.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface IAppOpsService {
List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops);
void setMode(int code, int uid, String packageName, int mode);
void resetAllModes();
void resetCounters();

// Privacy guard methods
boolean getPrivacyGuardSettingForPackage(int uid, String packageName);
Expand Down
46 changes: 46 additions & 0 deletions core/res/res/layout/permission_confirmation_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (c) 2013, The Linux Foundation. All rights reserved.
** Not a Contribution.
**
** Copyright 2012 The Android Open Source Project
**
** 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.
*/
-->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parentPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:orientation="vertical">

<TextView android:id="@+id/permission_text"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingTop="16dip"
android:paddingBottom="16dip" />

<CheckBox android:id="@+id/permission_remember_choice_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save_password_remember" />

</LinearLayout>
22 changes: 21 additions & 1 deletion core/res/res/values-de/cm_strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012-2013 The CyanogenMod Project
<!--
Copyright (C) 2012-2013 The CyanogenMod Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -74,4 +75,23 @@
<string name="perf_profile_pwrsv">Energie sparen</string>
<string name="perf_profile_bal">Ausgeglichen</string>
<string name="perf_profile_perf">Mehr Leistung</string>

<!-- CAF strings -->
<string name="enablePin">Fehlgeschlagen. Aktivieren Sie die SIM-Kartensperre.</string>
<string name="keyguard_password_wrong_puk_code">Falscher PUK-Code</string>
<string name="keyguard_password_pin_failed">Entsperren mit PIN fehlgeschlagen</string>
<string name="keyguard_password_puk_failed">Entsperren mit PUK fehlgeschlagen</string>
<string name="keyguard_pin_accepted">Code akzeptiert</string>
<string name="pinpuk_attempts">\nVerbleibende Versuche:</string>
<string name="lockscreen_sim_error_message_short">Ungültige Karte</string>
<string name="lockscreen_sim_error_message">SIM-Karte ist ungültig</string>
<string name="lockscreen_perso_locked_message">SIM-Karte ist gesperrt</string>
<string name="stk_cc_ussd_to_dial">USSD-Anfrage wurde in DIAL-Anfrage umgewandelt</string>
<string name="stk_cc_ussd_to_ss">USSD-Anfrage wurde in SS-Anfrage umgewandelt</string>
<string name="stk_cc_ussd_to_ussd">USSD-Anfrage wurde in neue USSD-Anfrage umgewandelt</string>
<string name="stk_cc_ss_to_dial">SS-Anfrage wurde in DIAL-Anfrage umgewandelt</string>
<string name="stk_cc_ss_to_ussd">SS-Anfrage wurde in USSD-Anfrage umgewandelt</string>
<string name="stk_cc_ss_to_ss">SS-Anfrage wurde in neue SS-Anfrage umgewandelt</string>
<string name="msim_kg_sim_pin_msg_format">Vertrag:<xliff:g id="number">%d</xliff:g> : <xliff:g id="msg">%s</xliff:g>.</string>
<string name="msim_carrier_text_format"><xliff:g id="text_1">%s</xliff:g>, <xliff:g id="text_2">%s</xliff:g></string>
</resources>
38 changes: 38 additions & 0 deletions core/res/res/values/cm_arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,42 @@
<item>2</item>
</string-array>

<!-- User display names for app ops codes -->
<string-array name="app_ops_labels">
<item>Trying to access location</item>
<item>Trying to access location</item>
<item>Trying to access location</item>
<item>Trying to use vibrate</item>
<item>Trying to read contacts</item>
<item>Trying to modify contacts</item>
<item>Trying to read call log</item>
<item>Trying to modify call log</item>
<item>Trying to read calendar</item>
<item>Trying to modify calendar</item>
<item>Trying to access location</item>
<item>Trying to post notification</item>
<item>Trying to access location</item>
<item>Trying to make phone call</item>
<item>Trying to read SMS/MMS</item>
<item>Trying to write/modify SMS/MMS</item>
<item>Trying to receive SMS/MMS</item>
<item>Trying to receive SMS/MMS</item>
<item>Trying to receive SMS/MMS</item>
<item>Trying to receive SMS/MMS</item>
<item>Trying to send SMS/MMS</item>
<item>Trying to read SMS/MMS</item>
<item>Trying to write/modify SMS/MMS</item>
<item>Trying to modify settings</item>
<item>Trying to draw on top</item>
<item>Trying to access notifications</item>
<item>Trying to access Camera</item>
<item>Trying to record audio</item>
<item>Trying to play audio</item>
<item>Trying to read clipboard</item>
<item>Trying to modify clipboard</item>
<item>Trying to turn on/off Wifi</item>
<item>Trying to turn on/off bluetooth</item>
<item>Trying to turn on/off mobile data</item>
<item>Trying to schedule device wakeup</item>
</string-array>
</resources>
Loading

0 comments on commit 5f260d4

Please sign in to comment.