diff options
author | shivamv <shivam.v2@samsung.com> | 2022-11-10 14:52:09 +0530 |
---|---|---|
committer | shivamv <shivam.v2@samsung.com> | 2022-11-11 15:31:49 +0530 |
commit | 87873656e21326fddf12b406d753f1de5eac5a9a (patch) | |
tree | cc10c8caaf56f87554d78d7a152bfe0edd4db905 | |
parent | 9a71431abbeca4df955d6713e8d68d788161f76f (diff) | |
download | tray-87873656e21326fddf12b406d753f1de5eac5a9a.tar.gz tray-87873656e21326fddf12b406d753f1de5eac5a9a.tar.bz2 tray-87873656e21326fddf12b406d753f1de5eac5a9a.zip |
Modifying Remove App Feature to reset score and remove app from Trayaccepted/tizen/unified/20221115.022416
Change-Id: I675402886355213ca154549f75165da7ca06b789
Signed-off-by: shivamv <shivam.v2@samsung.com>
-rwxr-xr-x | TrayApplication/Core/AppLauncher.cs | 13 | ||||
-rwxr-xr-x | TrayApplication/Core/AppScoreDataBase.cs | 15 | ||||
-rwxr-xr-x | TrayApplication/TrayApplication.cs | 2 | ||||
-rwxr-xr-x | TrayApplication/ViewModels/ApplicationViewModel.cs | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | TrayApplication/tizen-manifest.xml | 1 | ||||
-rwxr-xr-x | packaging/org.tizen.TrayApplication-1.0.0.tpk | bin | 228462 -> 228691 bytes |
6 files changed, 22 insertions, 10 deletions
diff --git a/TrayApplication/Core/AppLauncher.cs b/TrayApplication/Core/AppLauncher.cs index 690bbfc..c05dc1a 100755 --- a/TrayApplication/Core/AppLauncher.cs +++ b/TrayApplication/Core/AppLauncher.cs @@ -66,5 +66,18 @@ namespace TrayApplication.Core Tizen.Log.Error(Resources.LogTag, "app timeout" + e.Message); } } + + public static void CloseApplication(string id)
+ {
+ try
+ {
+ ApplicationRunningContext applicationRunningContext = new ApplicationRunningContext(id);
+ ApplicationManager.TerminateBackgroundApplication(applicationRunningContext);
+ }
+ catch (Exception ex)
+ {
+ Tizen.Log.Error(Resources.LogTag, "App Closing Failed" + ex.Message);
+ }
+ } } } diff --git a/TrayApplication/Core/AppScoreDataBase.cs b/TrayApplication/Core/AppScoreDataBase.cs index 8ab91df..af8b523 100755 --- a/TrayApplication/Core/AppScoreDataBase.cs +++ b/TrayApplication/Core/AppScoreDataBase.cs @@ -27,11 +27,10 @@ namespace TrayApplication.Core private const string CREATE_TABLE_QUERY = "CREATE TABLE APP_INFO(NAME VARCHAR(30), SCORE FLOAT(10));"; private const string INSERT_VALUES_QUERY = "INSERT INTO APP_INFO(NAME, SCORE) VALUES('"; private const string SELECT_MAX_SCORE_QUERY = "SELECT MAX(SCORE) FROM APP_INFO;"; - private const string SELECT_MIN_SCORE_QUERY = "SELECT MIN(SCORE) FROM APP_INFO;"; private const string UPDATE_LAUNCHED_APP_QUERY = "UPDATE APP_INFO SET SCORE = SCORE + 50.00 WHERE NAME = '"; private const string UPDATE_OTHER_APPS_QUERY = "UPDATE APP_INFO SET SCORE = SCORE * 0.90 WHERE NAME !='"; private const string DELETE_APP_QUERY = "DELETE FROM APP_INFO WHERE NAME = '"; - private const string SELECT_APPS_QUERY = "SELECT * FROM APP_INFO ORDER BY SCORE DESC LIMIT "; + private const string SELECT_APPS_QUERY = "SELECT * FROM APP_INFO WHERE SCORE > 0 ORDER BY SCORE DESC LIMIT "; private static SqliteConnection sqliteConn; public static event EventHandler<EventArgs> OnDatabaseUpdate; @@ -192,6 +191,10 @@ namespace TrayApplication.Core SqliteDataReader sqliteDatareader = sqliteCmd.ExecuteReader(); sqliteDatareader.Read(); float score = sqliteDatareader.GetFloat(0); + if (score <= 0.0f)
+ {
+ score = 50.0f;
+ } sqliteCmd.Dispose(); sqliteCmd = sqliteConn.CreateCommand(); sqliteCmd.CommandText = INSERT_VALUES_QUERY + appId + "', " + score + ");"; @@ -212,13 +215,7 @@ namespace TrayApplication.Core public static void DecreaseScore(string appId) { SqliteCommand sqliteCmd = sqliteConn.CreateCommand(); - sqliteCmd.CommandText = SELECT_MIN_SCORE_QUERY; - SqliteDataReader sqliteDatareader = sqliteCmd.ExecuteReader(); - sqliteDatareader.Read(); - float score = sqliteDatareader.GetFloat(0) * 0.90f; - sqliteCmd.Dispose(); - sqliteCmd = sqliteConn.CreateCommand(); - sqliteCmd.CommandText = "UPDATE APP_INFO SET SCORE = " + score + " WHERE NAME = '" + appId + "';"; + sqliteCmd.CommandText = "UPDATE APP_INFO SET SCORE = " + 0 + " WHERE NAME = '" + appId + "';"; sqliteCmd.ExecuteNonQuery(); sqliteCmd.Dispose(); OnDatabaseUpdate.Invoke(null, new EventArgs()); diff --git a/TrayApplication/TrayApplication.cs b/TrayApplication/TrayApplication.cs index 9279b58..bfbdfa1 100755 --- a/TrayApplication/TrayApplication.cs +++ b/TrayApplication/TrayApplication.cs @@ -186,7 +186,7 @@ namespace TrayApplication { if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) { - if (mainView != null) + if (mainView != null && isTrayVisible == true) { mainView.HideView(); } diff --git a/TrayApplication/ViewModels/ApplicationViewModel.cs b/TrayApplication/ViewModels/ApplicationViewModel.cs index 6c2d9d2..6b0caff 100755 --- a/TrayApplication/ViewModels/ApplicationViewModel.cs +++ b/TrayApplication/ViewModels/ApplicationViewModel.cs @@ -141,6 +141,7 @@ namespace TrayApplication.ViewModels { AppInfoModel app = (AppInfoModel)removedItem; AppScoreDataBase.DecreaseScore(app.ApplicationId); + AppLauncher.CloseApplication(app.ApplicationId); } } } diff --git a/TrayApplication/tizen-manifest.xml b/TrayApplication/tizen-manifest.xml index 21225d2..71e5ba7 100644..100755 --- a/TrayApplication/tizen-manifest.xml +++ b/TrayApplication/tizen-manifest.xml @@ -19,6 +19,7 @@ <privilege>http://tizen.org/privilege/externalstorage.appdata</privilege> <privilege>http://tizen.org/privilege/packagemanager.info</privilege> <privilege>http://tizen.org/privilege/inputgenerator</privilege> + <privilege>http://tizen.org/privilege/appmanager.kill.bgapp</privilege> </privileges> <dependencies /> <provides-appdefined-privileges /> diff --git a/packaging/org.tizen.TrayApplication-1.0.0.tpk b/packaging/org.tizen.TrayApplication-1.0.0.tpk Binary files differindex 5013a08..15e813a 100755 --- a/packaging/org.tizen.TrayApplication-1.0.0.tpk +++ b/packaging/org.tizen.TrayApplication-1.0.0.tpk |