final static String COMMAND_ARCHITECTURE_INFO = "uname -m";
final static String EMULATOR = "emulator";
final static String COMMAND_DEVICE_TYPE = "[ -f /dev/samsung_sdb ] || echo " + EMULATOR;
+ public final static String DEFAULT_APP_INSTALL_PATH = "/opt/usr/apps";
+ public final static String TEMPORARY_PKG_DIRECTORY = "tmp";
+ public final static String PKG_TOOL_INSTALL_PATH_COMMAND = "pkgcmd -a";
+ public final static String PKG_TOOL_INSTALL_PATH_COMMAND_RESULT = "Tizen Application Installation Path:";
/** Serial number of the device */
private String mSerialNumber = null;
private static final String LOG_TAG = "Device";
private SdbShellProcess sdbShellProcess = null;
+
+ private String appInstallPath = "";
public String getSerialNumber() {
return mSerialNumber;
public String syncPackageToDevice(String localFilePath) throws IOException, SdbCommandRejectedException, TimeoutException {
try {
String packageFileName = getFileName(localFilePath);
- String remoteFilePath = String.format("/opt/apps/tmp/%1$s", packageFileName); //$NON-NLS-1$
+ String remoteFilePath = String.format("%s/%1$s", getDeveloperDirectoryPath(), packageFileName); //$NON-NLS-1$
Log.d(packageFileName, String.format("Uploading %1$s onto device '%2$s'", packageFileName, getSerialNumber()));
Log.e("sdb", "execute " + COMMAND_DEVICE_TYPE + " failed:" + e);
}
}
+
+ @Override
+ public String getAppInstallPath() {
+ if ( appInstallPath.isEmpty() ) {
+ try {
+ executeShellCommand(PKG_TOOL_INSTALL_PATH_COMMAND, new AppInstallPathReceiver());
+ } catch (Exception e) {
+ appInstallPath = "";
+ Log.e("sdb", "execute " + PKG_TOOL_INSTALL_PATH_COMMAND + " failed:" + e);
+ }
+ }
+ return appInstallPath;
+ }
+
+ @Override
+ public String getDeveloperDirectoryPath() {
+ return getAppInstallPath() + "/" + Device.TEMPORARY_PKG_DIRECTORY;
+ }
+
+ class AppInstallPathReceiver extends MultiLineReceiver {
+ @Override
+ public void processNewLines(String[] lines) {
+ for ( String line : lines ) {
+ if ( line.startsWith(Device.PKG_TOOL_INSTALL_PATH_COMMAND_RESULT) ) {
+ appInstallPath = line.replaceFirst(Device.PKG_TOOL_INSTALL_PATH_COMMAND_RESULT, "");
+ appInstallPath = appInstallPath.trim();
+ break;
+ }
+ }
+ }
+ }
class ArchInfoReceiver extends MultiLineReceiver {
@Override
void removeRemotePackage(String remoteFilePath)
throws TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException,
IOException;
+
+ /**
+ * Returns application's installation path.
+ */
+ String getAppInstallPath();
+
+ /**
+ * Returns temporary directory that has a developer permission.
+ */
+ String getDeveloperDirectoryPath();
}
package org.tizen.common;
import org.tizen.common.util.OSChecker;
+import org.tizen.sdblib.IDevice;
/**
* All constant definitions related Tizen Platform such as Emulator or Device.
public static final String HOST_GDBSERVER_PATH = "/usr/bin/gdbserver";
// Definitions for installing
+ /**
+ * @deprecated APP_INSTALL_PATH is deprecated. Use {@link IDevice#getAppInstallPath()}.
+ */
public static final String APP_INSTALL_PATH;
public static final String APP_ICON_INSTALL_PATH;
+
+ /**
+ * @deprecated APP_INSTALL_PATH is deprecated. Use {@link IDevice#getDeveloperDirectoryPath()}.
+ */
public static final String TEMPORARY_PKG_PATH;
public static final String PKG_TOOL = "pkgcmd";
public static final String PKG_TOOL_LIST_COMMAND = PKG_TOOL + " -l | grep %s";
public static final String PKG_TOOL_INSTALL_COMMAND = PKG_TOOL + " -q -i -t %s -p %s";
public static final String PKG_TOOL_RUNNING_CHECK_COMMAND = PKG_TOOL + " -C -t %s -n %s";
public static final String PKG_TOOL_TERMINATE_COMMAND = PKG_TOOL + " -k -t %s -n %s";
- public static final String PKG_TOOL_INSTALL_PATH_COMMAND = PKG_TOOL + " -a";
// Definitions for RDS
public static final String RDS_PUSH_DIRECTORY_COMMAND = "mkdir -p -m 755 \"%s\""+ TizenPlatformConstants.CMD_SUFFIX;
public static final String PROCESS_GET_PROCESS_ID_COMMAND = "ps -ef | grep '%s' | grep -v grep | awk '{print $2}'";
public static final String PROCESS_SIGKILL_COMMAND = "kill -9 %s";
public static final String PKG_TOOL_RUNNUNG_CHECK_COMMAND_RUNNING= "is Running";
- public static final String PKG_TOOL_INSTALL_PATH_COMMAND_RESULT = "Tizen Application Installation Path:";
// Constants have a potential for change
static {
TOOLS_TARGET_PATH = "/home/developer/sdk_tools";
GDBSERVER_CMD = TizenPlatformConstants.TOOLS_TARGET_PATH + "/gdbserver/gdbserver";
GDBSERVER_PLATFORM_CMD = TizenPlatformConstants.TOOLS_TARGET_PATH + "/gdbserver-platform/gdbserver";
- APP_INSTALL_PATH = "/opt/apps";
+ APP_INSTALL_PATH = "/opt/usr/apps";
APP_ICON_INSTALL_PATH = "shared/res";
- TEMPORARY_PKG_PATH = "/opt/apps/PKGS/";
+ TEMPORARY_PKG_PATH = "/opt/usr/apps/tmp/";
DEBUG_COREFILE_PATH = "/opt/usr/share/crash/dump";
DEBUG_COREFILE_EXTENSION = "coredump";
DEBUG_COREFILE_EXTRACT_COMMAND = "tar -xvf %s -C %s --wildcards --no-anchored '%s'";