Your Digital Media Has Never Looked So Good

 
ratish
Topic Author
Posts: 40
Joined: Tue Mar 12, 2013 9:24 pm

Registry not Cleared if App is deleted

Fri Jan 16, 2015 11:08 am

Hi

Had some data stored in registry for my App to during launch. But somehow one of the data got wrong. So wanted to delete the app and installed again so that i can start fresh. But looks like even after deleting the app, the data resides in registry which is picked up again by the installed app.
This is happening with the private channel I have created which we test before submitting for publishing.
 
User avatar
RokuJoel
Posts: 1758
Joined: Mon Nov 14, 2011 5:22 pm

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 11:16 am

Solution is delete the channel, then reboot

- Joel
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 11:39 am

The reboot is a new requirement, and an annoying one.. :P

That aside, you can always explicitly delete the registry information using ifRegistrySection.Delete(key).
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
ratish
Topic Author
Posts: 40
Joined: Tue Mar 12, 2013 9:24 pm

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 11:59 am

RokuJoel wrote:
Solution is delete the channel, then reboot

- Joel


It is not working on the private channel.
Steps applied:
1. Removed the channel from Roku.
2. Rebooted the box.
3. Visited my Roku account and added the private channel again.
4. System update in Roku to install the app.
5. Launch the app and it reads the credential from registry(which means registry was not cleared).
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 12:13 pm

ratish wrote:
RokuJoel wrote:
Solution is delete the channel, then reboot

- Joel

It is not working on the private channel.
Steps applied:
1. Removed the channel from Roku.
2. Rebooted the box.
3. Visited my Roku account and added the private channel again.
4. System update in Roku to install the app.
5. Launch the app and it reads the credential from registry(which means registry was not cleared).

Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
User avatar
RokuJoel
Posts: 1758
Joined: Mon Nov 14, 2011 5:22 pm

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 12:15 pm

Good point. If you have 10 channels signed with the same dev id the registry won't clear until you delete them all. A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.

- Joel
 
ratish
Topic Author
Posts: 40
Joined: Tue Mar 12, 2013 9:24 pm

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 2:59 pm

"Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key."

With Key do you mean the Dev ID we use to package the zip(channel)?
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 3:49 pm

ratish wrote:
"Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key."

With Key do you mean the Dev ID we use to package the zip(channel)?

Yes.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 3:52 pm

ratish wrote:
"Deleting the channel will only clear the registry if you have no other channels installed that were signed with the same key."

With Key do you mean the Dev ID we use to package the zip(channel)?

Yes. Registry hives are on per-DevID basis, meaning all channels signed with the same ID share the same registry (and kinda-sorta can share data between themselves that way). A registry will be deleted for realz only after the lastest channel of a DevID is flushed from the device - and TIL (Today I Learn) that a bonus reboot might be required. (re)see also http://sdkdocs.roku.com/display/sdkdoc/roRegistry
 
belltown
Posts: 1461
Joined: Thu Dec 09, 2010 1:43 pm
Contact:

Re: Registry not Cleared if App is deleted

Fri Jan 16, 2015 7:32 pm

RokuJoel wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.

For anyone looking for such a channel, here is some code I wrote that does just that.

You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.

Tested on firmware 3.1 and 6.1.

Sub Main ()
    displayMainUI ()
End Sub

'
' UI component for the top-level menu
'
Function displayMainUI () As Void
    contentList = [
        {ShortDescriptionLine1: "Dump the whole registry"},
        {ShortDescriptionLine1: "Wipe the whole registry"},
        {ShortDescriptionLine1: "Delete an individual section"},
    ]
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roPosterScreen")
    ui.SetMessagePort (port)
    ui.SetListStyle ("flat-category")
    ui.SetContentList (contentList)
    ui.Show ()
    While True
        msg = Wait (0, port)
        If Type (msg) = "roPosterScreenEvent"
            If msg.IsScreenClosed ()
                Exit While
            Else If msg.IsListItemSelected ()
                index = msg.GetIndex ()
                If index = 0
                    dumpRegistryUI ()
                Else If index = 1
                    wipeRegistryUI ()
                Else If index = 2
                    deleteSectionUI ()
                EndIf
            EndIf   
        EndIf
    End While
End Function

'
' UI component for dumping the entire registry
'
Function dumpRegistryUI () As Void
    regText = getRegText ()
    If regText = ""
        displayMessage ("Registry is empty")
    Else
        port = CreateObject ("roMessagePort")
        ui = CreateObject ("roTextScreen")
        ui.SetMessagePort (port)
        ui.SetText (fixup (regText))    ' Use fw3.1 bug workaround
        ui.AddButton (0, "Quit")
        ui.Show ()
        While True
            msg = Wait (0, port)
            If Type (msg) = "roTextScreenEvent"
                If msg.IsScreenClosed ()
                    Exit While
                Else If msg.IsButtonPressed ()
                    ui.Close ()
                EndIf   
            EndIf
        End While
    EndIf
End Function

'
'  UI component for deleting the entire registry
'
Function wipeRegistryUI () As Void
    If confirmUI ("Wipe Registry", "Select 'Wipe Registry' to delete the entire registry")
        deleteReg ("")  ' Delete all sections
    EndIf
End Function

'
' UI component for deleting an individual registry section
'
Function deleteSectionUI () As Void
    regSectionList = getRegSectionList ()
    If regSectionList.Count () = 0
        displayMessage ("Registry is empty")
    Else
        contentList = []
        For Each section In regSectionList
            If section.keyCount = 0
                keyCountStr = "No keys in section"
            Else If section.keyCount = 1
                keyCountStr = "1 key in section"
            Else
                keyCountStr = section.keyCount.ToStr () + " keys in section"
            EndIf
            contentList.Push ({Title: section.name, ShortDescriptionLine1: keyCountStr})
        End For
        port = CreateObject ("roMessagePort")
        ui = CreateObject ("roListScreen")
        ui.SetMessagePort (port)
        ui.SetupBehaviorAtTopRow ("exit")   ' Give fw3.1 users a way back
        ui.SetHeader ("Press 'OK' to delete section")
        ui.SetContent (contentList)
        ui.Show ()
        While True
            msg = Wait (0, port)
            If Type (msg) = "roListScreenEvent"
                If msg.IsScreenClosed ()
                    Exit While
                Else If msg.IsListItemSelected ()
                    section = contentList [msg.GetIndex ()].Title
                    If confirmUI ("Delete Section", "Select 'Delete Section' to delete the " + section + " section")
                        deleteReg (section)
                        ui.Close ()
                    EndIf
                EndIf   
            EndIf
        End While
    EndIf
End Function

'
' Return a list of all registry sections and the number of keys in each section
'
Function getRegSectionList () As Object
    regSectionList = []
    r = CreateObject ("roRegistry")
    For Each section In r.GetSectionList ()
        rs = CreateObject ("roRegistrySection", section)
        regSectionList.Push ({name: section, keyCount: rs.GetKeyList ().Count ()})
    End For
    Return regSectionList
End Function

'
' Get the contents of a registry section as a text string
'
Function getRegTextSection (sectionName = "" As String) As String
    regText = "Registry Section: " + sectionName + LF ()
    rs = CreateObject ("roRegistrySection", sectionName)
    For Each key In rs.GetKeyList ()
        regText = regText + "    " + key + ": " + rs.Read (key) + LF ()
    End For
    Return regText
End Function

'
' Get the contents of a registry or registry section as a text string
'
Function getRegText (sectionName = "" As String) As String
    regText = ""
    If sectionName = ""
        r = CreateObject ("roRegistry")
        For Each section In r.GetSectionList ()
            regText = regText + getRegTextSection (section) + LF ()
        End For
    Else
        regText = regText + getRegTextSection (sectionName)
    Endif
    Return regText
End Function

'
' Roku 3.1 firmware roTextScreen bug workaround (buttons don't work unless enough text to scroll)
'
Function fixup (regText As String) As String
    fixedText = regText
    lfCount = 0
    ' Count the number of line-ending characters
    For i = 1 To Len (regText)
        If Mid (regText, i, 1) = LF () Then lfCount = lfCount + 1
    End For
    ' Ensure there are at least 18 lines to guarantee a scroll bar appears
    If lfCount < 18 Then fixedText = fixedText + String (18 - lfCount, LF ())
    Return fixedText
End Function

'
' Delete the entire registry or an individual registry section
'
Function deleteReg (section = "" As String) As Void
    r = CreateObject ("roRegistry")
    If section = ""
        For Each regSection In r.GetSectionList ()
            r.Delete (regSection)
        End For
    Else
        r.Delete (section)
    Endif
    r.Flush ()
End Function

'
' Display a confirmation before an irreversible action
'
Function confirmUI (buttonText As String, buttonDesc As String) As Boolean
    confirm = False
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roMessageDialog")
    ui.SetMessagePort (port)
    ui.SetTitle ("DANGER -- This Action Cannot Be Undone")
    ui.SetText ("Select 'Cancel' to go back")
    ui.SetText (buttonDesc)
    ui.AddButton (0, "Cancel")
    ui.AddButton (1, buttonText)
    ui.Show ()
    While True
        msg = Wait (0, port)
        If Type (msg) = "roMessageDialogEvent"
            If msg.IsScreenClosed ()
                Exit While
            Else If msg.IsButtonPressed ()
                If msg.GetIndex () = 1
                    confirm = True
                EndIf
                ui.Close ()
            EndIf   
        EndIf
    End While
    Return confirm
End Function

'
' Display an informational message
'
Function displayMessage (text As String) As Void
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roMessageDialog")
    ui.SetMessagePort (port)
    ui.SetTitle (text)
    ui.AddButton (0, "OK")
    ui.Show ()
    While True
        msg = Wait (0, port)
        If Type (msg) = "roMessageDialogEvent"
            If msg.IsScreenClosed ()
                Exit While
            Else If msg.IsButtonPressed ()
                ui.Close ()
            EndIf
        EndIf
    End While
End Function

'
' Line-ending character to use in a text string
'
Function LF () As String : Return Chr (10) : End Function
https://github.com/belltown/
 
ratish
Topic Author
Posts: 40
Joined: Tue Mar 12, 2013 9:24 pm

Re: Registry not Cleared if App is deleted

Tue Jan 20, 2015 10:41 am

belltown wrote:
RokuJoel wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.

For anyone looking for such a channel, here is some code I wrote that does just that.

You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.


This prints only the registry from the space where you side loaded your app with the same device ID with which you pushed this Test Code.
It doesn't seem to print all registry values of all applications in the box.
 
destruk
Posts: 2599
Joined: Sat Dec 18, 2010 4:58 pm

Re: Registry not Cleared if App is deleted

Tue Jan 20, 2015 11:46 am

A factory default/reset from the settings menu 'should' clear the registry, as well as everything else and it automatically reboots for you too.
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Registry not Cleared if App is deleted

Tue Jan 20, 2015 12:25 pm

ratish wrote:
belltown wrote:
RokuJoel wrote:
A faster way to test your channels is to create an app that just deletes all the reg keys, run that and no reboot needed.

For anyone looking for such a channel, here is some code I wrote that does just that.

You can dump the entire registry contents on an roTextScreen, wipe the entire registry clean, or delete individual registry sections.


This prints only the registry from the space where you side loaded your app with the same device ID with which you pushed this Test Code.
It doesn't seem to print all registry values of all applications in the box.

There is no way to do that. That would be a huge security hole if you could, as many channels store authentication information in the registry.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Registry not Cleared if App is deleted

Tue Jan 20, 2015 1:29 pm

"Separation of church and state", separation of concerns.
Each app gets its own sandbox to play in. Other apps data belongs to them (see "Nunya Business Inc" :lol: ).
iOS and Android are even more restrictive (1 app <-> 1 data), where on Roku one can have "constellation" of apps signed by the same dev-key so they can share data, if one so pleases.
 
lisakb140
Posts: 28
Joined: Tue Aug 14, 2018 8:18 am

Re: Registry not Cleared if App is deleted

Thu Nov 29, 2018 2:30 pm

I even tried doing a factory reset, and it seems this data has still persisted. I am using the new Roku SG framework, and I am trying to programmatically delete data in my app when a user logs out, with the deleteRegistry sub Function in generalUtilities (it uses Delete(key)).

Does anyone know why even after a factory reset it still appears as if I am logged in?!?

Who is online

Users browsing this forum: No registered users and 2 guests