Skip to content

Commit 0c19162

Browse files
committed
Remove "protect" command from installd
No one uses the "protect" command anymore, so remove it from installd. Change-Id: Ia990bae6f95cd6e317496f5dd173ec15164d7164
1 parent add52a9 commit 0c19162

File tree

3 files changed

+0
-51
lines changed

3 files changed

+0
-51
lines changed

cmds/installd/commands.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -403,37 +403,6 @@ int rm_dex(const char *path)
403403
}
404404
}
405405

406-
int protect(char *pkgname, gid_t gid)
407-
{
408-
struct stat s;
409-
char pkgpath[PKG_PATH_MAX];
410-
411-
if (gid < AID_SYSTEM) return -1;
412-
413-
if (create_pkg_path_in_dir(pkgpath, &android_app_private_dir, pkgname, ".apk"))
414-
return -1;
415-
416-
if (stat(pkgpath, &s) < 0) return -1;
417-
418-
if (chown(pkgpath, s.st_uid, gid) < 0) {
419-
ALOGE("failed to chgrp '%s': %s\n", pkgpath, strerror(errno));
420-
return -1;
421-
}
422-
if (chmod(pkgpath, S_IRUSR|S_IWUSR|S_IRGRP) < 0) {
423-
ALOGE("protect(): failed to chmod '%s': %s\n", pkgpath, strerror(errno));
424-
return -1;
425-
}
426-
427-
#ifdef HAVE_SELINUX
428-
if (selinux_android_setfilecon(pkgpath, pkgname, s.st_uid) < 0) {
429-
ALOGE("cannot setfilecon dir '%s': %s\n", pkgpath, strerror(errno));
430-
return -1;
431-
}
432-
#endif
433-
434-
return 0;
435-
}
436-
437406
int get_size(const char *pkgname, int persona, const char *apkpath,
438407
const char *fwdlock_apkpath, const char *asecpath,
439408
int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,

cmds/installd/installd.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ static int do_rm_cache(char **arg, char reply[REPLY_MAX])
7575
return delete_cache(arg[0]); /* pkgname */
7676
}
7777

78-
static int do_protect(char **arg, char reply[REPLY_MAX])
79-
{
80-
return protect(arg[0], atoi(arg[1])); /* pkgname, gid */
81-
}
82-
8378
static int do_get_size(char **arg, char reply[REPLY_MAX])
8479
{
8580
int64_t codesize = 0;
@@ -153,7 +148,6 @@ struct cmdinfo cmds[] = {
153148
{ "fixuid", 3, do_fixuid },
154149
{ "freecache", 1, do_free_cache },
155150
{ "rmcache", 1, do_rm_cache },
156-
{ "protect", 2, do_protect },
157151
{ "getsize", 5, do_get_size },
158152
{ "rmuserdata", 2, do_rm_user_data },
159153
{ "movefiles", 0, do_movefiles },

services/java/com/android/server/pm/Installer.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,20 +324,6 @@ public int freeCache(long freeStorageSize) {
324324
return execute(builder.toString());
325325
}
326326

327-
/*
328-
* @param packagePathSuffix The name of the path relative to install
329-
* directory. Say if the path name is /data/app/com.test-1.apk, the package
330-
* suffix path will be com.test-1
331-
*/
332-
public int setForwardLockPerm(String packagePathSuffix, int gid) {
333-
StringBuilder builder = new StringBuilder("protect");
334-
builder.append(' ');
335-
builder.append(packagePathSuffix);
336-
builder.append(' ');
337-
builder.append(gid);
338-
return execute(builder.toString());
339-
}
340-
341327
public int getSizeInfo(String pkgName, int persona, String apkPath, String fwdLockApkPath,
342328
String asecPath, PackageStats pStats) {
343329
StringBuilder builder = new StringBuilder("getsize");

0 commit comments

Comments
 (0)