Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f775adc1 authored by Akhil's avatar Akhil 🙂
Browse files

Added properties to variable

parent 9e4d359a
Loading
Loading
Loading
Loading
+31 −6
Original line number Diff line number Diff line
@@ -81,19 +81,44 @@
            // - builds/CURRENT_ZIP_FILE.zip.prop ( which must exist )
            $this->buildProp = explode( "\n", @file_get_contents($this->getPropFilePath()));
            // Try to fetch build.prop values. In some cases, we can provide a fallback, in other a null value will be given
            if(!file_exists($this->filePath.'.prop')) {
                file_put_contents($this->filePath . '.prop', implode("\n", $this->buildProp));
            }
            $prop = "";
            $this->timestamp = intval( $this->getBuildPropValue( 'ro.build.date.utc' ) ?? filemtime($this->filePath) );
            $prop.='ro.build.date.utc='. $this->timestamp . "\n";
            $this->incremental = $this->getBuildPropValue( 'ro.build.version.incremental' ) ?? '';
            $prop.='ro.build.version.incremental='. $this->incremental . "\n";
            $this->apiLevel = $this->getBuildPropValue( 'ro.build.version.sdk' ) ?? '';
            $this->model = $this->getBuildPropValue( 'ro.lineage.device' ) ?? $this->getBuildPropValue( 'ro.cm.device' ) ?? ( $tokens[1] == 'cm' ? $tokens[6] : $tokens[5] );
            $prop.='ro.build.version.sdk='. $this->apiLevel . "\n";
            if ($this->getBuildPropValue( 'ro.lineage.device' )){
                $this->model = $this->getBuildPropValue( 'ro.lineage.device' );
                $prop.='ro.lineage.device='.$this->model."\n";
            }
            else if( $this->getBuildPropValue( 'ro.cm.device' )) {
                $this->model = $this->getBuildPropValue( 'ro.cm.device' );
                $prop.='ro.cm.device='.$this->model."\n";
            }
            else if   ( $tokens[1] == 'cm') {
                $this->model = $tokens[6];
            } else {
                $this->model = $tokens[5];
            }
            $this->version = $tokens[2];
            $this->displayVersion = $this->getBuildPropValue( 'ro.cm.display.version' ) ?? $this->getBuildPropValue( 'ro.lineage.display.version' ) ?? '';
            if( $this->getBuildPropValue( 'ro.cm.display.version' )){
                $this->displayVersion = $this->getBuildPropValue( 'ro.cm.display.version' );
                $prop.='ro.cm.display.version='.$this->displayVersion."\n";
            }
             else if( $this->getBuildPropValue( 'ro.lineage.display.version' )){
                $this->displayVersion = $this->getBuildPropValue( 'ro.lineage.display.version' );
                $prop.='ro.lineage.display.version='.$this->displayVersion."\n";
             } else {
                $this->displayVersion= '';
             } 
            $this->androidVersion = $this->getBuildPropValue( 'ro.build.version.release' ) ?? '';
            $prop.='ro.build.version.release='.$this->androidVersion."\n";
            if(!file_exists($this->filePath.'.prop')) {
                file_put_contents($this->filePath . '.prop',  $prop);
            }
            $this->uid = hash( 'sha256', $this->timestamp.$this->model.$this->apiLevel, false );
            $this->size = filesize($this->filePath);

            $position = strrpos( $physicalPath, '/builds/full' );
            if ( $position === FALSE )
                $this->url = $this->_getUrl( '', Flight::cfg()->get('buildsPath') );