Lines Matching refs:userId

99     private static final void checkWritePermission(int userId) {
107 private static final void checkPasswordReadPermission(int userId) {
115 private static final void checkReadPermission(int userId) {
118 && UserHandle.getUserId(callingUid) != userId) {
120 + " not authorized to read settings of user " + userId);
125 public void setBoolean(String key, boolean value, int userId) throws RemoteException {
126 checkWritePermission(userId);
128 writeToDb(key, value ? "1" : "0", userId);
132 public void setLong(String key, long value, int userId) throws RemoteException {
133 checkWritePermission(userId);
135 writeToDb(key, Long.toString(value), userId);
139 public void setString(String key, String value, int userId) throws RemoteException {
140 checkWritePermission(userId);
142 writeToDb(key, value, userId);
146 public boolean getBoolean(String key, boolean defaultValue, int userId) throws RemoteException {
147 //checkReadPermission(userId);
149 String value = readFromDb(key, null, userId);
155 public long getLong(String key, long defaultValue, int userId) throws RemoteException {
156 //checkReadPermission(userId);
158 String value = readFromDb(key, null, userId);
163 public String getString(String key, String defaultValue, int userId) throws RemoteException {
164 //checkReadPermission(userId);
166 return readFromDb(key, defaultValue, userId);
169 private String getLockPatternFilename(int userId) {
173 if (userId == 0) {
177 return new File(Environment.getUserSystemDirectory(userId), LOCK_PATTERN_FILE)
182 private String getLockPasswordFilename(int userId) {
186 if (userId == 0) {
190 return new File(Environment.getUserSystemDirectory(userId), LOCK_PASSWORD_FILE)
196 public boolean havePassword(int userId) throws RemoteException {
199 return new File(getLockPasswordFilename(userId)).length() > 0;
203 public boolean havePattern(int userId) throws RemoteException {
206 return new File(getLockPatternFilename(userId)).length() > 0;
210 public void setLockPattern(byte[] hash, int userId) throws RemoteException {
211 checkWritePermission(userId);
213 writeFile(getLockPatternFilename(userId), hash);
217 public boolean checkPattern(byte[] hash, int userId) throws RemoteException {
218 checkPasswordReadPermission(userId);
221 RandomAccessFile raf = new RandomAccessFile(getLockPatternFilename(userId), "r");
240 public void setLockPassword(byte[] hash, int userId) throws RemoteException {
241 checkWritePermission(userId);
243 writeFile(getLockPasswordFilename(userId), hash);
247 public boolean checkPassword(byte[] hash, int userId) throws RemoteException {
248 checkPasswordReadPermission(userId);
252 RandomAccessFile raf = new RandomAccessFile(getLockPasswordFilename(userId), "r");
271 public void removeUser(int userId) {
272 checkWritePermission(userId);
276 File file = new File(getLockPasswordFilename(userId));
280 file = new File(getLockPatternFilename(userId));
286 db.delete(TABLE, COLUMN_USERID + "='" + userId + "'", null);
309 private void writeToDb(String key, String value, int userId) {
310 writeToDb(mOpenHelper.getWritableDatabase(), key, value, userId);
313 private void writeToDb(SQLiteDatabase db, String key, String value, int userId) {
316 cv.put(COLUMN_USERID, userId);
322 new String[] {key, Integer.toString(userId)});
330 private String readFromDb(String key, String defaultValue, int userId) {
336 new String[] { Integer.toString(userId), key },